text:
Mix pi and e to make pie!
Everybody knows pi the mathematical constant, the ratio of a circle's circumference to its diameter.
3.14159265358979323846264338327950288419716939937510...

You probably also know e the mathematical constant, the base of a natural logarithm.
2.71828182845904523536028747135266249775724709369996...

But... do you know pie? It is one of the most important constants (to me). It is the digits of pi and e interleaved.
32.1741185298216852385485997094352233854366206248373...

As a decimal expansion:
3, 2, 1, 7, 4, 1, 1, 8, 5, 2, 9, 8, 2, 1, 6, 8, 5, 2...

This is OEIS sequence A001355.

KEYWORD: nonn,base,dumb,easy

It is a very dumb sequence.
Challenge
Write a program/function that takes a non-negative integer n and outputs the nth digit of pie.
Specifications

Standard I/O rules apply.
Standard loopholes are forbidden.
Your solution must work for at least 50 digits of each constant which means it should work for at least a 100 terms of the sequence (please, try not to hardcode :P).
The output for 2 or 3 is not a decimal point.
Your solution can either be 0-indexed or 1-indexed but please specify which.
This challenge is not about finding the shortest approach in all languages, rather, it is about finding the shortest approach in each language.
Your code will be scored in bytes, usually in the encoding UTF-8, unless specified otherwise.
Built-in functions that compute this sequence are allowed but including a solution that doesn't rely on a built-in is encouraged.
Explanations, even for "practical" languages, are encouraged.

Test cases
These are 0-indexed.
Input   Output

1       2
2       1
11      8
14      6
21      4
24      9
31      5

In a few better formats:
1 2 11 14 21 24 31
1, 2, 11, 14, 21, 24, 31

2 3 12 15 22 25 32
2, 3, 12, 15, 22, 25, 32

According to the OEIS, the keyword dumb simply means uninteresting with no properties special to it.

I think hardcoding is the best solution in Python...

You might just be able to get there with Sympy...

@Downvoter Any reason, perhaps?

One could argue that the result is pei, not pie

I didn't do the down vote, but maybe because you didn't ask this on 3/14 ;)

At 1:59pm, @txtechhelp? ;)

Hardcoding the output is a standard loophole. Are you intending to override that by saying "please, try not to hardcode, or should the hardcoded answers be deleted as exploiting a standard loophole.

Mathematica, 50 bytes
1-indexed
(Riffle@@(#&@@RealDigits[#,10,5!]&/@{Pi,E}))[[#]]&

Can you explain how this works?

it's easy. It takes 120(5!) elements of each and riffle them

Nice! I tried to beat your solution by avoiding Riffle, but my solution comes up one byte short: RealDigits[If[OddQ@#,Pi,E],10,#][[1,Ceiling[#/2]]]&

This appears not to work. It returns a single digit.

@DavidC Yes!.."outputs the nth digit of pie" Exactly! why did you downvote???

Oops, my bad!  I misunderstood the goal.

Haskell, 154 147 146 bytes, NO HARDCODING OR USE OF BUILTIN CONSTANTS
This solution calculates e and pi using infinite series and stores them in arbitrary-precision fixed-point integers (Haskell's built-in Integer type and its Rational extension).
import Data.Ratio
s n=product[n,n-2..1]
r=[0..164]
f n=(show$round$(*10^50)$sum[[2*s(2*k)%(2^k*s(2*k+1)),1%product[1..k]]!!mod n 2|k<-r])!!div n 2

Ungolfed:
import Data.Ratio

semifact :: Integer -> Integer
semifact n = product [n, n-2..1]

pi_term :: Integer -> Rational
pi_term i = semifact (2*i) % (2^i * semifact (2*i+1))

--requires 164 terms to achieve desired precision
pi_sum :: Rational
pi_sum = 2 * (sum $ map (pi_term) [0..164])

--requires 40 terms to achieve desired precision
e_sum :: Rational
e_sum = sum [1 % product [1..k] | k<-[0..40]]

-- 51 digits are required because the last one suffers from rounding errors
fifty1Digits :: Rational -> String
fifty1Digits x = show $ round $ x * 10^50

pi51 = fifty1Digits pi_sum
e51  = fifty1Digits e_sum

-- select a string to draw from, and select a character from it
pie_digit n = ([pi51, e51] !! (n `mod` 2)) !! (n `div` 2)

0-indexed. Accurate for input 0-99, inaccurate for input 100-101, out-of-bounds otherwise.
Explanation:
Calculates pi using this infinite series. Calculates e using the classical inverse factorial series. Theoretically these aren't the ideal formulas to use, as they aren't very terse in terms of bytecount, but they were the only ones I could find that converged quickly enough to make verification of accuracy feasible (other sums required hundreds of thousands if not millions of terms). In the golfed version, e is calculated to a much higher precision than necessary in order to minimize bytecount. Both constants are calculated to slightly more digits than necessary to avoid rounding errors (which are responsible for the awkward tail of incorrect values).
The constants are calculated as arbitrary precision integer ratios (Rational), then multiplied by 10^50 so that all necessary digits remain intact when the ratio is converted to an (arbitrary precision) integer (Integer). This also avoids the issue of avoiding the decimal point in the numbers' string representations, which the function alternatively draws characters from.

Taxi, 749 bytes
'3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919' is waiting at Writer's Depot.Go to Post Office:w 1 l 1 r 1 l.Pickup a passenger going to The Babelfishery.Go to The Babelfishery:s 1 l 1 r.Pickup a passenger going to The Underground.Go to Writer's Depot:n 1 l 1 l 2 l.Pickup a passenger going to Chop Suey.Go to Chop Suey:n 3 r 3 r.[a]Pickup a passenger going to Narrow Path Park.Go to The Underground:s 1 r 1 l.Switch to plan "b" if no one is waiting.Pickup a passenger going to The Underground.Go to Narrow Path Park:n 4 l.Go to Chop Suey:e 1 r 1 l 1 r.Switch to plan "a".[b]Go to Narrow Path Park:n 4 l.Pickup a passenger going to Post Office.Go to Post Office:e 1 r 4 r 1 l.

Try it online!
Trying to compute pi or e programmatically in Taxi would be a nightmare, although I'm sure it can be done. Thus, it's far shorter to just hardcode the first 100 digits in the sequence. It feels pretty cheap but it's definitely the shortest Taxi code that meets the challenge.
It hard-codes the sequence as strings, takes in n, then iterates n down and removes the first character in the string each time. When n=0, output the first character. This is one-indexed.
Un-golfed / formatted:
'3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919' is waiting at Writer's Depot.
Go to Post Office: west 1st left 1st right 1st left.
Pickup a passenger going to The Babelfishery.
Go to The Babelfishery: south 1st left 1st right.
Pickup a passenger going to The Underground.
Go to Writer's Depot: north 1st left 1st left 2nd left.
Pickup a passenger going to Chop Suey.
Go to Chop Suey: north 3rd right 3rd right.
[a]
Pickup a passenger going to Narrow Path Park.
Go to The Underground: south 1st right 1st left.
Switch to plan "b" if no one is waiting.
Pickup a passenger going to The Underground.
Go to Fueler Up: south.
Go to Narrow Path Park: north 4th left.
Go to Chop Suey: east 1st right 1st left 1st right.
Switch to plan "a".
[b]
Go to Narrow Path Park: north 4th left.
Pickup a passenger going to Post Office.
Go to Post Office: east 1st right 4th right 1st left.

05AB1E, 10 bytes
žsтžtøJþsè

Explanation:
žs          Get the first input digits of pi
  тžt       Get 100 digits of e
     ø      Zip them together
      J     Join into a string
       þ    Remove non-digits
        sè  0-indexed index of input in the resulting list

0-indexed.
Try it online!

Too many 05AB1Es... :P

@Mr.Xcoder Well, 05AB1E is the language with the pi and e builtin...

@Mr.Xcoder There are builtins that's why.

@totallyhuman no it doesn't.

@Dorian Your version doesn't work. You're using the legacy version, but žt wasn't an infinite list back then, which is why Okx is using the first 100 digits of e in his program. Changing it to the new version of 05AB1E (where both pi and e are an infinite list) still wouldn't work in your current version, because the zip would create pairs and the Join would join those pairs instead of everything. 9 bytes are still possible by replacing J with S in the new version however, where S makes it a flattened list of chars/digits

@Kevin Cruijssen Yes, you're right. I didn't test it enough. I deleted my comment now. I just had 65 in my input box by chance and the code gave the correct result for that.

8 bytes

Python 2, 88 bytes
-4 bytes thanks to the base conversion idea of @EriktheOutgolfer.
lambda n:`int("SVBPXJDZK00YCG3W7CZRA378H4AM5553D52T52ZKAFJ17F4V1Q7PU7O4WV9ZXEKV",36)`[n]

Try it online!
Python 2 + sympy, 92 bytes
0-indexed. Thanks to Rod for reminding me to switch to from sympy import*, which I formerly forgot.
lambda n:sum([('3','2')]+zip(`N(pi,50)`,`N(E,50)`[:47]+'6996')[2:],())[n]
from sympy import*

Try it online!
Python 2, 114 bytes
I honestly think the shortest solution is hardcoding, since Python doesn't have useful built-ins.
lambda n:"3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919"[n]

Try it online!
Python 2, 114 bytes
Equivalent solution by @totallyhuman.
'3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919'.__getitem__

Try it online!

Before downvoting, take your time to search for a shorter solution.

Equivalent byte count.

@totallyhuman Thanks

Yes, they are equivalent :P

Found a possibly shorter solution with sympy.mpmath, editing if it becomes shorter

I found a shorter solution with mpmath and posted it below

using from sympy import* you can save a lot of bytes

99 bytes - cmon man :P (or what Rod said)

@Rod Forgot to update from my testing ground :))) - I was convinced mine was shorter and I didn't know why it was over 100 - By mistake I copied my "sandbox" try instead of my golfed approach. Sorry and thanks!

@StepHen Actually 92

The equivalent solution that you edited in is actually equivalent code, not equivalent byte count. :P

Actually hardcoding would be shorter (88 bytes) using base 36: \int("SVBPXJDZK00YCG3W7CZRA378H4AM5553D52T52ZKAFJ17F4V1Q7PU7O4WV9ZXEKV",36)`.getitemorlambda n:`int("SVBPXJDZK00YCG3W7CZRA378H4AM5553D52T52ZKAFJ17F4V1Q7PU7O4WV9ZXEKV",36)`[n]`.

@EriktheOutgolfer Thanks.

@totallyhuman Lol I saw your comment and understood it but I completely forgot to fix, because I was laughing about my own mistake. Thanks for editing in!

Python 3, 83 80 bytes
0-indexed.
lambda n:('%d'*51%(*b' )4bD4&6UcF^#!U+B>0%"WK\<>0^GO9~1c]$O;',))[n]

Try it online!
There are some non-printable characters in there that can't be seen properly in a browser.
This works by building the tuple (32, 17, 41, 18, 52, ...) from the ASCII codes of the characters in the hardcoded bytestring. The tuple is converted to the string '3217411852...', from which we select the right digit.

Polyglot, 108 bytes
n=>"3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919"[n]

Works in:

C#
JavaScript

I think this is the shortest you can do in C# seeing as it is 252 bytes to find the Nth decimal of pi.

JS polyglot :-)

@Arnauld Updated :)

Polyglot for Java, but with ->

@Okx Updated, for some reason I forgot you could index into strings in Java...

@TheLethalCoder Oh wait, that's because you can't... you've got to use .charAt I believe

Would this also be a TypeScript polyglot? And JSX?

This isn't a Java Polyglot! You can't index into Non-Array Objects in Java.

This technically works but I downvoted because it's a) not very competitive and b) extremely boring and trivial.

works also on julia with -> (like java)

@HyperNeutrino It's C# and JavaScript when are they ever competitive? And boring and trivial maybe but would you rather I did a 500 byte answer in C# that was clever? No because that conflicts with point 1. This is as short as it gets...

If it's the shortest answer then that's a different situation, but it's not particularly competing in this challenge anyway.

@HyperNeutrino Did you also downvote the Seed answer then?

Does it really matter to you that much? For what it's worth, no, I did not, because Seed is not trivial. I did however down vote the corresponding Befunge answer. Now please stop bothering me about it; if you really care that much about the answer score you can ask on meta how people are "supposed" to vote.

@HyperNeutrino I know you can vote however you like I was asking to see if I can improve my answer in any way that will satisfy you. However, as both of your criteria for downvoting conflict with this submission, short and trivial, it appears I will never be able to do that...

Why would I down vote short submissions? This is code golf after all. I am just opposed to hard coding in some cases, though I don't always down vote it because there is too much hard coding to down vote.

@HyperNeutrino I phrased that wrong I meant, you want it to be short and none trivial and in this case it isn't possible.

Seed, 6015 bytes
105 [encoded data, 6011 characters]

The Seed equivalent to my Befunge answer. Like I mentioned there, the Befunge program this outputs does not work on TIO because TIO seems to have internal line wrapping at 80 characters.

How? Just... how?

https://codegolf.stackexchange.com/a/193325/61379 Outgolfed

Java 8, 420 417 413 404 380 358 (calculated) & 115 110 (hardcoded) bytes
Calculated (420 417 413 404 380 358):
import java.math.*;n->{int i=1,x=99;BigDecimal e,f=e=BigDecimal.ONE;BigInteger p,a=BigInteger.TEN.pow(x);for(p=a=a.add(a);i<x;)e=e.add(e.ONE.divide(f=f.multiply(f.valueOf(i++)),new MathContext(x,RoundingMode.HALF_UP)));for(i=1;a.compareTo(a.ZERO)>0;)p=p.add(a=a.multiply(a.valueOf(i)).divide(a.valueOf(i+++i)));return n==1?50:((n%2<1?p:e)+"").charAt(-~n/2);}

Try it here.
Prove it outputs correct result for required 100 items.
Hardcoded: (115 110 bytes):
"3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919"::charAt

Try it online.
0-indexed
-9 and -5 bytes thanks to @Nevay.
-24 bytes thanks to @ceilingcat.

Your solution must work for at least 50 digits of each constant which means it should work for at least a 100 terms of the sequence (please, try not to hardcode :P)
Built-in functions that compute this sequence are allowed but including a solution that doesn't rely on a built-in is encouraged

You've asked for it.. ;)
Java's built-in Math.PI and Math.E are doubles, which have a max precision of just 16. Therefore, we'll have to calculate both values ourselves using java.math.BigInteger and/or java.math.BigDecimal.
Since I've already calculate PI before in another challenge, I've used that same code using BigInteger. The algorithm for Euler's number uses BigDecimal however.
The resulting p and e are therefore: 31415... and 2.718....
Could probably golf it by only using BigDecimal, but was giving some incorrect answers for PI, so I now use both BigDecimal and BigInteger.
Explanation:
import java.math.*;           // Required import for BigDecimal and BigInteger
n->{                          // Method with integer as parameter and char as return-type
  int i=1,                    //  Start index-integer at 1
      x=99;                   //  Large integer we use three times
  BigDecimal e,               //  Euler's number
             f=e=BigDecimal.ONE;
                              //  Temp BigDecimal (both `e` and `f` start at 1)
  BigInteger p,               //  PI
             a=BigInteger.TEN.pow(x);for(p=a=a.add(a);
                              //  Temp BigInteger (where both `p` and `a` starts at 10^99*2)

       i<x;)                  //  Loop (1) 99 times (the higher the better precision)
    e=e.add(                  //   Add the following to `e`:
       e.ONE.divide(f=f.multiply(f.valueOf(i++)),
                              //    First change `f` by multiplying it with `i`
        new MathContext(x,RoundingMode.HALF_UP))))
                              //    And then add 1/`f` to `e`
                              //    (RoundingMode is mandatory for BigDecimal divide)
  for(i=1;                    //  Reset `i` back to 1
      a.compareTo(a.ZERO)>0;) //  Loop (2) as long as `a` is not 0
    p=p.add(                  //   Add the following to `p`:
       a=a.multiply(a.valueOf(i))
                              //    First change `a` by multiplying it with `i`,
          .divide(a.valueOf(i+++i)));
                              //    and dividing it by `2*i+1`
                              //    And then add this new `a` to `p`
  // We now have `p`=31415... and `e`=2.718...
  return n==1?                // If the input (`n`) is 1:
          50                  //  Return 2
         :                    // Else:
          ((n%2<1?            //  If `n` is divisible by 2:
             p                //   Use `p`
            :                 //  Else:
             e)               //   Use `e` instead
    +"")                      //  Convert BigDecimal/BigInteger to String:
        .charAt(-~n/2);}      //  And return the `(n+1)//2`'th character in this string

Not sure if it will help you but my C# algorithm for calculating pi came in at 8 bytes shorter than your Java version.

Note though to get it to work properly for this question change (d+=2) to ++d and return p%10+1 to just return p%10.

@TheLethalCoder Feel free to make a C# answer for this challenge. :) Although you'll also have to calculate Euler's number. My answer is kinda for lolz anyway, since hardcoding the output is shorter anyway..

I'm in the process of making a none hardcoded one. I just posted it to see if it could help you was all :)

The C# answer came in at 377 bytes with some more golfing possible, maybe some of it will help? Though I don't know for sure.

You've asked for it.. ;) Hey, I like your first one better. I got way more hardcoded answers than I expected...

You can save 9 bytes in your calculated answer by using charAt(n+1>>1) and 5 bytes in your hardcoded version by using a method reference "..."::charAt.

@ceilingcat Thanks! And been able to golf 21 more bytes by using .valueOf instead of new BigDecimal (not sure why I didn't had that in my original answer tbh..), and 1 more by using i+++i instead of i-~i++. :)

Excel, 113 bytes
1-indexed
=MID("3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919",A1,1)

PI() is only accurate up to 15 digits.  Similar for EXP(1).
60 42 byte solution that works for Input <=30
(-18 bytes thanks to @Adam)
=MID(IF(ISODD(A1),PI(),EXP(1)/10)/10,A1/2+3,1)

The basic concept in your second approach can be shortened to 46 bytes by only having the pi/e choice inside the if(...) statement: =MID(IF(ISODD(b1),PI(),EXP(1)/10)/10,b1/2+3,1) .Can't get around the imprecision of pi() and exp(), though

05AB1E, 14 bytes
žssžt‚øJ'.Ks<è

Try it online!

This answer is 0-indexed.
žs              # pi to N digits.
  sžt           # e to N digits.
     ‚øJ        # Interleave.
        '.K     # No decimal points.
           s<è  # 0-indexed digit from string.

I know there are already three other 05AB1E answers, so it doesn't really matter, but you can golf 3 bytes by changing '.K to þ and remove the <. (Not sure why you even included the <, since you state your answer is 0-indexed. Your current answer is 1-indexed with the <.)

Hmm.. you can also remove the , since the zip does this implicitly, but I see it's than almost exactly the same as the other 10-byte answer..

Python 2 + SymPy, 70 63 bytes
lambda n:int(N([pi,E][n%2],50)*10**(n/2)%10)
from sympy import*

Try it online!

05AB1E, 13 bytes
Éi<;žtë;žs}þθ

Try it online!
Similar to Magic's answer, but kinda different.
Explanation:
Éi<;žtë;žs}þθ Supports 9842 digits of e and 98411 digits of π
É             a % 2
 i    ë   }   if a==1
  <            a - 1
   ;           a / 2
    žt         e to a digits
              else
       ;       a / 2
        žs     π to a digits
           þ  keep chars in [0-9] in a
            θ a[-1]

Japt, 55 bytes
" ®v4bØUî6UcF^#ß&6$Îø%\"Wí;<>0^GO9G1c]$O;"cs gU

Test it online! Contains a few unprintables.
Works by replacing each character in the string with its charcode, then returning the digit at the correct index. The string was generated by this program:
r"..(?=[^0]0)|25[0-5]|2[0-4].|1..|.(?=[^0]0)|..|."_n d

Test it online!

Julia, 63 bytes
1-indexed
a(n)=replace(string(BigFloat(n%2>0?π:e)),'.',"")[ceil(Int,n/2)]

Converts pi or e to a string, removes the decimal place, and then calls the appropriate digit.  Returns a character representation of the digit.

Welcome to PPCG!

Seed, 5852 5794
Based on TehPers Befunge answer.

105 [encoded data, 5790 characters]

Nice job! I'm a bit curious about how you golfed it.

Malbolge Unshackled (20-trit rotation variant), 3,64E6 bytes
Size of this answer exceeds maximum postable program size (eh), so the code is located in my GitHub repository (note: Don't copy the code using CTRL+A and CTRL+C, just rightclick and click "Save destination element as...").
How to run this?
This might be a tricky part, because naive Haskell interpreter will take ages upon ages to run this. TIO has decent Malbogle Unshackled interpreter, but sadly I won't be able to use it (limitations).
The best one I could find is the fixed 20-trit rotation width variant, that performs very well, calculating (pretty much) instantly.
To make the interpreter a bit faster, I've removed all the checks from Matthias Lutter's Malbolge Unshackled interpreter.
#include <malloc.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

const char* translation = "5z]&gqtyfr$(we4{WP)H-Zn,[%\\3dL+Q;>U!pJS72Fh"
        "OA1CB6v^=I_0/8|jsb9m<.TVac`uY*MK'X~xDl}REokN:#?G\"i@";

typedef struct Word {
    unsigned int area;
    unsigned int high;
    unsigned int low;
} Word;

void word2string(Word w, char* s, int min_length) {
    if (!s) return;
    if (min_length < 1) min_length = 1;
    if (min_length > 20) min_length = 20;
    s[0] = (w.area%3) + '0';
    s[1] = 't';
    char tmp[20];
    int i;
    for (i=0;i<10;i++) {
        tmp[19-i] = (w.low % 3) + '0';
        w.low /= 3;
    }
    for (i=0;i<10;i++) {
        tmp[9-i] = (w.high % 3) + '0';
        w.high /= 3;
    }
    i = 0;
    while (tmp[i] == s[0] && i < 20 - min_length) i++;
    int j = 2;
    while (i < 20) {
        s[j] = tmp[i];
        i++;
        j++;
    }
    s[j] = 0;
}

unsigned int crazy_low(unsigned int a, unsigned int d){
    unsigned int crz[] = {1,0,0,1,0,2,2,2,1};
    int position = 0;
    unsigned int output = 0;
    while (position < 10){
        unsigned int i = a%3;
        unsigned int j = d%3;
        unsigned int out = crz[i+3*j];
        unsigned int multiple = 1;
        int k;
        for (k=0;k<position;k++)
            multiple *= 3;
        output += multiple*out;
        a /= 3;
        d /= 3;
        position++;
    }
    return output;
}

Word zero() {
    Word result = {0, 0, 0};
    return result;
}

Word increment(Word d) {
    d.low++;
    if (d.low >= 59049) {
        d.low = 0;
        d.high++;
        if (d.high >= 59049) {
            fprintf(stderr,"error: overflow\n");
            exit(1);
        }
    }
    return d;
}

Word decrement(Word d) {
    if (d.low == 0) {
        d.low = 59048;
        d.high--;
    }else{
        d.low--;
    }
    return d;
}

Word crazy(Word a, Word d){
    Word output;
    unsigned int crz[] = {1,0,0,1,0,2,2,2,1};
    output.area = crz[a.area+3*d.area];
    output.high = crazy_low(a.high, d.high);
    output.low = crazy_low(a.low, d.low);
    return output;
}

Word rotate_r(Word d){
    unsigned int carry_h = d.high%3;
    unsigned int carry_l = d.low%3;
    d.high = 19683 * carry_l + d.high / 3;
    d.low = 19683 * carry_h + d.low / 3;
    return d;
}

// last_initialized: if set, use to fill newly generated memory with preinitial values...
Word* ptr_to(Word** mem[], Word d, unsigned int last_initialized) {
    if ((mem[d.area])[d.high]) {
        return &(((mem[d.area])[d.high])[d.low]);
    }
    (mem[d.area])[d.high] = (Word*)malloc(59049 * sizeof(Word));
    if (!(mem[d.area])[d.high]) {
        fprintf(stderr,"error: out of memory.\n");
        exit(1);
    }
    if (last_initialized) {
        Word repitition[6];
        repitition[(last_initialized-1) % 6] =
                ((mem[0])[(last_initialized-1) / 59049])
                    [(last_initialized-1) % 59049];
        repitition[(last_initialized) % 6] =
                ((mem[0])[last_initialized / 59049])
                    [last_initialized % 59049];
        unsigned int i;
        for (i=0;i<6;i++) {
            repitition[(last_initialized+1+i) % 6] =
                    crazy(repitition[(last_initialized+i) % 6],
                        repitition[(last_initialized-1+i) % 6]);
        }
        unsigned int offset = (59049*d.high) % 6;
        i = 0;
        while (1){
            ((mem[d.area])[d.high])[i] = repitition[(i+offset)%6];
            if (i == 59048) {
                break;
            }
            i++;
        }
    }
    return &(((mem[d.area])[d.high])[d.low]);
}

unsigned int get_instruction(Word** mem[], Word c,
        unsigned int last_initialized,
        int ignore_invalid) {
    Word* instr = ptr_to(mem, c, last_initialized);
    unsigned int instruction = instr->low;
    instruction = (instruction+c.low + 59049 * c.high
            + (c.area==1?52:(c.area==2?10:0)))%94;
    return instruction;
}

int main(int argc, char* argv[]) {
    Word** memory[3];
    int i,j;
    for (i=0; i<3; i++) {
        memory[i] = (Word**)malloc(59049 * sizeof(Word*));
        if (!memory) {
            fprintf(stderr,"not enough memory.\n");
            return 1;
        }
        for (j=0; j<59049; j++) {
            (memory[i])[j] = 0;
        }
    }
    Word a, c, d;
    unsigned int result;
    FILE* file;
    if (argc < 2) {
        // read program code from STDIN
        file = stdin;
    }else{
        file = fopen(argv[1],"rb");
    }
    if (file == NULL) {
        fprintf(stderr, "File not found: %s\n",argv[1]);
        return 1;
    }
    a = zero();
    c = zero();
    d = zero();
    result = 0;
    while (!feof(file)){
        unsigned int instr;
        Word* cell = ptr_to(memory, d, 0);
        (*cell) = zero();
        result = fread(&cell->low,1,1,file);
        if (result > 1)
            return 1;
        if (result == 0 || cell->low == 0x1a || cell->low == 0x04)
            break;
        instr = (cell->low + d.low + 59049*d.high)%94;
        if (cell->low == ' ' || cell->low == '\t' || cell->low == '\r'
                || cell->low == '\n');
        else if (cell->low >= 33 && cell->low < 127 &&
                (instr == 4 || instr == 5 || instr == 23 || instr == 39
                    || instr == 40 || instr == 62 || instr == 68
                    || instr == 81)) {
            d = increment(d);
        }
    }
    if (file != stdin) {
        fclose(file);
    }
    unsigned int last_initialized = 0;
    while (1){
        *ptr_to(memory, d, 0) = crazy(*ptr_to(memory, decrement(d), 0),
                *ptr_to(memory, decrement(decrement(d)), 0));
        last_initialized = d.low + 59049*d.high;
        if (d.low == 59048) {
            break;
        }
        d = increment(d);
    }
    d = zero();

    unsigned int step = 0;
    while (1) {
        unsigned int instruction = get_instruction(memory, c,
                last_initialized, 0);
        step++;
        switch (instruction){
            case 4:
                c = *ptr_to(memory,d,last_initialized);
                break;
            case 5:
                if (!a.area) {
                    printf("%c",(char)(a.low + 59049*a.high));
                }else if (a.area == 2 && a.low == 59047
                        && a.high == 59048) {
                    printf("\n");
                }
                break;
            case 23:
                a = zero();
                a.low = getchar();
                if (a.low == EOF) {
                    a.low = 59048;
                    a.high = 59048;
                    a.area = 2;
                }else if (a.low == '\n'){
                    a.low = 59047;
                    a.high = 59048;
                    a.area = 2;
                }
                break;
            case 39:
                a = (*ptr_to(memory,d,last_initialized)
                        = rotate_r(*ptr_to(memory,d,last_initialized)));
                break;
            case 40:
                d = *ptr_to(memory,d,last_initialized);
                break;
            case 62:
                a = (*ptr_to(memory,d,last_initialized)
                        = crazy(a, *ptr_to(memory,d,last_initialized)));
                break;
            case 81:
                return 0;
            case 68:
            default:
                break;
        }

        Word* mem_c = ptr_to(memory, c, last_initialized);
        mem_c->low = translation[mem_c->low - 33];

        c = increment(c);
        d = increment(d);
    }
    return 0;
}

This looks like more than 3646 bytes

@H.PWiz forgot the E, sorry

Nim, 124 97 bytes
import sugar
t(x=>($(7*"""L?J$rg$"79n*i.71&<B@[>)!Y8l:.pUo4GZ9c0a%"""[x/%2].ord))[x%%2+1])

Attempt This Online!
-27 thanks to @Steffan

So great to see nim here again!

Saves three bytes to use sugar plus =>: ATO. (don't count the t( and ) at the beginning and end)

And here's 100 bytes taking the idea of unprintables from Lynn's answer.

Incredible golfing!

Oops sorry that's only 97 bytes, I forgot to exclude the t( and ) from the bytecount

Oh, no problem. Fixed.

Python 3 + SymPy, 109 Bytes
0-indexed
Try it online!
from mpmath import*
mp.dps=51
print(''.join(['32']+[str(pi)[i]+str(e)[i]for i in range(2,51)])[int(input())])

Beat hardcoding by 5 bytes!!
But could probably be better. But beating hardcoding makes me feel good :)

C# + BigDecimal, 377 372 bytes
d=>{if(d%2<1){d/=2;int l=++d*10/3+2,j=0,i=0;long[]x=new long[l],r=new long[l];for(;j<l;)x[j++]=20;long c,n,e,p=0;for(;i<d;++i){for(j=0,c=0;j<l;c=x[j++]/e*n){n=l-j-1;e=n*2+1;r[j]=(x[j]+=c)%e;}p=x[--l]/10;r[l]=x[l++]%10;for(j=0;j<l;)x[j]=r[j++]*10;}return p%10;}else{CognitioConsulting.Numerics.BigDecimal r=1,n=1,i=1;for(;i<99;)r+=n/=i++;return(r+"").Remove(1,1)[d/2]-48;}}

Saved 5 bytes thanks to @Kevin Cruijssen.
No TIO link because of the external library, unfortunately C# doesn't have a built in BigDecimal class so this external one will have to do. Probably some golfing still possible but no time right now.
Full/Formatted Version:
namespace System.Linq
{
    class P
    {
        static void Main()
        {
            Func<int, long> f = d =>
            {
                if (d % 2 < 1)
                {
                    d /= 2;

                    int l = ++d * 10 / 3 + 2, j = 0, i = 0;
                    long[] x = new long[l], r = new long[l];

                    for (; j < l;)
                        x[j++] = 20;

                    long c, n, e, p = 0;

                    for (; i < d; ++i)
                    {
                        for (j = 0, c = 0; j < l; c = x[j++] / e * n)
                        {
                            n = l - j - 1;
                            e = n * 2 + 1;
                            r[j] = (x[j] += c) % e;
                        }

                        p = x[--l] / 10;
                        r[l] = x[l++] % 10;

                        for (j = 0; j < l;)
                            x[j] = r[j++] * 10;
                    }

                    return p % 10;
                }
                else
                {
                    CognitioConsulting.Numerics.BigDecimal r = 1, n = 1, i = 1;

                    for (; i < 99;)
                        r += n /= i++;

                    return (r + "").Remove(1,1)[d/2] - 48;
                }
            };

            for (int i = 0; i < 100; ++i)
            {
                Console.Write(f(i));
            }
            Console.WriteLine();

            Console.ReadLine();
        }
    }
}

You can ditch the parenthesis around x[j++]/e at c=(x[j++]/e)*n for -2 bytes; Also, I think you can remove both +"" at the two return statements and return an int instead of string, and then add -48 at the second return statement to convert char to int output (for -1 byte).

@KevinCruijssen Both work fine thanks!

Pyth, 35 bytes
@.i`u+/*GHhyHyK^T99rJ^2T0Z`sm/K.!dJ

Test suite
Since Pyth doesn't have built-in arbitrary precision pi and e constants, I calculate them directly.
Calculating pi:
u+/*GHhyHyK^T99rJ^2T0

This uses the following recurrence continued fraction to compute pi: 2 + 1/3*(2 + 2/5*(2 + 3/7*(2 + 4/9*(2 + ...)))). I got it from another PPCG answer. It is derived in equations 23-25 here.
I calculate it from the inside out, ommitting all terms beyond the 1024th, since the later terms have little effect on the number, and I maintain 99 digits of precision to make sure the first 50 are correct.
Calculating e:
sm/K.!dJ

I sum the reciprocals of the first 1024 numbers, to 99 digits of precision.
Then, I convert both numbers to strings, interlace them, and index.

Python 2, 82 bytes
lambda n:`7*ord('L?J$rg$"79n*i.71&<B@[>)!Y8l:.pUo4GZ9c0a%'[n/2])`[n%2+1]

Try it online!
Contains some unprintable ASCII characters. flornquake saved two bytes.

This breaks e.g. for n=64, n=65. Not sure what the best way is to fix that, maybe lambda n:('%02d'%ord('...'[n/2]))[n%2], though there's probably something better.

@flornquake darn, you're right. I wrote a fix that's one byte shorter. can't think of anything better

Nice. Here's something even shorter, based on your idea: TIO

MATLAB, 93 Bytes
n=input('');
e=num2str(exp(1));
p=num2str(pi);
c=[];
for i=1:length(p)
 c=[c p(i) e(i)];
end;
c(n)

A simple explanation is that this first converts e and pi to strings, then goes through a for loop concatenating the digits. Here, c is pie, p is pi, and e is e.
I have also broken this up into several lines for readability, but the actual code is all on one line with minimal spacing.

Welcome to the site!

Thanks, I've been browsing Code Golf for quite a while, and finally decided to give it a go myself.

This has some issues, mainly that it appears to take no input. You need to modify your function so that given the integer, n, it will produce the nth digit of the Pie sequence. You can also reduce your bytecount by reducing your variable names to a single char

Sorry, I fixed the variable names for byte count. As for the nth digit, am I just supposed to define n=?, or am I supposed to take a user input?

Looks like you already figured it out, but you should prompt the user for input, however, it is not necessary to have any formatting attached to that prompt, so you an use input('') in place of input('n')

Thanks, I made that edit as well now and it reduced the byte count by 1.

brainfuck, 402 bytes
--->+>->+>>+>+>>->->+>+>+>-->->+>+>>>->->+>+>>+>+>->+>>+>+>>+>->->>-->>>->+>>+>->->->->+>+>>->+>->+>>->>-->->>>->>>+>->->->->>->>+>-->+>+>+>>+>>>+>->->>+>>->->+>+>->>+>->->>+>->->++[[>+++<-]<+++]>>+>->+>>+>->+>+>+>+>+>+>+>+>->+>->+>>->->->>+>->->->->+>>->>>>+>+>+>>>+>>->+>>->+>->>->+>->+>>->>+>+>>+>+>+>->>>+>+>>>>+>->+>+>->+>+>>>->>>+>>>>+>->>>+>>>>->->->->->>+>,[<[-]>[<+>-]<-]++++[<+++++++++++>-]<.

Try it online!
Input as character code (e.g. "A" = 65)
Try it online with digit input!
code:
build a value list (3217411852... reversed and each digit incremented by four)
--->+>->+>>+>+>>->->+>+>+>-->->+>+>>>->->+>+>>+>+>->+>>+>+>>+>->->>-->>>->+>>
+>->->->->+>+>>->+>->+>>->>-->->>>->>>+>->->->->>->>+>-->+>+>+>>+>>>+>->->>+>
>->->+>+>->>+>->->>+>->->++[[>+++<-]<+++]>>+>->+>>+>->+>+>+>+>+>+>+>+>->+>->+
>>->->->>+>->->->->+>>->>>>+>+>+>>>+>>->+>>->+>->>->+>->+>>->>+>+>>+>+>+>->>>
+>+>>>>+>->+>+>->+>+>>>->>>+>>>>+>->>>+>>>>->->->->->>+

>,                      get input
[                       while input > 0
  <[-]                      set next previous cell = 0
  >[<+>-]                   copy input cell to that cell
  <-                        and decrement it
]
++++[<+++++++++++>-]    add 44 to it
<.                      print it

Vyxal H, 8 7 bytes
∆I₁∆ĖYi

Try it Online!
-1 thanks to tybocopperkettle
Interleaves the first 100 digits of pi and e, then prints the value at the index

You can remove the ⁰ because of implicit input. Try it online!

(Oops, wrong link. This is the right one)

Ruby, 52 bytes
Uses -rbigdecimal/math flag to require BigMath.
->n{BigMath.send([:PI,:E][n%2],n*2).to_s(?E)[n/2+2]}

Attempt This Online!
Explanation
Ungolfed:
->n{
  BigMath.send([:PI, :E][n%2], n*2)
    .to_s(?E)[n/2+2]
}

[:PI, :E][n%2] chooses which method to send to BigMath, PI or E. We call that method with n*2 as the precision argument because of a quirk when n=1 (it returns an Integer instead of a BigDecimal, and the former doesn’t take a string argument to to_s).
to_s(?E) converts the number to a string in engineering notation, then we get the n/2+2th character (+2 to skip over the 0.), which is the digit we want.

Neim, 45 bytes
(₃β{Nhj\CΓℚφᚺK$mᚠ"2oξ:{rm(/ᛂ})

neim isn't made for decimal numbers
Try it online!

Befunge, 105 bytes
3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919&0g,@

Does not work on TIO because it seems to wrap lines internally at 80 characters for some reason. You can get it to work on TIO by putting each digit on a new line, and having the &0g,@ after the 3 on the first line.

Works fine on TIO with Befunge 98: https://tio.run/##Hcg7DsJAEATRqzgiwtJO9/w64yxIxhkiIeD0y0JUpXc/Hu/neezq/fX575yElZt1QA3LVXZ4h1RDzgD4A2ZiJLxZ9C4aWCFELkR7y8tKUWVIV3FIInORTJdxXm9zjm37Ag

JavaScript (ES6) + mathjs, 78 bytes
(n,m=math.create({number:"BigNumber"}))=>`${n%2?m.e:m.pi}`.match(/\d/g)[n/2|0]

Zero indexed and works up to 128 numbers (max input of 127).
Test Snippet

let f=
(n,m=math.create({number:"BigNumber"}))=>`${n%2?m.e:m.pi}`.match(/\d/g)[n/2|0]
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/3.16.0/math.min.js"></script>
<input type=number min=0 value=0 oninput="O.innerHTML=this.value.length>0?f(+this.value):''"><pre id=O>3

MATLAB (w/ Symbolic Toolbox), 89 82 bytes
By making use of the Symbolic Toolbox, this answer provides an output without hardcoding the values of pi and e.
As a fun bonus this code as an input can take either a single index, or an array of indices and will simultaneously provide the output value for all index values provided (e.g. providing 1:10 will output the first 10 values).
a=char(vpa({'exp(1)';'pi'},51));
a(a=='.')=[];
n=input('');
a(9+fix(n/2)+56*mod(n,2))

(new lines added for readability, not required for execution so not included in byte count)
Unfortunately the Octave version used by TIO doesn't support symbolic inputs to the vpa function, so can't provide at TIO link.
In MATLAB indexing into the return vector from a function is not possible in the same way as with Octave which means this is a full program rather than just an anonymous function. The program will ask for an input n during execution - this is a one indexed value for which element is required. At the end of the program the value is implicitly printed.
For the program we use the vpa function which provides to 51 decimal places the value of pi and exp(1) (e). This is done symbolically to allow theoretically infinite precision. To expand for more than 100 elements, simply increase the value 51 in the code to increase the range.
Wrapping vpa in char (i.e. char(vpa(...)) ) is necessary to convert the output of the function to a string rather than a symbolic value. The resulting output is the string:
matrix([[2.71828182845904523536028747135266249775724709369996], [3.14159265358979323846264338327950288419716939937511]])

This includes both e and pi to 51 decimal places - enough to allow 100 digits of our output (we have to do a little extra dp than required to avoid printing out rounded values)
In order to index in to this mess, we need to at least get rid of the decimal points so that both strings of digits are contiguous. Originally I used a simple regex replacement of anything which is not a digit with nothing. However I can save 7 bytes by only getting rid of the decimal point using the code:
a(a=='.')=[];

resulting string is now:
matrix([[271828182845904523536028747135266249775724709369996], [314159265358979323846264338327950288419716939937511]])

This contains all the digits we need with both pi and e chunks in consecutive indexes.
We can then convert the supplied index such that odd numbers access the pi chunk and even numbers access the e chunk using the calculation:
9+fix(n/2)+56*mod(n,2)

Accessing that (those) index (indices) in the above string will provide the correct output.

Google Sheets, 47 Bytes

Note: due to the length of constants stored in Excel and Google Sheets, this solution is only accurate to 20 digits, accordingly

Anonymous Worksheet function that takes input from cell A1 and outputs that digit of Pie to the calling cell
=Mid(.1*If(IsOdd(A1),Pi(),.1*Exp(1)),3+A1/2,1

Hardcoded Version, 112 Bytes
This version fully meets the program specification, but is generally not fun.
Anonymous Worksheet function that returns the nth digit in the 1-indexed list of pie
=Mid("3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919",A1,1

Dividing by 10 to shift decimal point (in stead of SUBSTITUTE) can save a few of bytes in first solution.

Axiom, 148 bytes
g(x,n)==floor(numeric(x)*10^n)::INT rem 10
f(n:NNI):NNI==(m:=digits((n+4)::PI);x:=n quo 2;if n rem 2=1 then r:=g(%e,x)else r:=g(%pi,x);digits(m);r)

0 based array. Results
(10) -> [f(i) for i in 0..20]
   (10)  [3,2,1,7,4,1,1,8,5,2,9,8,2,1,6,8,5,2,3,8,5]
                                            Type: List NonNegativeInteger
(11) -> f(100001)
   (11)  6
                                                    Type: PositiveInteger

BFASM, 142 bytes

stk 0
org 0
txt "3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919"
in_ r1
rcl r2,r1
out r2

Takes input as ascii character, gives output in form of digit.

brainfuck, 5971 bytes
Direct translation of my other bfasm answer.
+>+[<[>>+>+<<<-]>>[<<+>>-]>[[-]>>>>>>>>>>>>>>>>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++>>++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++>>+++++++++++++++++++++++++++++++++++++++++++++++++++++++++<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,>[-]<[<+>>>>>>>>>>+>>>>>+<<<<<<<<<<<<<<-]<[>+<-]>>>>>>>>>>>>>>>[[>>]+[<<]>>-]+[>>]<[<[<<]>+<<<<<<<<<<<<+>>>>>>>>>>>>>[>>]<-]<[<<]>[>[>>]<+<[<<]>-]>[>>]<<[-<<]><<<<<<<<<<<<.<<<]<<<[>>+>+<<<-]>>[<<+>>-]>[[-]<<<[-]>[-]>>]<<]

Try it online!

C (tcc), 145 bytes
Naive solution

int main(void) {
	putchar("3217411852982168523854859970943522338543662062483734873123759256062284894717957712649730999336795919"[getchar()]);
}

Try it online!

130 bytes


text:
Construct a tournament bracket
Given an input list of non-empty strings, output an ASCII art representation of a tournament, based on the following drawing rules:

The number of strings is guaranteed to be of quantity 2,4,8,16,etc.
The first two strings play each other, and the next two play each other, and so on. This is the first round.
For each game, choose the winner randomly with equal probability.
For the next round, the winner of the first game plays the winner of the second game, the winner of the third game plays the winner of the fourth game, and so on. Subsequent rounds follow the pattern.
There is eventually one overall winner.
For pretty output (required) the strings must all be prepended and appended with an underscore _.
In order for the brackets to line up appropriately, each entry must be padded with _ to all be the same length for that round.
You can choose whether the padding is prepended or appended, so long as it's consistent.
Instead, you can choose to pre-pad all strings to be the same length, rather than on a per-round basis. Whichever is golfier for your code.

Further Rules

Leading or trailing newlines or whitespace are all optional, so long as the characters themselves line up correctly.
Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
If possible, please include a link to an online testing environment so other people can try out your code!
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

Examples
Example with cities ['Boston', 'New York', 'Charlotte', 'Atlanta', 'St. Paul', 'Chicago', 'Los Angeles', 'Phoenix']:
_Boston______
             \_New York____
_New York____/             \
                            \_New York_
_Charlotte___               /          \
             \_Charlotte___/            \
_Atlanta_____/                           \
                                          \_St. Paul_
_St. Paul____                             /
             \_St. Paul____              /
_Chicago_____/             \            /
                            \_St. Paul_/
_Los Angeles_               /
             \_Los Angeles_/
_Phoenix_____/

Example with ['Lions', 'Tigers', 'Bears', 'Oh My']:
_Lions__
        \_Tigers_
_Tigers_/        \
                  \_Tigers_
_Bears__          /
        \_Bears__/
_Oh My__/

Related.

Does the selection of the winner have to be Mersenne Twister random, or can it be pseudo-random?

@ZachGates So long as it's a 50-50 chance between the two "teams," whatever method you want to use is fine.

Charcoal, 92 79 bytes
Ａ¹θＷＳ⊞υ⪫__ιＷυ«Ａ⌈ＥυＬκεＡ⁺θθδＦυ«Ｐ×_εＰκＭδ↓»ＡＥ✂υ¹Ｌυ²⎇‽²κ§υ⁺λλυＭε→Ｆυ«Ｍδ↑↗θ←↖θ→»Ｍθ↘Ａδθ

Try it online! Link is to verbose version of code. Needs a blank line to mark the end of the input. Explanation:
Ａ¹θ

Initialise the variable q. This holds the size of the zig-zags i.e. half the gap between rows.
ＷＳ⊞υ⪫__ι

Read nonblank input lines into the array u. The lines are automatically surrounded by _s as they are read in, although they are not padded yet.
Ｗυ«

Loop while there are still strings left.
Ａ⌈ＥυＬκε

Calculate the width of the largest string in e.
Ａ⁺θθδ

Calculate the gap between rows in d.
Ｆυ«Ｐ×_εＰκＭδ↓»

For each team, print the padding, print the team, and then move down to the next team.
ＡＥ✂υ¹Ｌυ²⎇‽²κ§υ⁺λλυ

For every other team, randomly pick between that team or the previous team. (Note that if there is only one team left then this produces an empty list.)
Ｍε→Ｆυ«Ｍδ↑↗θ←↖θ→»Ｍθ↘

If there are still teams left, draw the zigzags joining them in pairs.
Ａδθ

Double the length of the zigzags each time.

Do you think there would be any case in which a list input operator would be adcantageous?

@ASCII-only Well, I could have used it for the ASCII Venn Diagram question...

:| do you think it's worth implementing?

@ASCII-only I think you can do ▷vＳ or something for that anyways.

Python 2, 379 364 bytes
exec r"""c=input();from random import*;R,L,d=range,len,0;u,s="_ ";r=[[""]*-~L(c)@R(2*L(c)-1)]
while c:
 W=2+max(map(L,c));j=1<<d;J=j/2;D=d+d;d+=1
 @r:l[D]=s*W;l[D-1]=s*J
 @R(L(c)):
	h=l*2*j+j-1;r[h][D]=(u+c[l]+u*W)[:W]
	@R(h-J,h+J):r[-~l][~-D]=("/\\"[l<h]+s*abs(h-l-(l<h))).rjust(J)
 c=[choice(l)@zip(c[::2],c[1::2])]
@r:print"".join(l)""".replace("@","for l in ")

Try it online!

You can replace your two-level indents with a singular tab and save three bytes.

365 bytes.

364 bytes.

source: Stack Exchange

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

sort: votes


text:
Disappearing Elements
Given a string S and a list of indices X, modify S by removing the element at each index of S while using that result as the new value of S.
For example, given S = 'codegolf' and X = [1, 4, 4, 0, 2],
0 1 2 3 4 5 6 7  |
c o d e g o l f  |  Remove 1
c d e g o l f    |  Remove 4
c d e g l f      |  Remove 4
c d e g f        |  Remove 0
d e g f          |  Remove 2
d e f

Your task is to perform this process, collect the values of S after each operation, and display each on a newline in order. The final answer would be
S = 'codegolf'
X = [1, 4, 4, 0, 2]

Answer:

codegolf
cdegolf
cdeglf
cdegf
degf
def

This is code-golf so make your code as short as possible.
You may assume that the values in X are always valid indices for S, and you may use either 0-based or 1-based indexing.
The string will only contain [A-Za-z0-9]
Either S or x may by empty. If S is empty, it follows that x must also be empty.
You may also take S as a list of characters instead of a string.
You may either print the output or return a list of strings. Leading and trailing whitespace is acceptable. Any form of output is fine as long as it is easily readable.

Test Cases
S = 'abc', x = [0]
'abc'
'bc'

S = 'abc', x = []
'abc'

S = 'abc', x = [2, 0, 0]
'abc'
'ab'
'b'
''

S = '', x = []
''

S = 'codegolfing', x = [10, 9, 8, 3, 2, 1, 0]
'codegolfing'
'codegolfin'
'codegolfi'
'codegolf'
'codgolf'
'cogolf'
'cgolf'
'golf'

May we take S as a list of characters?

@Mr.Xcoder Sure, I'll add that in the spec.

May we print as a list of characters?

Can we skip the first item (the original string) in the output?

@ETHproductions No, the output should be the original string first, and then each string that results from deleting a character. So the output should contain len(x)+1 strings.

Can we, as Erik asked, output arrays/lists of individual characters?

Yes, using list of characters instead of strings for input and output is fine.

Will there be strings with indices > 9? (IE double digits)

@nmjcman101 Yes, I'll add an test case for that.

If all results are printed, may the program then exit with an error?

Third test case, should it not be: S = 'abc', x = [2, 0, 0] remove c to leave ab then remove a to leave b then remove b to leave empty string?

@streetster You're right, I made a typo.

I feel I might be really pushing it here, which is why I figured it best to ask first: would outputting one, single, comma-separated string be allowed? e.g., for your example, "c,o,d,e,g,o,l,f,c,d,e,g,o,l,f,c,d,e,g,l,f,c,d,e,g,f,d,e,g,f,d,e,f"

@Shaggy I don't think it is readable, for example if the input was 'aaaa' and [0,0,0,0], your output would be a,a,a,a,a,a,a,a,a,a,''

JavaScript (ES6), 57 50 48 45 42 bytes
Takes the string as an array of individual characters, outputs an array containing a comma separated string of the original followed by a subarray of comma separated strings for each step.
s=>a=>[s+"",a.map(x=>s.splice(x,1)&&s+"")]

3 bytes saved thanks to Arnauld
suggesting I abuse the loose output spec more than I already was, which led me to abusing it even more for another 3 byte saving.

Test it

o.innerText=JSON.stringify((f=

s=>a=>[s+"",a.map(x=>s.splice(x,1)&&s+"")]

)([...i.value="codegolf"])(j.value=[1,4,4,0,2]));oninput=_=>o.innerText=JSON.stringify(f([...i.value])(j.value.split`,`))
label,input{font-family:sans-serif;font-size:14px;height:20px;line-height:20px;vertical-align:middle}input{margin:0 5px 0 0;width:100px;}
<label for=i>String: </label><input id=i><label for=j>Indices: </label><input id=j><pre id=o>

Explanation
We take the two inputs via parameters s (the string array) and a (the integer array) in currying syntax, meaning we call the function with f(s)(a).
We build a new array and start it off with the original s. However, as the splice method we'll be using later on modifies an array, we need to make a copy of it, which we can do by converting it to a string (simply append an empty string).
To generate the subarray, we map over the integer array a (where x is the current integer) and, for each element, we splice 1 element from s, beginning at index x. We return the modified s, again making a copy of it by converting it to a string.

Because any form of output is fine as long as it is easily readable, I suppose that one should also be acceptable: s=>a=>[s+'',...a.map(x=>s.splice(x,1)&&s+'')]

Nice one, @Arnuald - I wouldn't have thought to push it that far, even given that spec.

Haskell, 38 33 bytes
s#i=take i s++drop(i+1)s
scanl(#)

Straight forward: repeatedly take the elements before and after index i, rejoin them and collect the results.
Try it online!
Edit: @Lynn saved 5 bytes. Thanks!

s#i=take i s++drop(i+1)s is actually shorter, saving 5 bytes.

Nope, you’re at 33 now — don’t forget that the TIO snippet has q= in there ^^;

Yep, you're right.

Python 2, 43 bytes
s,i=input()
for i in i+[0]:print s;s.pop(i)

Try it online!

Any form of output is fine as long as it is easily readable.

So this prints as lists of chars.

Nice, but why did you choose the notation abuse for i in i+[0]?

@Mr.Xcoder Because that way the last line is shown. (and the reason I posted separately in first place)

No, not +[0], I am talking about for i in i. for k in i is equivalent.

@Mr.Xcoder Because I like it that way...

Ok, just curious... Maybe it was a trick I didn't know of :)

The spec for the output is very loose so you should be OK submitting the 43 byte version. The output format is similar to my solution's.

Japt, 6 bytes
åjV uV

Test it online!
Explanation
UåjV uV   Implicit: U = array of integers, V = string
Uå        Cumulatively reduce U by
  j         removing the item at that index in the previous value,
   V        with an initial value of V.
     uV   Push V to the beginning of the result.

Alternatively:
uQ åjV

UuQ       Push a quotation mark to the beginning of U.
    å     Cumulatively reduce by
     j      removing the item at that index in the previous value,
      V     with an initial value of V.

This works because removing the item at index " does nothing and so returns the original string.

Husk, 7 bytes
G§+oh↑↓

Takes first the string, then (1-based) indices.
Try it online!
Explanation
G§+oh↑↓
G        Scan from left by function:
           Arguments are string, say s = "abcde", and index, say i = 3.
      ↓    Drop i elements: "de"
     ↑     Take i elements
   oh      and drop the last one: "ab"
 §+        Concatenate: "abde"
         Implicitly print list of strings on separate lines.

How do I use an empty list of indices x?

@miles You have to specify the type, like this.

I see, thanks. I'm not very familiar with either Haskell or Husk.

Python 2, 47 bytes
This could be shortened to 43 bytes, as @LuisMendo pointed out, but that's already @ErktheOutgolfer's solution.
a,b=input();print a
for i in b:a.pop(i);print a

Try it online!

\a`[2::5]instead''.join(a)`

@Rod How does than work?

repr and string spliting, works good to turn a list of characters into a string, \a`[1::3]` can also be used with a list of digits

@Rod I know what they are, I don't understand how ::5 works here :P

@Mr.Xcoder well then study string slicing ;) basically it takes every 5th char starting from the 2nd

It will get every 5th character, starting from the 3rd, the list repr will be ['a', 'b', 'c'] (note the space next to the comma), so it will be the characters

4 bytes off getting rid of the repeated print

@LuisMendo Thanks, but unfortunately that's Erik's solution :P - Will mention though

Java 8, 78 bytes
This is a curried lambda, from int[] to a consumer of StringBuilder or StringBuffer. Output is printed to standard out.
l->s->{System.out.println(s);for(int i:l)System.out.println(s.delete(i,i+1));}

Try It Online

Your second answer is a valid entry. Nothing forbids you to carefully select your input type as long as it makes sense. I've several times already taken even Streams as input and got very nice answers. Actually, nearly all golfing languages use streams equivalent internally. So by selecting your input, you just level a tad. +1 nonetheless

Maybe you're right. I think I tend to be more conservative than most about these things. I'll switch to the second solution.

05AB1E, 11 bytes
v=ā0m0yǝÏ},

Try it online!
v           # For each index:
 =          #   Print without popping
  ā         #   Push range(1, len(a) + 1)
   0m       #   Raise each to the power of 0.
            #   This gives a list of equal length containing all 1s
     0yǝ    #   Put a 0 at the location that we want to remove
        Ï   #   Keep only the characters that correspond to a 1 in the new list
         }, # Print the last step

The first line isn't there. Oh, and not sure if you can print like that.

@EriktheOutgolfer Any form of output is fine as long as it is easily readable

I can save some bytes then...

Mathematica, 70 bytes
(s=#;For[t=1,t<=Length@#2,Print@s;s=StringDrop[s,{#2[[t]]+1}];t++];s)&

Try it online!

R, 46 32 bytes
function(S,X)Reduce(`[`,-X,S,,T)

Try it online!
Takes input as a list of characters and X is 1-based. Reduce is the R equivalent of fold, the function in this case is [ which is subset. Iterates over -X because negative indexing in R removes the element, and init is set to S, with accum=TRUE so we accumulate the intermediate results.
R, 80 bytes
function(S,X,g=substring)Reduce(function(s,i)paste0(g(s,0,i-1),g(s,i+1)),X,S,,T)

2-argument function, takes X 1-indexed. Takes S as a string.
Try it online!

Very smart to use Reduce here. Well done!

q/kdb+, 27 10 bytes
Solution:
{x _\0N,y}

Examples:
q){x _\0N,y}["codegolf";1 4 4 0 2]
"codegolf"
"cdegolf"
"cdeglf"
"cdegf"
"degf"
"def"
q){x _\0N,y}["abc";0]
"abc"
"bc"
q){x _\0N,y}["abc";()]
"abc"
q){x _\0N,y}["abc";2 0 0]
"abc"
"ab"
,"b"
""
q){x _\0N,y}["";()]
""

Explanation:
Takes advantage of the converge functionality \ as well as drop _.
{x _\0N,y}
{        } / lambda function, x and y are implicit variables
     0N,y  / join null to the front of list (y), drop null does nothing
   _\      / drop over (until result converges) printing each stage
 x         / the string (need the space as x_ could be a variable name)

Notes:
If we didn't need to print the original result, this would be 2 bytes in q:
q)_\["codegolfing";10 9 8 3 2 1 0]
"codegolfin"
"codegolfi"
"codegolf"
"codgolf"
"cogolf"
"cgolf"
"golf"

PowerShell, 94 84 bytes
param($s,$x)$a=[Collections.Generic.list[char]]$s;$x|%{-join$a;,$a|% r*t $_};-join$a

Try it online!
Takes input $s as a string and $x as an explicit array. We then create $a based on $s as a list.
Arrays in PowerShell are fixed size (for our purposes here), so we need to use the lengthy [System.Collections.Generic.list] type in order to get access to the .removeAt() function, which does exactly what it says on the tin.
I sacrificed 10 bytes to include two -join statements to make the output pretty. OP has stated that outputting a list of chars is fine, so I could output just $a rather than -join$a, but that's really ugly in my opinion.
Saved 10 bytes thanks to briantist.

You can leave off System and just use [Collections.Generic.list[char]]. To keep it pretty without sacrificing bytes, you  can put the last -join$a in the footer in TIO.

I think you can also save 3 bytes by changing $a.removeat($_) to ,$a|% r*t $_.

@briantist Thanks for those - I always forget to remove System from the class name. Sadly the last -join$a is necessary for the code, so I can't move it to the footer.

Haskell, 33 bytes
scanl(\s i->take i s++drop(i+1)s)

Try it online!

05AB1E, 9 7 bytes
=svõyǝ=

Try it online!

=s        # Print original string, swap with indices.
  v       # Loop through indices...
   õyǝ    # Replace current index with empty string.

-2 thanks to idea from @ETHProductions.

This doesn't print anything if x is empty.

@Riley fixed. (#ETHProductions fixed.)

Couldn't you just do =sv""yǝ= or something similar instead of replacing with a newline and then removing the newline?

@ETHproductions õ also works :)

Well I don't know 05AB1E, haha

@ETHproductions now you do :P

Why is there a second = in your code but not your explanation?

@isaacg typo. '= # print char'.

Python 2, 50 bytes

Takes in string and list of indices

s,i=input()
for j in i+[0]:print s;s=s[:j]+s[j+1:]

Try it online!

C (gcc), 99 bytes
j;f(s,a,i)char*s;int*a;{puts(s);for(j=0;j<i;j++){memmove(s+a[j],s+a[j]+1,strlen(s)-a[j]);puts(s);}}

Try it online!
Takes the string, array, and the length of the array.

91 bytes

MATL, 8 bytes
ii"t[]@(

Indexing is 1-based.
Try it online! Or verify the test cases.
Explanation
i      % Input string. Input has to be done explicitly so that the string
       % will be displayed even if the row vector of indices is empty
i      % Input row vector of indices
"      % For each
  t    %   Duplicate current string
  []   %   Push empty array
  @    %   Push current index
  (    %   Assignment indexing: write [] to string at specified index
       % End (implicit). Display stack (implicit)

Retina, 58 bytes
¶\d+
¶¶1$&$*
+1`(?=.*¶¶.(.)*)(((?<-1>.)*).(.*)¶)¶.*
$2$3$4

Try it online! Explanation:
¶\d+

Match the indices (which are never on the first line, so are always preceded by a newline).
¶¶1$&$*

Double-space the indices, convert to unary, and add 1 (because zeros are hard in Retina).
+1`

Repeatedly change the first match, which is always the current value of the string.
   (?=.*¶¶.(.)*)

Retrieve the next index in $#1.
                (           .    ¶)

Capture the string, including the $#1th character and one newline.
                 ((?<-1>.)*) (.*)

Separately capture the prefix and suffix of the $#1th character of the string.
                                   ¶.*

Match the index.
$2$3$4

Replace the string with itself and the index with the prefix and suffix of the $#1th character.

C# (.NET Core), 87 87 74 70 bytes
S=>I=>{for(int i=0;;S=S.Remove(I[i++],1))System.Console.WriteLine(S);}

Try it online!
Just goes to show that recursion isn't always the best solution. This is actually shorter than my original invalid answer. Still prints to STDOUT rather than returning, which is necessary because it ends with an error.
-4 bytes thanks to TheLethalCoder

Per a recent meta consensus (that I can't find) recursive lambdas in C# are disallowed unless you specify what they compile to in the byte count. Therefore, a full method is shorter in this case. I am downvoting until this is fixed, let me know when.

@TheLethalCoder I may not agree with the consensus, but it does seem to be consensus. I've updated my answer.

70 bytes. Use currying and move one statement into the loop to stop needing the loop braces.

@TheLethalCoder Ah, so THAT's how you use currying in C#! I knew it was shorter for exactly two arguments, but it always ended up complaining about some part of my syntax. Thanks for the improvements

No worries and yeah the first one must always be a Func that returns the other Func, Action, Predicate,...

Pyth, 8 bytes
.u.DNYEz

Demonstration
Reduce, starting with the string and iterating over the list of indices, on the deletion function.

PowerShell, 54 58 bytes
param($s,$x),-1+$x|%{$z=$_;$i=0;-join($s=$s|?{$z-ne$i++})}

Try it online!
Explanation
Takes input as a char array ([char[]]).
Iterates through the array of indices ($x) plus an injected first element of -1, then for each one, assigns the current element to $z, initializes $i to 0, then iterates through the array of characters ($s), returning a new array of only the characters whose index ($i) does not equal (-ne) the current index to exclude ($z). This new array is assigned back to $s, while simultaneously being returned (this happens when the assignment is done in parentheses). That returned result is -joined to form a string which is sent out to the pipeline.
Injecting -1 at the beginning ensures that the original string will be printed, since it's the first element and an index will never match -1.

Very clever way of pulling out the appropriate indices.

Perl 5, 55 bytes (54 + "-l")
sub{print($s=shift);for(@_){substr$s,$_,1,"";print$s}}

Try it online!

Nice! I came up with a very similar approach, but as a full program (using -pa) for 44 bytes: $_=<>;substr$_,shift@F,print,""while@F&&$_

Nice! Not sure you need the final &&$_ since you can assume the input is valid (the list of indices can't be longer than the string). Using the return value of print as the number of characters is quite slick.

Ah, that's true! I didn't notice that part of the spec! I thought my answer was far too similar to yours to post separately though!

J, 23 bytes
>@({&.>/\.&.|.@;<^:4"0)

Try it online!

Brilliant use of negative boxing.

Vyxal o, 4 bytes
(…n⟇

Try it Online!
Prints lists of chars
(…n⟇ # 'o' flag forces output of the last value
(    # For every number in the list...
 …   # Print the string without popping
  n  # Get the current value
   ⟇ # Remove the char at the index
     # The result is printed on next iteration

Pyth, 10 bytes
Rule changes saved me 1 byte:
V+E0Q .(QN

Try it online!
Pyth, 11 bytes
V+E0sQ .(QN

Try it online!

@miles isn't stderr output allowed by default?

@Mr.Xcoder I thought stderr output was ignored in that case...

@miles I will remove mine and flag it to a mod if we do not remove them. Thanks!

Python 2, 54
X,S=input()
for a in X:
    print S
    S=S[:a]+S[a+1:]
print S

Try It Online

I only see the last string in the output.

I messed up... One moment...

V, 12 bytes
òdt,GÙ@-|xHx

Try it online!
This is 1-indexed, input is like:
11,10,9,4,3,2,1,
codegolfing

Explanation
ò              ' <M-r>ecursively until error
 dt,           ' (d)elete (t)o the next , (errors when no more commas)
    G          ' (G)oto the last line
     Ù         ' Duplicate it down
        |      ' Goto column ...
      @-       ' (deleted number from the short register)
         x     ' And delete the character there
          H    ' Go back home
           x   ' And delete the comma that I missed

How do I use an empty list of indices x?

@miles By adding a few bytes :).  Simply an empty first line will now work.  Would you be OK if I took lists with a trailing comma?  IE 1,2,3,.  Empty list would be nothing, Singleton would be 1,

Sure, you can use that input format.

Gaia, 9 bytes
+⟪Seḥ+⟫⊣ṣ

I should really add a "delete at index" function...
Try it online!
Explanation
+          Add the string to the list
 ⟪Seḥ+⟫⊣   Cumulatively reduce by this block:
  S         Split around index n
   e        Dump the list
    ḥ       Remove the first char of the second part
     +      Concatenate back together
        ṣ  Join the result with newlines

Swift 3, 80 bytes
func f(l:[String],c:[Int]){var t=l;for i in c{print(t);t.remove(at:i)};print(t)}

Try it online!

Pyth, 8 bytes
+zm=z.Dz

Test suite!
explanation
+zm=z.DzdQ    # implicit: input and iteration variable
  m      Q    # for each of the elements of the first input (the array of numbers, Q)
     .Dzd     # remove that index from the second input (the string, z)
   =z         # Store that new value in z
+z            # prepend the starting value

APL, 31 30 28 bytes
{⎕←⍺⋄⍵≡⍬:⍬⋄⍺[(⍳⍴⍺)~⊃⍵]∇1↓⍵}

Try it online!

C++ (gcc), 70 65 bytes
As generic unnamed lambda, requiring s to be like std::string but x can be any iterable container of int, even an array. Returns via reference parameter into the input string.
[](auto&s,auto&x){auto t=s;for(int i:x)t+="\n"+s.erase(i,1);s=t;}

no trailing newline: -5 byte
previous 70 byte solution
[](auto&s,auto&x){auto t=s+'\n';for(int i:x)t+=s.erase(i,1)+'\n';s=t;}

Try it online!
The result is a single newline-seperated string.

C# (Mono), 85 bytes
s=>a=>{for(int i=-2;++i<a.Count;)System.Console.WriteLine(s=i<0?s:s.Remove(a[i],1));}

Try it online!

Factor, 36 bytes
[ [ swap dup . remove-nth ] each . ]

Try it online!

Ruby, 40 bytes
F=->s,(a,*b){a&&(s[a]=""
puts s
F[s,b])}

Attempt This Online!

><>, 32 bytes
X is takes as 1-indexed charcodes.
l:?!v1-{:o$!
ob0.>~ri:0(?;[{~]ra

Try it online!

R (+pryr), 45 bytes
Different (and longer) solution than @Guiseppe's.
f=pryr::f(`if`(sum(x|1),f(s[-x[1]],x[-1]),s))

which evaluates to the function:
function (s, x)
if (sum(x | 1)) f(s[-x[1]], x[-1]) else s

Takes input as a list of characters and a list of 1-indexed indices. As long as x is not empty, recursively calls f with the first element from x removed, as well as its corresponding value in s.

Tampio, 173 bytes
l miinus tyhjyys on l
l miinus a on l lisättynä l:ään avattuna a:lla
l avattuna a:lla lisättynä b:hen on l katkaistuna a:sta plus l jatkettuna a:n seuraajasta miinus b

Explanation:
l miinus tyhjyys on l
l -      []      =  l

l miinus a on l lisättynä l:ään avattuna a:lla
l -      a =  l :        (l     `avattu` a)

l avattuna  a:lla lisättynä b:hen on
l `avattu` (a     :         b)    =

  l katkaistuna a:sta plus l jatkettuna  a:n seuraajasta miinus b
((l `katkaistu` a)    ++  (l `jatkettu` (a   +1)     ) ) -      b

katkaistu and jatkettu are equivalent to take and drop of Haskell, respectively.

Röda, 29 bytes
f l{[l[:]];[l[:]]if del l[_]}

Try it online!

Go, 69 bytes
func f(S string,X[]int){for _,i:=range X{S=S[:i]+S[i+1:];println(S)}}

Attempt This Online!
Prints to STDERR.

Thunno 2, 4 bytes
£{Ɗß

Try it online!
Explanation
£{Ɗß  # Implicit input
£     # Print the first input
 {    # For each number in the second input:
  Ɗ   #   Drop the item at that index in the
      #   top of stack (initially first input)
   ß  #   Print this new string without popping
      #   (so we leave it for the next iteration)

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:
Sort a difference list
The difference list of a list of integers is the list differences of consecutive members.
For example the difference list of
1, 3, 2 ,4

is
2, -1, 2

Your task is to take as input a difference list and output what the difference list would look like if the original list were sorted.
For example the difference list
2, 1, -2, -1

Might represent a list
2 4 5 3 2

Which when sorted is
2 2 3 4 5

Which has a difference list of
0 1 1 1

This is code-golf so answers will be scored in bytes with less bytes being better.

Are solutions guaranteed to be unique?

@H.PWiz Yes they are.

Related.

@H.PWiz Quick proof: a list is perfectly reconstructable from a difference list (DL) combined with a first element value, so there's a one-to-one conversion from L to (FV, DL). Increasing the FV by any amount is the same as adding that amount to every element of the L and therefore it cannot change the sorting of L if that comparison is suitably monotonic. (In other words, it doesn't affect sorting unless the number you're adding causes integer overflow).

Could you add a few more test cases? I notice some solutions giving differing outputs for [-2, 100, -2, -1], for example.

Does the output have to a list/array? Or can it just be a print of the difference values?

@Goysa Any output that has the correct values in the right order is fine.

05AB1E, 4 bytes
.¥{¥

Try it online!
Explanation
.¥{¥
.¥   # Undelta the input list
  {  # Sort it
   ¥ # And get the deltas

Undelta 05AB1E has the most niche built-ins. o0

Ahh crap, beat me to it. I've always wanted to use undelta.

Undelta ಠ___ಠ

"Undelta" is simply cumulative sum, right?

@Zgarb Undelta is adding a 0 as the first element of the list, then exactly as you've said, cumulative sum or reverse delta.

Python 3 with Numpy, 56 54 53 bytes
2 bytes off thanks to @Artyer (Numpy's sort instead of standard sorted). 1 byte off thanks to @notjagan (moving 0 into cumsum)
lambda x:diff(sort(cumsum([0]+x)))
from numpy import*

The code defines an anonymous function that inputs a list or a Numpy array and outputs a Numpy array.
Try it online!

Woah, you taught me something new today. My approach with numpy was much longer. I'll come back tomorrow to upvote this, because I see you capped already. Very nice!

@Mr.Xcoder Thanks! I'm no expert in Numpy, I just followed what I'd have done in Matlab: diff(sort([0 cumsum(x)])) (in Matlab,[ ] is concatenation)

Duty fulfilled!

-1 byte by moving the 0 into the cumsum.

Mathematica, 40 bytes
Differences@Sort@Accumulate@Join[{1},#]&

Differences@Sort@FoldList[+##&,1,#]&

JavaScript (ES6), 57 56 bytes
Saved 1 byte thanks to @ETHproductions
a=>a.map(n=>t-=n,p=t=0).sort((a,b)=>b-a).map(n=>p-(p=n))

Demo

let f =

a=>a.map(n=>t-=n,p=t=0).sort((a,b)=>b-a).map(n=>p-(p=n))

console.log(JSON.stringify(f([2, 1, -2, -1])))

.sort((a,b)=>a-b) That's the way to get deltas? By sorting with subtraction? :P

@totallyhuman The first map() gives the deltas. This code sorts them. The 2nd map rebuild the new deltas. The JS sort() method uses lexicographical order by default. So, we need this specialized callback for numbers > 9 (sadly).

That -p+(p=n) grinds my gears, but sadly there's no better way... unless...

what the heck, I didn't press the submit button >_< But anyway, I think you can save a byte with that edit...

@ETHproductions Thanks :-)

49 bytes? Or am I missing something?

@ThePirateBay A bare .sort sorts it lexicographically. E.g. [100, 10, 1, 200, 20, 2].sort() == [1, 10, 100, 2, 20, 200]

Jelly, 6 bytes
0;+\ṢI

Try it online!

Husk, 4 bytes
Ẋ-O∫

Try it online!
Explaination
      -- implicit input, e.g                               [2,1,-2,-1]
   ∫  -- cumulative sum                                    [0,2,3,1,0]
  O   -- sort                                              [0,0,1,2,3]
Ẋ     -- apply function to all adjacent pairs in the list  [(0,0),(0,1),(1,2),(2,3)]
 -    --   subtract                                        [0,1,1,1]

Another language that has undelta? Or some fancier built-in?

@Mr. Xcoder It happens that cumsum is the same as undelta

@H.PWiz Actually that's not what we call cumsum...unless you take the empty prefix into account.

@EriktheOutgolfer Yes, that is what husk does, as it is scanl(+)0 in Haskell.

Pyth, 9 bytes
-1 byte thanks to @EriktheOutgolfer.
.+S+0sM._

Test Suite.
Pyth, 10 bytes
.+S.u+YNQ0

Try it online! or Try more test cases.

As in my (deleted) answer, you can use +0sM._ instead of .u+YNQ0 for -1.

@EriktheOutgolfer Why did you delete it?

Thought the core idea was too similar to yours.

@EriktheOutgolfer Ok, thanks then

m=+Z is a same length variant for sM._, but sadly it doesn't seem like it can be any shorter.

@FryAmTheEggman I sought that opportunity before too, but it ends up being identical in length.

Java 8, 123 bytes
The standard solution: cumulative sum input, sort, then diff. No substantial implementation tricks either.
l->{int s=l.length,d[]=new int[s+1],i=0;while(i<s)d[i+1]=d[i]+l[i++];for(java.util.Arrays.sort(d);i-->0;)l[i]=d[i+1]-d[i];}

Cast to Consumer<int[]>. Output is mutated input.
Try It Online
Ungolfed lambda
l -> {
    int
        s = l.length,
        d[] = new int[s + 1],
        i = 0
    ;
    while (i < s)
        d[i + 1] = d[i] + l[i++];
    for (java.util.Arrays.sort(d); i-- > 0; )
        l[i] = d[i + 1] - d[i];
}

Acknowledgments

-3 bytes thanks to Olivier Grégoire, master of unholy autoincrementation
-1 byte thanks to Nevay

You can golf 3 bytes by rearranging the positions where you do your increments and your overall computations: l->{int s=l.length,d[]=new int[s+1],i=0;for(;i<s;)d[i+1]=d[i]+l[i++];java.util.Arrays.sort(d);for(i=0;i<s;)l[i]=-d[i]+d[++i];} (beware SE's invisible characters when copy/pasting)

Thanks for my new title ;) Here's more decrement unholiness to celebrate for(;i>0;)l[i-1]=d[i]-d[--i]; (last loop)

I had just reworked that loop myself, arriving at for(;i-->0;)l[i]=d[i+1]-d[i]; of the same length. Update to come.

You can save 1 byte by using l->{int s=l.length,d[]=new int[s+1],i=0;while(i<s)d[i+1]=d[i]+l[i++];for(java.util.Arrays.sort(d);i-->0;l[i]=d[i+1]-d[i]);}.

Ah yes, of course. Thanks!

R, 31 32 bytes
-4 bytes thanks to @user2390246 for diffinv
+5 bytes from Jarko for cat
cat(diff(sort(diffinv(scan()))))

Reads from stdin, writes to stdout. diffinv is an inverse of diff for a given starting value (0 by default). Since it's diffed again, it doesn't matter what that value is.
As pointed out by Jarko Dubbeldam, I needed to properly output the result, at the cost of five bytes. Alas.
Try it online!

That's what I had in mind as well. Does need to handle printing though, as  running this as a full program (through source) this doesn't output anything.

If you use diffinv rather than cumsum you don't need to prepend zero.

@user2390246 wow, very nice! TIL about diffinv.

Me too! I was just having a quick search to see if there were any previous answers I could have applied it to.

Brachylog, 15 bytes
a₀ᶠ+ᵐ,0o{s₂↔-}ᶠ

Try it online!

Perl 6, 46 bytes
{[\+](0,|@_).sort.rotor(2=>-1).flat.map(*R-*)}

Try it
Expanded:
{  # bare block lambda with implicit signature :(*@_)

  [\+](         # triangle reduce using &infix:«+»
    0,          # start with 0
    |@_         # Slip in the arguments from the outer block
  )             #                  (0, 2, 3, 1, 0)

  .sort         # sort the results (0,0,1,2,3)
  .rotor(2=>-1) # group in twos    ((0,0),(0,1),(1,2),(2,3))
  .flat         # flatten          (0,0,0,1,1,2,2,3)
  .map(*R-*)    # grab 2 values at a time, and subtract first from second
                # (0, 1, 1, 1)
}

Python 2, 83 bytes
l,r=input(),[1]
for i in l:r+=[r[-1]+i]
r.sort()
print[b-a for a,b in zip(r,r[1:])]

Try it online!
Horrible solution.

It's not that terrible, in fact

Python's += operator on lists works with any iterable, so you can use r+=r[-1]+i, instead of r+=[r[-1]+i] and save one byte.

VB.NET (.NET 4.5), 109 bytes
Sub A(n)
Dim c=n.count-1
For i=1To c
n(i)+=n(i-1)
Next
n.Sort()
For i=c To 1 Step-1
n(i)-=n(i-1)
Next
End Sub

A function that expects a list as input and modifies it directly. The original parameter can then be used for output

Recreates an original list by adding forwards through the list (assumes an implicit 0 as the first element)
Sorts the original list
Gets the differences by going backwards (so I don't need to keep track of a different list) (the implicit first element of 0 means the first difference is the same as the smallest element)

Try it online!

Would you mind updating the TIO link?

@TaylorScott Update in what way?

Your TIO link shows completely different code than in your answer

@TaylorScott Ahh....I see. I had to make some adjustments because TIO uses Mono, but I was using the .NET 4.5 compiler

Haskell, 74 bytes
import Data.List
g=sort.scanl(+)0
h l|k<-g l=map(\(x,y)->x-y)$zip(tail$k)k

Try it online!
Straightforward.

=<< from the function monad comes in handy:  (zipWith(-)=<<tail).sort.scanl(+)0

@nimi Very nice. I'm not expert in monads, but I should have thought of zipWith.

TI-Basic (TI-84 Plus CE), 23 bytes
Prompt X
augment({0},cumSum(LX→X
SortA(LX
ΔList(LX

Prompts for user input. The list must be input with a leading {, with numbers separated by ,, and with an optional trailing }.
TI-Basic is a tokenized language; ΔList( and cumSum( are two-byte tokens, all other tokens used are one byte each.
Example run (with NAME as the program name and {4,-2,7,-4,0} as the input):
prgmNAME
X=?{4,-2,7,-4,0}
               {2 2 1 0 4}

Explanation:
Prompt X                  # 3 bytes, get list input, store in LX
augment({0},cumSum(LX→X   # 12 bytes,
          # store the list ({0} prepended to the cumulative sum of LX) to LX
SortA(LX                  # 4 bytes, sort LX ascending
ΔList(LX                  # 4 bytes, implicitly print the difference list of LX

Do you need the L's?

@Zacharý you can omit them when storing a list, but omitting them when referencing would refer to the numerical variable X instead of the list

C++ (gcc), 136 bytes
As unnamed generic lambda, assuming input to be like std::list and returning via reference parameter.
[](auto&L){auto r=L.begin(),l=L.insert(r,0);while(r!=L.end())*r+++=*l++;for(L.sort(),l=r=--L.end();--l!=L.begin();*r---=*l);L.erase(l);}

Try it online!
Ungolfed:
[](auto&L){
 auto r=L.begin(),
      l=L.insert(r,0); //adds a zero right in front
 while(r!=L.end())
   *r++ += *l++;       //sum left to right
 for(
  L.sort(),            //sorting invalidates the iterators
  l=r=--L.end();       //so, reinit
  --l!=L.begin();      //decrement l beforehand
  *r-- -= *l           //diff right to left
 );
 L.erase(l);           //l==L.begin(), so this removes the temporary 0
}

Pyth, 8 bytes
.+S+M.uP

Demonstration
.+S+M.uP
.+S+M.uPNQ    Implicit variables
     .u  Q    Apply the following function to the input repeatedly until it
              stops changing, then output the list of values, including the
              starting value.
       PN     Remove the last element. No-op if the list is empty.
   +M         Sum each list. This gives the cumulative sums in reverse order,
              including a 0 at the end for the empty list.
  S           Sort
.+            Deltas

+1 This is a neat workaround with cumulative fixed point. I personally didn't even think of this.

TI-Basic, 20 bytes
cumSum(augment({0},Ans->L1
SortA(L1
ΔList(L1

Perl 5, 87 + 1 (-a) = 88 bytes
$a[0]=1;push@a,$a[-1]+$_ for@F;@a=sort{$a<=>$b}@a;print$a[0]-$_,$"while($_=shift@a)&&@a

Try it online!

APL (Dyalog), 15 14 bytes
-1 byte thanks to ngn.
(¯2-/⍋⊃¨⊂)0,+\

+\ cumulative sum
0, prepend a zero
(…) apply the following tacit function on that:
 ⊂ enclose (so we can pick multiple items)
 ⍋⊃¨ let each of the indices that would sort the argument pick from that
 ¯2-/ reversed pairwise difference
Try it online!

Original solution found by the Code Golf Hackathon participants at the Dyalog '17 User Meeting:
¯2-/l[⍋l←+\0,⎕]

Try it online!
⎕ prompt for input
0, prepend a zero
+\ cumulative sum
l← store as l
⍋ find the indices that will sort l
l[…] use that to index into l
¯2-/ reversed pairwise difference

I don't know if this was allowed at the hackathon but if you rewrite it in point-free style you could save a char: (¯2-/⍋⊃¨⊂)0,+\

@ngn This part of the workshop was attempting to get the participants started with PPCG, so the rules here were those of PPCG. Thanks.

J, 10 bytes
/:~&.(+/\)

explanation
"sort under scan sum": In J, the Under conjunction &. applies  the transformation to its right to the input, then applies the verb to its left (in this case sort /:~) and then does the reverse transformation.  That is, J understands how to invert a scan sum, which is exactly what's needed here: the successive differences are the input that, when scan-summed, will produce that scan-sum.
Try it online!

MATL, 6 bytes
0hYsSd

Try it online!
0       # push 0
 h      # horizontal concatenate with implicit input
  Ys    # cumulative sum
    S   # sort
     d  # diff (implicit output)

Vyxal, 6 bytes
ÞRs¯0p

Try it Online!

Gaia, 7 bytes
1¤++⊣ȯọ

Try it online!
Explanation
1¤+      Prepend 1
   +⊣    Cumulative sums
     ȯ   Sort
      ọ  Deltas

Japt, 10 bytes
iT å+ n än

Test it

Röda, 42 bytes
{i=0{[0];[i]if i+=_}|sort|slide 2|[_2-_1]}

Try it online!
This is similar to the Perl 6 answer. .sort is |sort, .rotor(2=>-1).flat is |slide 2  and .map(*R-*) is |[_2-_1].
Explanation:
{
  i=0 /* initialize variable i */
  /* the following block recreates the original list from differences: */
  {
    [0];       /* push 0 to the stream */
    [i]if i+=_ /* add every number in the stream to i and push i back */
  }|
  sort|    /* sort the numbers */
  slide 2| /* for values i1, i2, i3, ... in the stream
              push pairs i1, i2, i2, i3, ... */
  [_2-_1]  /* calculate difference of numbers in each pair in the stream */
}

The statement [i]if i+=_ is equivalent to
for sfv do
  if i += sfv do
    push(i)
  done
done

The += operator does not push values to the stream, so it is truthy. I could also have used some kind of block (eg. {|j|i+=j;[i]}_) to tie the addition and pushing statements together, but if is shorter.

Julia 0.6.0 (34 bytes)
Pretty much a copy of what has been done in R and Python 3
x->diff(sort(cumsum(vcat([0],x))))

k, 16 bytes
1_-':{x@<x}@+\0,

Try it online!
              0, /prepend a 0
            +\   /cumulative sum
     {x@<x}@     /sort
1_-':            /differences list

Factor, 45 bytes
[ 0 prefix cum-sum natural-sort differences ]

Try it online!
Add a 0 to the start of the input, cumulative sum, sort, differences.