text:
The number of ways a number is a sum of consecutive primes
Given an integer greater than 1, output the number of ways it can be expressed as the sum of one or more consecutive primes.
Order of summands doesn't matter. A sum can consist of a single number (so the output for any prime will be at least 1.)
This is code-golf. Standard rules apply.
See this OEIS wiki for related information and sequences, including the sequence itself OEIS A054845.
Test cases
2 => 1
3 => 1
4 => 0
5 => 2
6 => 0
7 => 1
8 => 1
10 => 1
36 => 2
41 => 3
42 => 1
43 => 1
44 => 0
311 => 5
1151 => 4
34421 => 6

Jelly,  6  5 bytes
-1 thanks to dylnan
ÆRẆ§ċ

A monadic link
Try it online! Or see the test-suite (note the final test case would time out at 60s at TIO).
How?
ÆRẆ§ċ - Link: integer, n
ÆR    - primes from 2 to n inclusive
  Ẇ   - all contiguous substrings
   §  - sum each
    ċ - count occurrences of n

2æR is same as ÆR

@dylnan nice one thanks!

R, 95 bytes
function(x,P=2){for(i in 2:x)P=c(P,i[all(i%%P)])
for(i in 1:x){F=F+sum(cumsum(P)==x)
P[i]=0}
F}

Try it online!

-24 bytes thanks to @Giuseppe who has basically revolutionized my solution supporting 34421 as well !

that's a clever way of coming up with primes up to x!

97 bytes

That golfing was so obvious... (facepalm)

We get 34421, and with a golf to boot! -- I had to turn off the warnings, though.

I'm going to have to acquire a new cannon from which to forge new special commendations for 34421.

@Giuseppe: that is great !! Today I'm sick and I would have never been able to think that... (maybe never ever :P) I'm feeling bad in using your code...I reverted to previous, if you post a new answer I'll upvote ;)

@ngm what's the significance of 34421..? And @digEmAll, I don't really mind; I really didn't have a clue about using cumsum and setting the first few elements to 0 to get the consecutive prime sums. The prime golf was just me trying to get the last test case working, and I just lucked out that it was shorter than outer! I have more than enough rep (at least until we get proper rep requirements), and I'm always happy to help more R golfers get more visibility!

@Giuseppe 34421 is the smallest number that is the sum of consecutive primes in exactly 6 ways (see http://oeis.org/A054859). Most solutions posted for this challenge run out of either time (on TIO) or memory for that test case. Although the Java answer even got the next integer in the sequence too (for 7) but not for 8.

@Giuseppe: ok then, thanks ! :)

05AB1E, 6 bytes
Code
ÅPŒOQO

Uses the 05AB1E encoding. Try it online!

Brachylog, 14 9 bytes
{⟦ṗˢs+?}ᶜ

Try it online!
Multiple test cases
(-5 whole bytes, thanks to @Kroppeb!)
Explanation:
{⟦ṗˢs+?}ᶜ
{      }ᶜ     Count the number of ways this predicate can succeed:
 ⟦            Range from 0 to input
  ṗˢ          Select only the prime numbers
    s         The list of prime numbers has a substring (contiguous subset)
     +        Whose sum
      ?       Is the input

You can golf it by calculating ⟦ṗˢ inside the ᶜ loop.
I got this {⟦ṗˢs+;?=}ᶜ
Test suite: Try it online!

Realized I can replace the ;?= by ? and get {⟦ṗˢs+?}ᶜ (9 bytes)

@Kroppeb Of course! That's a much more elegant answer too. Thank you.

JavaScript (ES6), 92 bytes
n=>(a=[],k=1,g=s=>k>n?0:!s+g(s>0?s-(p=d=>k%--d?p(d):d<2&&a.push(k)&&k)(++k):s+a.shift()))(n)

Try it online!
Commented
n => (                          // n = input
  a = [],                       // a[] = array holding the list of consecutive primes
  k = 1,                        // k = current number to test
  g = s =>                      // g = recursive function taking s = n - sum(a)
    k > n ?                     //   if k is greater than n:
      0                         //     stop recursion
    :                           //   else:
      !s +                      //     increment the final result if s = 0
      g(                        //     add the result of a recursive call to g():
        s > 0 ?                 //       if s is positive:
          s - (                 //         subtract from s the result of p():
            p = d => k % --d ?  //           p() = recursive helper function looking
              p(d)              //                 for the highest divisor d of k,
            :                   //                 starting with d = k - 1
              d < 2 &&          //           if d is less than 2 (i.e. k is prime):
              a.push(k) &&      //             append k to a[]
              k                 //             and return k (else: return false)
          )(++k)                //         increment k and call p(k)
        :                       //       else:
          s + a.shift()         //         remove the first entry from a[]
                                //         and add it to s
      )                         //     end of recursive call
  )(n)                          // initial call to g() with s = n

MATL, 15 12 bytes
EZqPYTRYsG=z

Try it on MATL Online
The initial E (multiply by 2) makes sure that, for prime input, the result of the later Ys (cumsum) does not have the input prime repeating itself in the zeroed part of the matrix (thus messing with the count).
Explanation:
                % Implicit input, say 5
E               % Double the input
 Zq             % Get list of primes upto (and including) that
                %  Stack: [2 3 5 7]
   P            % Reverse that list
    YT          % Toeplitz matrix of that
                %  Stack: [7 5 3 2
                           5 7 5 3
                           3 5 7 5
                           2 3 5 7]
      R         % `triu` - upper triangular portion of matrix
                %  Stack: [7 5 3 2
                           0 7 5 3
                           0 0 7 5
                           0 0 0 7]
       Ys       % Cumulative sum along each column
                %  Stack: [7  5  3  2
                           7 12  8  5
                           7 12 15 10
                           7 12 15 17]

         G=     % Compare against input - 1s where equal, 0s where not
           z    % Count the number of non-zeros

Toeplitz matrix of primes and triangular part, very nice!

MATL, 16 bytes
:"GZq@:g2&Y+G=vs

Try it at MATL Online!
Explanation
:"        % Input (implicit): n. For each k in [1 2 ... n]
  G       %   Push n
  Zq      %   Primes up to that
  @:g     %   Push vector of k ones
  2&Y+    %   Convolution, removing the edges
  G=      %   True for entries that equal n
  v       %   Concatenate vertically with previous results
  s       %   Sum
          % End (implicit). Display (implicit)

Husk, 9 8 bytes
-1 byte thanks to Mr.Xcoder (use named argument ¹ instead of S)!
#¹ṁ∫ṫ↑İp

Try it online!
Explanation
#¹ṁ∫ṫ↑İp  -- example input: 3
#¹        -- count the occurrences of 3 in
      İp  -- | primes: [2,3,5,7..]
     ↑    -- | take 3: [2,3,5]
    ṫ     -- | tails: [[2,3,5],[3,5],[5]]
  ṁ       -- | map and flatten
   ∫      -- | | cumulative sums
          -- | : [2,5,10,3,8,5]
          -- : 1

As a full program, #¹ṁ∫ṫ↑İp should save 1 byte.

Retina 0.8.2, 68 bytes
.+
$*_$&$*
_
$`__¶
A`^(__+)\1+$
m)&`^((_)|¶)+¶[_¶]*(?<-2>1)+$(?(2)1)

Try it online! Link includes faster test cases. Explanation:
m)

Run the whole script in multiline mode where ^ and $ match on every line.
.+
$*_$&$*

Convert to unary twice, first using _s, then using 1s.
_
$`__¶

Generate all the prefixes of the _s and add two to each, thus counting from \$2\$ to \$n + 1\$.
A`^(__+)\1+$

Delete all the composite numbers in the range.
&`^((_)|¶)+¶[_¶]*(?<-2>1)+$(?(2)1)

Match any number of _s and newlines (starting and ending at the end of a line) then compare the number of _s with the number of 1s. Count the number of sums of consecutive prime numbers which add up to \$n\$.

Clean, 100 98 bytes
import StdEnv,StdLib
$n=sum[1\\z<-inits[i\\i<-[2..n]|all(\j=i/j*j<i)[2..i-1]],s<-tails z|sum s==n]

Try it online!
Defines the function $ :: Int -> Int which works as explained below:
$ n                              // the function $ of n is
    = sum [                      // the sum of
        1                        // 1, for every
        \\ z <- inits [          // prefix z of
            i                    // i, for every
            \\ i <- [2..n]       // integer i between 2 and n
            | and [              // where every
                i/j*j < i        // j does not divide i
                \\ j <- [2..i-1] // for every j between 2 and i-1
            ]
        ]
        , s <- tails z           // ... and suffix s of the prefix z
        | sum s == n             // where the sum of the suffix is equal to n
    ]

(Explanation is for an older but logically identical version)

Special commendation for getting output for 34421.

Java 10, 195 194 184 182 bytes
n->{var L=new java.util.Stack();int i=1,k,x,s,r=0;for(;i++<n;){for(k=1;i%++k>0;);if(k==i)L.add(i);}for(x=L.size(),i=0;i<x;)for(k=i++,s=0;k<x;r+=s==n?1:0)s+=(int)L.get(k++);return r;}

-1 byte thanks to @ceilingcat.
-10 bytes thanks to @SaraJ.
Try it online.
Explanation:
n->{                // Method with integer as both parameter and return-type
  var L=new java.util.Stack();
                    //  List of primes, starting empty
  int i=1,k,x,s,    //  Temp integers
      r=0;          //  Result-counter, starting at 0
  for(;i++<n;){     //  Loop `i` in the range [2, `n`]
    for(k=1;        //   Set `k` to 1
        i%++k>0;);  //   Inner loop which increases `k` by 1 before every iteration,
                    //   and continues as long as `i` is not divisible by `k`
    if(k==i)        //   If `k` is now still the same as `i`; a.k.a. if `i` is a prime:
      L.add(i);}    //    Add the prime to the List
  for(x=L.size(),   //  Get the amount of primes in the List
      i=0;i<x;)     //  Loop `i` in the range [0, amount_of_primes)
    for(s=0,        //   (Re)set the sum to 0
        k=i++;k<x;  //   Inner loop `k` in the range [`i`, amount_of_primes)
        r+=s==n?    //     After every iteration, if the sum is equal to the input:
            1       //      Increase the result-counter by 1
           :        //     Else:
            0)      //      Leave the result-counter the same by adding 0
      s+=(int)L.get(k++);
                    //    Add the next prime (at index `k`) to the sum
  return r;}        //  And finally return the result-counter

It's basically similar as the Jelly or 05AB1E answers, just 190 bytes more.. XD
Here a comparison for each of the parts, added just for fun (and to see why Java is so verbose, and these golfing languages are so powerful):

Take the input: (Jelly: 0 bytes) implicitly; (05AB1E: 0 bytes) implicitly; (Java 10: 5 bytes) n->{}
Create a list of primes in the range [2, n]: (Jelly: 2 bytes) ÆR; (05AB1E: 2 bytes) ÅP; (Java 10: 95 bytes) var L=new java.util.Stack();int i=1,k,x,s,r=0;for(;i++<n;){for(k=1;i%++k>0;);if(k==i)L.add(i);}
Get all continuous sub-lists: (Jelly: 1 byte) Ẇ; (05AB1E: 1 byte) Œ; (Java 10: 55 bytes) for(x=L.size(),i=0;i<x;)for(k=i++;k<x;) and (int)L.get(k++);
Sum each sub-list: (Jelly: 1 byte) §; (05AB1E: 1 byte) O; (Java 10: 9 bytes) ,s and ,s=0 and s+=
Count those equal to the input: (Jelly: 1 byte) ċ; (05AB1E: 2 bytes) QO; (Java 10: 15 bytes) ,r=0 and r+=s==n?1:0
Output the result: (Jelly: 0 bytes) implicitly; (05AB1E: 0 bytes) implicitly; (Java 10: 9 bytes) return r;

Special commendation for getting output for 34421.

@ngm :) Java may be bad at many things, but performance-wise it's pretty good usually.

Even works on 218918. Times out with 3634531.

@ngm I'm actually surprised it's still fast enough to do the 218918 in 12.5 sec tbh, considering it will do 218918-2 = 218,916 iterations with inside an inner loop of: n iterations for every prime; 1 iteration for every even number; and somewhere between [2,p/2) iterations for every odd number (close to two billion iterations), after which it adds 19518 primes to the list in memory. And then it will loop an additional sum([0,19518]) = 190,485,921 times in the second nested loop.. 2,223,570,640 iterations in total to be exact.

@ceilingcat Thanks. Been able to golf 12 more bytes with @SaraJ's alternative prime check, minus the trailing %i since we're checking in the range [2, n], so I won't need to check i=1. :)

Japt, 17 bytes
There's gotta be a shorter way than this!
Craps out on the last test case.
õ fj x@ZãYÄ x@¶Xx

Try it or run all test cases

Explanation
                      :Implicit input of integer U
õ                     :Range [1,U]
  fj                  :Filter primes
      @               :Map each integer at 0-based index Y in array Z
         YÄ           :  Y+1
       Zã             :  Subsections of Z of that length
             @        :  Map each array X
               Xx     :    Reduce by addition
              ¶       :    Check for equality with U
            x         :  Reduce by addition
     x                :Reduce by addition

Python 2, 106 104 bytes
P=k=o=1
p=[]
i=input()
exec'o+=P%k*sum(p)==i;P*=k*k;k+=1;p+=P%k*[k];exec"p=p[i<sum(p):];"*k;'*i
print~-o

Try it online!

Perl 6, 53 bytes
{+grep $_,map {|[\+] $_},[\R,] grep *.is-prime,2..$_}

Try it online!
Uses the triangle reduction operator twice. The last test case is too slow for TIO.
Explanation
{                                                   } # Anonymous block
                               grep *.is-prime,2..$_  # List of primes up to n
                         [\R,]  # All sublists (2) (3 2) (5 3 2) (7 5 3 2) ...
          map {|[\+] $_},  # Partial sums for each, flattened
 +grep $_,  # Count number of occurrences

Physica, 41 bytes
->x:Count[Sum@Sublists[PrimeQ$$[…x]];x]

Try it online!
How it works
->x:Count[Sum@Sublists[PrimeQ$$[…x]];x] // Full program.
->x:            // Define an anonymous function with parameter x.
    […x]        // Range [0 ... x] (inclusive).
        $$      // Filter-keep those that...
  PrimeQ        // Are prime.
 Sublists[...]  // Get all their sublists.
Sum@            // Then sum each sublist.
Count[...;x]    // Count the number of times x occurs in the result.

Haskell, 89 bytes
g n=sum[1|a<-[0..n],_<-filter(n==).scanl1(+)$drop a[p|p<-[2..n],all((>0).mod p)[2..p-1]]]

Try it online!
Alternative, 89 bytes
f n=length$do a<-[0..n];filter(n==).scanl1(+)$drop a[p|p<-[2..n],all((>0).mod p)[2..p-1]]

Try it online!

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


text:
Indentation-based Sort
Given an ordered list of same-case letter strings (a-z XOR A-Z) where each string is preceded by 0 or more space ( ) characters, output the same list but with the strings sorted at each level of indentation. Indentation depths under different parents count as distinct lists for sorting purposes.
Example
If your input is:
bdellium
  fox
  hound
  alien
aisle
  wasabi
    elf
    alien
  horseradish
    xeno
irk
wren
tsunami
djinn
      zebra

your output should be
aisle
  horseradish
    xeno
  wasabi
    alien
    elf
bdellium
  alien
  fox
  hound
djinn
      zebra
irk
tsunami
wren

If you like, think of it like a directory listing, and you need to sort the names within each directory.
Minutiae

An item may be indented by any number of spaces. If it is indented by the same number of spaces as the previous item it belongs in the same sort hierarchy as the previous item. If it is indented by more spaces it is the start of a new sub-hierarchy.
If a line is indented by fewer spaces than the line above it, it links up to the closest sub group above it with the same # or fewer spaces before it (like horseradish in the above example, which links onto the wasabi group above it because wasabi is the first item above it to not have more spaces than horseradish)
You must preserve the indenting level of each input item in your output
Tabs in the output are disallowed
The first line of the input will never be indented
Your program must handle at least one of all-uppercase and all-lowercase strings; it doesn't have to handle both.

Scoring
This is a code-golf, so the answer which uses the fewest bytes wins.

Nice challenge!

Btw, for next time, consider using the Sandbox to iron out issues with a challenge before posting it to the main site.

May we take input as a list of strings and a list of indentation levels? E.g. [0,2,2,2,0,2,4,4,2,4,0,0,0,0,6] and ["bdellium","fox","hound","alien","aisle","wasabi","elf","alien","horseradish","xeno","irk","wren","tsunami","djinn","zebra"]?

@Adám No, the recursive string parsing logic required is the reason I wrote this prompt.

By 'indenting level', do you mean the amount of spaces or where it is in relation to the previous level?

If the input is ['a','..b', '.c', '..d'], what should the output be? ['a','..b', '.c', '..d'] or ['a','.c','..b', '..d'] or some other thing? (I'm using '.' instead of space for visual clarity).

I approve of the BNL reference :)

@JoKing The number of spaces before the letters. Each string of the output should have the same number of spaces before it as it does in the input.

@ChasBrown The first one, ['a','..b', '.c', '..d']. Whether or not a new subgroup forms depends only on whether or not the current line has more spaces before it than the previous line. In your example b has more spaces than a so it's grouped under a. c doesn't have more spaces than b so it ends up in the same sorting group as b. d has more spaces than c so it gets its own subgroup under c. I suppose the implicit consequence of this is that if you have fewer spaces than the line above you that line's subgroup ends and you go up until you find a subgroup you match or exceed the spacing of.

This is an indentation preserving sort, not an indentation based sort.

@Pureferret The grouping levels are based on the level of indentation. It's also indentation preserving, but that's a secondary characteristic.

will there be any spaces in the strings? e.g. " two words"

do we have to handle where the first item in the sub-group is at a lower level in the heirarchy? or will the levels increase?

@streetster strings (a-z XOR A-Z)

@streetster The way it's written right now that has to be handled. It should have no impact on the groupings though (in the above example, if fox had an additional two spaces before it fox would retain the same position in the output, just with more spaces). I don't particularly like this edge-case (since the output may not be idempotent if re-run through the program), but now that there are a number of established answers I'm reluctant to change the rules.

I feel like the first line of the input will never be indented should apply recursively, so that the case that @ChasBrown describes should never happen

@Techrocket9, what if alien had an extra space? Seems a few of us are asking about this case. I agree with Jo King ^^

Pyth, 23 bytes
jeMtSuaG+f</Td/HdeGHQ]Y

Try it here!

Python 2, 117 bytes
lambda S:[s[-1]for s in sorted(reduce(lambda t,s:t+[[v for v in t[-1]if v.count(' ')<s.count(' ')]+[s]],S,[[]]))[1:]]

Try it online!
Takes as input a list of strings; and outputs a list of strings, sorted as required.
The idea is to turn each element into a list which contains the "absolute path" as a list; and then let Python handle the sorting. E.g. if the input is:
[
 'a',
 ' c',
 '  d',
 ' b'
]

Then via the reduce(), we convert to a list of lists:
[
 ['a'],
 ['a',' c'],
 ['a',' c', '  d'],
 ['a',' b']
]

which gets sorted as:
[
 ['a'],
 ['a',' b']
 ['a',' c'],
 ['a',' c', '  d'],
]

and then output the last element of each list in the list-of-lists to get:
[
 'a',
 ' b'
 ' c',
 '  d',
]

Wow the solution I was about to post was 183 bytes...I suck lol

@Rushabh Mehta: My first try was around 205 bytes... then hack away! :)

APL (Dyalog Unicode), 31 bytesSBCS
Anonymous prefix lambda, takes and returns list of strings.
{⍵[⍋{1=≢⍵:⍺⋄⍵}⍀↑' '(,⊂⍨⊣=,)¨⍵]}

Try it online!
{…} "dfn"; ⍵ is argument
 ⍵[…] index the argument with the following indices:
  ' '(…)¨⍵ apply the following tacit function to each string with space as left argument:
   , concatenate the space to the string
   ⊣= Boolean list indicating where the space is equal to each character that
   ,⊂⍨ use that to partition (begin part where true) the concatenation of space and string
  ↑ mix list of lists of strings into matrix of strings
  {…}⍀ vertical cumulative reduction by this "dfn"; ⍺ and ⍵ are upper and lower args:
   ≢⍵ the length of the lower string
   1= is that equal to 1? (i.e. is there nothing but the single space there?)
   :⍺ if so, return the upper argument
   ⋄⍵ else, return the lower argument
  ⍋ grade up (find indices which will sort that)

Retina, 47 bytes
+-1m`(?<=^\2(\S+).*?¶( *))
$1
O$`
$L$&
\S+

Try it online! Note: Several lines have trailing spaces. Explanation:
+-1m`(?<=^\2(\S+).*?¶( *))
$1

The first step is to insert each word into following lines at the same indentation. For example, with the lines aisle,   wasabi and     elf the resulting lines are aisle, aisle  wasabi and aisle  wasabi  elf. I discovered this regex by trial and error so there may be edge cases with it.
O$`
$L$&

We can now sort the lines case-insensitively.
\S+

Delete all of the inserted words.

Perl 6, 120 83 81 63 54 37 47 42 bytes
-5 bytes thanks to nwellnhof
{my@a;.sort:{@a[+.comb(' ')..*+1]=$_;~@a}}

Try it online!
This uses Chas Brown's method. An anonymous code block that takes a list of lines and returns a list of lines.
Explanation:
{                                        }  # Anonymous code block
 my@a;  # Declare a local list
      .sort # Sort the given list of lines
           :{                           }  # By converting each line to:
             @a[+.comb(' ')..*+1]=$_;      # Set the element at that indentation level onwards to that line
                                     ~@a   # And return the list coerced to a string

@nwellnhof Thanks for pointing that out. I think I've fixed it in the latest version

@nwellnhof Ah well, it was shorter in a previous iteration. Thanks for the bytes off, but I had to change it slightly

Oh, right. Actually, something like {my@a;.sort:{@a[+.comb(' ')...*>@a]=$_;~@a}} is required to support higher indentation levels.

Clean, 112 101 bytes
import StdEnv
f=flatten
?e=[0\\' '<-e]
$[h:t]#(a,b)=span(\u= ?u> ?h)t
=sort[[h:f($a)]: $b]
$e=[]

f o$

Try it online!
Anonymous function :: [[Char]] -> [[Char]] which wraps $ :: [[Char]] -> [[[Char]]] into the right output format. $ groups the strings into "more spaces than" and "everything else afterwards", recurses over each group and sorts when they're adjoined. At each step, the list being sorted looks like:
[[head-of-group-1,child-1,child-2..],[head-of-group-2,child-1,child-2..]..]

Clean, 127 bytes
import StdEnv
$l=[x++y\\z<- ?(map(span((>)'!'))l),(x,y)<-z]
?[h:t]#(a,b)=span(\(u,_)=u>fst h)t
=sort[[h:flatten(?a)]: ?b]
?e=[]

Try it online!
Defines the function $ :: [[Char]] -> [[Char]] which separates the strings into tuples in the form (spaces, letters) which are recursively sorted by the helper function  ? :: [([Char],[Char])] -> [[([Char],[Char])]].
Explained:
$ list                                  // the function $ of the list
    = [                                 // is
        spaces ++ letters               // the spaces joined with the letters
        \\ sublist <- ? (               // from each sublist in the application of ? to
            map (                       // the application of
                span ((>)'!')           // a function separating spaces and letters
            ) list                      // to every element in the list
        )
        , (spaces, letters) <- sublist  // the spaces and letters from the sublist
    ]

? [head: tail]                              // in the function ? of the head and tail of the input
    # (group, others)                       // let the current group and the others equal
        = span (                            // the result of separating until ... is false
            \(u, _) = u >                   // only elements where there are more spaces
                          fst head          // than in the head of the input
        ) tail                              // the tail of the input
    = sort [
        [head                               // prepend the head of the input to
             : flatten (?group)             // the flat application of ? to the first group
                               ]            // and prepend this to
                                : ?others   // the application of ? to the other group(s)
    ]

? empty = [] // match the empty list

JavaScript (Node.js), 114 100 92 88 bytes
x=>x.map(y=>a=a.split(/ */.exec(y)[0]||a)[0]+y,a="_").sort().map(x=>/ *\w+$/.exec(x)[0])

Try it online!
Similar approach to Chas Brown's Python answer, but using regular expressions instead.
Explanation
x => x.map(                         //
 y => a = a.split(                  // Renders the indentation paths
  / */.exec(y)[0]                   //  Checks the indentation level
  || a                              //  If this is the top level, go to root
 )[0] + y,                          //  Appends the child to the parent
 a = "_"                            // At first the cursor is at the root
)                                   //
.sort()                             // Sorts the indentation paths
.map(                               //
 x => / *\w+$/.exec(x)[0]           // Extracts only the last level of the path
)                                   //

K4, 51 bytes
Solution:
{,/(1#'r),'.z.s@'1_'r:(w_x)@<x@w:&s=&/s:+/'" "=/:x}

Example:
q)k){,/(1#'r),'.z.s@'1_'r:(w_x)@<x@w:&s=&/s:+/'" "=/:x}("bdellium";"  fox";"  hound";"  alien";"aisle";"  wasabi";"    elf";"    alien";"  horseradish";"    xeno";"irk";"wren";"tsunami";"djinn";"      zebra")
"aisle"
"  horseradish"
"    xeno"
"  wasabi"
"    alien"
"    elf"
"bdellium"
"  alien"
"  fox"
"  hound"
"djinn"
"      zebra"
"irk"
"tsunami"
"wren"

Assumptions:
a. That each hierarchy will start with the lowest level, i.e. you will not get:
bdellium
      fox
    hound
    alien

Explanation:
{,/(1#'r),'.z.s@'1_'r:(w_x)@<x@w:&s=&/s:+/'" "=/:x} / the solution
{                                                 } / lambda function, implicit x
                                           " "=/:x  / " " equal to each right (/:) x
                                        +/'         / sum up each
                                      s:            / save as s
                                    &/              / find the minimum (ie highest level)
                                  s=                / is s equal to the minimum?
                                 &                  / indices where true
                               w:                   / save as w
                             x@                     / index into x at these indices
                            <                       / return indices to sort ascending
                           @                        / index into
                      (   )                         / do this together
                       w_x                          / cut x at indices w
                    r:                              / save as r
                 1_'                                / drop first from each r
            .z.s@                                   / apply recurse (.z.s)
          ,'                                        / join each both
    (    )                                          / do this together
     1#'r                                           / take first from each r
  ,/                                                / flatten

Perl 5, 166 bytes
sub f{my$p=shift;my@r;while(@i){$i[0]=~/\S/;$c=$-[0];if($p<$c){$r[-1].=$_ for f($c)}elsif($p>$c){last}else{push@r,shift@i}}sort@r}push@i,$_ while<>;print sort@{[f 0]}

Ungolfed (sort of):
sub f {
    my $p = shift;
    my @r;
    while(@i) {
        $i[0] =~ /\S/;
        $c = $-[0];
        if($p < $c) {
            $r[-1] .= $_ for f($c)
        } elsif ($p > $c) {
            last
        } else {
            push @r, shift @i
        }
    }
    sort @r
}

push @i, $_ while <>;
print sort@{[f 0]}

It's a pretty straightforward recursive implementation. We check the indentation level by searching for the first non-space character (/\S/) and getting its index ($-[0]). Unfortunately, we actually have to declare a handful of variables that are used in the recursion, or else they'll be implicitly global and the recursion won't work correctly.

source: Stack Exchange

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

sort: votes


text:
Dictionary Code Golf
New to code golf and enjoying it. I have a problem that I cannot figure out and am curious if others can solve it.
Start with two dictionaries, y and z:
y = {'a': 1, 'c': 3, 'e': 5, 'g': 7}
z = {'b': 2, 'd': 4, 'f': 6, 'h': 8}

y and z both map length-1 strings to numbers, where each number is between 1 and 26 (inclusive) and represents an English letter: a = 1, b = 2, c = 3, d = 4 , ... , z = 26.
The goal is as follows:

Double each number (i.e. value) in y, and replace the key with the letter corresponding to the new number.
Do the same for z, but triple each number instead.
Populate a dictionary x with the keys and values from both y and z in descending numerical order, for instance:

x = {'x': 24, 'n':18, 'm': 14, 'l':12, 'j': 10, 'f': 6, 'b':2}

Good luck!
Example:
Starting state:
y = {'a': 1, 'c': 3, 'e': 5, 'g': 7}
z = {'b': 2, 'd': 4, 'f': 6, 'h': 8}

After y operations:
y = {'b':2, 'f': 6, 'j': 10, 'm': 14}

After z operations:
z = {'f': 6, 'l': 12, 'n': 18, 'x': 24}

Comments are not for extended discussion; this conversation has been moved to chat.

Python, 174 155 113 86 70 68 66 bytes
It's actually my first time here and here's my attempt. Let me know if I am doing anything wrong.
lambda y,z:{chr(v*(3-v%2)+96):v*(3-v%2)for v in{**y,**z}.values()}

EDIT: After OP's edit and @Rod 's comment I noticed I have some mistakes. I also took out the sorting attempts because it simply can't work with Python dictionaries.
EDIT2: -16bytes thanks to @JonathanAllan
Try it online!

Just so you know, at the moment this is a TIPS question, not a challenge. Please add an explanation to your answer.


text:
Make the biggest and smallest numbers
Inspired by this post over on Puzzling. Spoilers for that puzzle are below.
Given three positive integers as input, (x, y, z), construct the inclusive range [x, y], concatenate that range together, then remove z not-necessarily-consecutive digits to produce the largest and smallest positive integers possible. Leading zeros are not permitted (i.e., the numbers must start with [1-9]). Output those two numbers in either order.
For the example from the Puzzling post, for input (1, 100, 100), the largest number possible is 99999785960616263646566676869707172737475767778798081828384858687888990919293949596979899100,
and the smallest number is 10000012340616263646566676869707172737475767778798081828384858687888990919293949596979899100,
following the below logic from jafe's answer posted there:

We can't influence the number's length (there's a fixed number of digits), so to maximize the value we take the maximal first digit, then second digit etc.
Remove the 84 first non-nines (16 digits left to remove):
999995051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
The largest number within the next 17 digits is 7, so from here, the next digit in the answer can be at most 7 (we can't remove more than 16 digits). So remove 15 non-7's... (1 digit left to remove): 999997585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
From here, the next digit can be at most 8 so remove one non-8 from the middle: 99999785960616263646566676869707172737475767778798081828384858687888990919293949596979899100
Similar logic, but reversed (i.e., we want leading 1s instead of leading 9s) for the smallest number.

Here's a smaller example: (1, 10, 5).
We construct the range 12345678910 and determine which 5 digits we can remove leaving the largest possible number. Obviously, that means we want to maximize the leading digit, since we can't influence the length of the output. So, if we remove 12345, we're left with 678910, and that's the largest we can make. Making the smallest is a little bit trickier, since we can pluck out numbers from the middle instead, leaving 123410 as the smallest possible.
For (20, 25, 11), the result is rather boring, as 5 and 1.
Finally, to rule out answers that try leading zeros, (9, 11, 3) gives 91011 which in turn yields 91 and 10 as the largest and smallest.
I/O and Rules

If it's easier/shorter, you can code two programs/functions -- one for the largest and one for the smallest -- in which case your score is the sum of both parts.
The input and output can be given by any convenient method.
The input can be assumed to fit in your language's native number type, however, neither the concatenated number nor the output can be assumed to do so.
Either a full program or a function are acceptable. If a function, you can return the output rather than printing it.
Standard loopholes are forbidden.
This is code-golf so all usual golfing rules apply, and the shortest code (in bytes) wins.

a list of digits is acceptable as output?

A test case that would yield a bogus minimum when evaluating those with leading zeros may be worthwhile - I think 9, 11, 3 would do.

@Rod Yep, a list of digits is fine for output.

@Rod I dunno what you're talking about, I clearly typed "output" above. ;-)

@JonathanAllan Good call. Added.

@AdmBorkBork Can I have my code be such that replacing one word does both things? How do I count the bytes for that?

@RushabhMehta You'll either need to fully count both pieces of code, or come up with a way to re-use the code into one submission.

Could you add a couple more test cases to verify our solutions against?

Haskell, 162 bytes
l=length
((m,f)%n)s|n>=l s=[]|n>0,(p,c:r)<-span(/=m(f$take(n+1)s))s=c:((m,id)%(n-l p)$r)|1>0=s
(x#y)z=[p%z$show=<<[x..y]|p<-[(maximum,id),(minimum,filter(>'0'))]]

Try it online!
Uses the algorithm described by jafe. Might be shorter to use a less efficient method, but this was more fun to write :)
The % operation takes 4 arguments (actually 3, but whatever): m which is a function that selects the "optimal" member from a list (either maximum or minimum depending on what we want); f which is a "filter" function; n the number of digits left to drop; and s the string. First we check whether n is equal to the number of digits left in the string (I used >= for safety) and drop the rest of s if so. Otherwise we check if we still need to drop digits (n>0), then we use span to break our string into three pieces: p the digits to drop, c the optimal reachable digit, and r the remaining string. We do this by passing span a predicate that checks for equality against our optimal digit. To find that digit we take the first n+1 digits of the string, filter it, then pass it to our "chooser" function. Now we just yield our optimal digit and recur, subtracting the length of p (the number of digits dropped) from n. Notice that we do not pass our filtering function to the recursive call, and, instead, we replace it with id. That's because the filter is only there to avoid selecting leading 0s in the minimum case which is only relevant on the first iteration. After that we no longer need any filter.
% is really only a helper function for # which is our "real" function, taking x, y, and z. We use a list comprehension just to avoid a bit of repetition, iterating over our function tuples and passing them to % along with z and the concatenated string. That string is created using the magic monad operator (=<<) which, in this context, works like concatMap.

Jelly, 17 bytes
r/VDœcL_¥¥ḷ/ƇVṢ.ị

Try it online!
Calculates all possibilities then keeps the largest and smallest.
Left argument: x,y to construct the range.
Right argument: z digits to be removed.
r/VDœcL_¥¥ḷ/ƇVṢ.ị
r/                 Inclusive range from x to y
  V                Concatenate the digits together
   D               Get the resulting digits
         ¥         Dyad:
        ¥            Dyad:
      L                Length of the list of digits in the concatenated number.
       _               Subtract the number of digits to be removed.
    œc               Combinations without replacement. (remove z digits)
            Ƈ      Keep lists of digits that:
          ḷ/       have a positive first element (no leading zeros).
             V     Combine digits into integers. (vectorizes to ldepth 1)
              Ṣ    Sort the numbers
               .ị  Indexes at value 0.5 which yields the first and last elements.

Python 2, 143 bytes
import itertools
s,e,r=input()
l=''.join(map(str,range(s,e+1)))
L=[i for i in itertools.combinations(l,len(l)-r)if'0'<i[0]]
print min(L),max(L)

Try it online!
This works by calculating all combinations of the target size (the element order is preserved) and getting the smallest / biggest numbers from it

Oh...I guess that works lol. I was trying really hard to make a program that actually calculates it deterministically.

@RushabhMehta Brute force calculations are still deterministic, just slower.

Charcoal, 56 bytes or 21 + 46 35 = 67 56 bytes
≔⪫…·ＮＮωθＦＮ≔⌈ＥθΦθ⁻λνθθ

Try it online! Link is to verbose version of code. Explanation:
≔⪫…·ＮＮωθ

Input x and y, create an inclusive range and join the numbers into a string.
ＦＮ

Loop once for each digit to be removed.
≔⌈ＥθΦθ⁻λνθ

Create a list of strings formed by removing each possible character from the current string and take the maximum.
θ

Print the result.
≔⪫…·ＮＮωθＦ⊕Ｎ⊞υωΦθ∧⁼ι⌊Φ✂θκＬυ¹∨κＩλ⊞Ｏυω

Try it online! Link is to verbose version of code. Explanation:
≔⪫…·ＮＮωθ

Input x and y, create an inclusive range and join the numbers into a string.
Ｆ⊕Ｎ⊞υω

Input z and increment it. I then create a list of that length: I need to be able to increment z inside the following filter, but only commands are allowed to increment variables; there is a loophole in that PushOperator increments the length of the list.
 θ                      String of digits
Φ                       Filter over characters
         κ              Current index
          Ｌυ            Length of list i.e. current `z` value
            ¹           Literal 1
       ✂θ               Slice string of digits
      Φ                 Filter over characters
              κ         Outer index
               Ｉλ       Cast inner character to number
             ∨          Logical OR
     ⌊                  Minimum
   ⁼ι                   Equals the outer character
  ∧              ⊞Ｏυω   And also push to list i.e. increment `z`
                        Implicitly print

Filter on the characters that are wanted by checking that there are no lower characters in the sliceable region. The region starts with the first z+1 characters (since it's possible to slice the first z away if necessary) and the end point increments for each character that is kept. Care is taken not to choose a zero for the first character.
The faster algorithm is 30 bytes when used to compute the largest possible number:
≔⪫…·ＮＮωθＦ⊕Ｎ⊞υωΦθ∧⁼ι⌈✂θκＬυ¹⊞Ｏυω

Try it online! Link is to verbose version of code. Edit: I've since been able to combine the above two into a second 56 byte solution which generates both results:
≔⪫…·ＮＮωθＦ⊕Ｎ⊞υω≔⮌υη⟦Φθ∧⁼ι⌈✂θκＬυ¹⊞ＯυωΦθ∧⁼ι⌊Φ✂θκＬη¹∨κＩλ⊞Ｏηω

Try it online! Link is to verbose version of code. Explanation:
≔⪫…·ＮＮωθ

Generate the initial string.
Ｆ⊕Ｎ⊞υω

Represent z+1 as the length of the list.
≔⮌υη

Reverse the list thus cloning it and save the result.
⟦

Print the two results on separate lines. (Another way of doing this is to separate the results with a literal \r character.)
Φθ∧⁼ι⌈✂θκＬυ¹⊞Ｏυω

Generate the largest possible number.
Φθ∧⁼ι⌊Φ✂θκＬη¹∨κＩλ⊞Ｏηω

Generate the smallest possible number using the cloned list to keep track of z.

Jelly,  19  18 bytes
rDẎœcL_⁵Ɗ$ị@Ƈ1ḌṢ.ị

Try it online!
Very inefficient, definately no point going for 1, 100, 100 as \$\binom{192}{92}=305812874887035355118559193163641366325011573739619723360\$

05AB1E, 16 bytes
ŸSDg³-.Æʒ¬Ā}{Ć`‚

Try it online!
Full program, reading inputs in this order: y, x, z. Outputs a list of two lists of characters.
Explanation
ŸSDg³-.Æʒ¬Ā}{Ć`‚    Full program. Inputs: y, x, z.
Ÿ                   Inclusive binary range from x to y. Push [x ... y].
 S                  Dump the digits separately in a list.
  Dg                Duplicate, and use the second copy to get its length.
    ³-              Subtract z from the length.
      .Æ            Retrieve all combinations of length - z elements from the digits.
        ʒ  }        Keep only those that...
         ¬Ā         Don't start with a 0 (head, then Python-style boolean).
            {       Sort the remaining elements.
             Ć      Enclose. Pushes list + list[0] (appends its tail to itself)
              `     Dump all elements separately on the stack.
               ,    Pair, to get the last two, min and max (after enclosing)

Oh, Ć`‚ is pretty smart, nice answer!

Matlab, 95 bytes
function[m]=f(s,e,c),a=sprintf('%d',s:e);x=str2num(combnk(a,length(a)-c));m=[min(x),max(x)];end

Try it Online!
Returns an 1x2 matrix with min and max.
How it works
% Full code
function[m]=f(s,e,c),a=sprintf('%d',s:e);x=str2num(combnk(a,length(a)-c));m=[min(x),max(x)];end

% The function
function[m]=f(s,e,c),                                                                       end

                     % Creates the range in a single string
                     a=sprintf('%d',s:e);

                                                   % Gets all the combinations
                                                   combnk(a,length(a)-c)

                                         % Converts the string combinations to integers
                                         x=str2num(                     );

                                                                          % Finds min and max
                                                                          m=[min(x),max(x)];


text:
Magic: The Gathering Combat with Abilities
Related
Goal:
Given two creatures with optional combat abilities, return unique but consistent values that represent which creatures died, if any.
Input:
#Longest form:
[[P,T, "<abilities>"], [P,T, "<abilities>"]]
#Shortest form:
[[P,T], [P,T]]

Each creature will be given in the form of [P,T,"<abilities>"]. It will be in the form [P,T], [P,T,""], or [P,T,0] if it has no abilities, your choice on form. P is an integer >=0, T is an integer >=1. <abilities> is a subset of "DFI", or can be represented via a single number/bitstring if you wish. Order of the flags is also up to you.
Combat Mechanics:
Each creature has two stats, Power and Toughness in that order, and optional abilities. A creature's power is >=0. A creature's Toughness is >=1.
Each creature will simultaneously do damage equal to its power to the opposing creature (unless one has first-strike). If the value is greater than or equal to the opponent's toughness, it will die (unless it is indestructible).
Example: Alice is a 2/2, Bob is a 3/4, both with no abilities. Alice will do 2 damage to Bob and take 3 damage in return. Alice's toughness is 2 so it will die, Bob's toughness is 4 so it will live.
There are only 3 optional abilities we will consider for this (although there are more in the game). These will be one character flags:

[D]eathtouch: Any amount of damage (X>0) is considered lethal.
[F]irst Strike: Will deal its damage first, able to kill the other creature before it can attack back. If both creatures have First Strike, Resolve combat as normal.
[I]ndestructible: No amount of damage is considered lethal, including Deathtouch.

Output:
Any consistent value for each of the following four cases. State the four values in your answer, please. Example return value in parens:

Neither creature died (0)
1st creature died (1)
2nd creature died (2)
Both creatures died (3)

Rules:

Input is guaranteed to have two correctly formatted creatures.
If you are using characters for abilities, you can assume they're ordered how you want but post the order used if relevant.
If you are using a number/bitstring for abilities, post what encoding you're using. e.g.: 111 is D/F/I, 7 is D/F/I, etc.
If a creature has no abilities, It can also be taken as [P,T, ""] or number equivalent
Standard Loopholes Forbidden
This is code-golf so shortest code wins.

Examples:
Input: [[2,2], [1,1]]
Output: 2nd Dies

Input: [[0,2], [0,1]] #0/2 vs 0/1
Output: Neither Die

Input: [[2,1], [2,1]] #2/1 vs 2/1
Output: Both Die

Input: [[1,1, "D"], [2,2]] #1/1 Deathtoucher vs 2/2
Output: Both Die

Input: [[2,2], [0,1, "D"]] #2/2 vs 0/1 Deathtoucher
Output: 2nd Dies

Input: [[2,2], [1,1, "DF"]] #2/2 vs 1/1 Deathtouch First-striker
Output: 1st Dies

Input: [[0,2, "D"], [0,1, "DF"]] #0/2 Deathtoucher vs 0/1 Deathtouch First-striker
Output: Neither Die

Input: [[2,2], [2,2, "F"]] #2/2 vs 2/2 First-striker
Output: 1st Dies

Input: [[2,2, "I"], [1,1, "DF"]] #2/2 Indestructible vs 1/1 Deathtouch First-striker
Output: 2nd Dies

Input: [[9999,9999], [1,1, "I"]] #9999/9999 vs 1/1 Indestructible
Output: Neither Die

Input: [[2,2, "F"], [1,1, "F"]] #2/2 First-Striker vs 1/1 First-Striker
Output: 2nd Dies

#9/9 Deathtouch, Indestructible First-Striker vs 9/9 Deathtouch, Indestructible First-Striker
Input: [[9,9, "DFI"], [9,9, "DFI"]]
Output: Neither Die

Oh I thought I vs D would be like in a paradox about spear and shield in China lol The paradox is about a person selling an indestructible shield and a deathtoucher spear, and someone asks what if the spear tries to strike on the shield. ;) Seems Indestructible is at a higher priority?

@user71546 Yeah. There's a bit more rules involved but in MtG, "Can'ts" trump "Cans." So functionally, Indestructible ignores Deathstrike. Edited that in to be more explicit

@user71546 deathtouch is when this monster deals damage. Indestructible is something like it takes no damage and is immune to kill effects

@fəˈnɛtɪk, it still takes damage, it just doesn't die from it. Mind you, the question misstates the rule too. It should be "[Indestructible] permanents aren’t destroyed by lethal damage, and they ignore the state-based action that checks for lethal damage".

"If a creature has no abilities, It must be parsed as [P,T]. [P,T,""] is not valid" is a bad rule. It discriminates against languages with strong typing for no benefit.

@PeterTaylor I want to keep jagged arrays but you're right that it doesn't make it better. Thus the rule has been removed

@Veskah Can I take "D", "F", "I" as numbers? D => 0, F => 1, I => 2

@LuisfelipeDejesusMunoz a monster can have more than one of the properties DFI is possible for example

"No amount of damage is considered lethal, including Deathstrike" - by Deathstrike do you mean a strike from a Deathtouch able character? Also "Each creature will simultaneously do damage equal to its power to the opposing creature" - just the once or repeatedly? (I guess from the examples just the once)

@LuisfelipeDejesusMunoz You can have multiple abilities but encoded as a single number. For example: 1 is D, 2 is F, 4 is I, 7 is DFI.

@JonathanAllan That was a typo, it should be Deathtouch. Damage is also done just once (although I was tempted to include Double-Strike).

What about wither, overcoming indestructible? :)

Perl 5, 248 bytes
...without spaces and newlines:
sub c{eval'
(P,T,A,p,t,a)=@_;
     A=~/F/&&a!~/F/&&a!~/I/ ? c( P,2e9,A=~s/F//r,p,t, a         )
    :a=~/F/&&A!~/F/&&A!~/I/ ? c( P,T, A,        p,2e9,a=~s/F//r )
    : do{
        P=1e9 ifA=~/D/&&P>0;
        p=1e9 ifa=~/D/&&p>0;
        T=3e9 ifA=~/I/;
        t=3e9 ifa=~/I/;
        T-=p;
        t-=P;
        T>0&&t>0  ? 0
            : T>0 ? 2
            : t>0 ? 1
            :       3
}'=~s,[pta],\$$&,gri }

Try it online!
My ungolfed version with the ten tests from @Veskah (OP), tests passes:
sub co { #combat
    my($p1,$t1,$a1, $p2,$t2,$a2)=@_; #p=power, t=toughness, a=abilities
    $a1=~s/F// and $a2=~s/F// if "$a1$a2"=~/F.*F/; #both F, no F
    return co($p1,2e9,$a1=~s/F//r, $p2,$t2,$a2        ) if $a1=~/F/ && $a2!~/I/;
    return co($p1,$t1,$a1,         $p2,2e9,$a2=~s/F//r) if $a2=~/F/ && $a1!~/I/;
    $p1=1e9 if $a1=~/D/ and $p1>0;
    $p2=1e9 if $a2=~/D/ and $p2>0;
    $t1=3e9 if $a1=~/I/;
    $t2=3e9 if $a2=~/I/;
    $t1-=$p2;
    $t2-=$p1;
    $t1<=0 && $t2<=0 ? "Both Die"
   :$t1<=0           ? "1st Dies"
   :$t2<=0           ? "2nd Dies"
                     : "Neither Die"
}

my @test=map{[/Input: .*? (\d+),(\d+)(?:,\s*"([FDI]+)")?
                      .*? (\d+),(\d+)(?:,\s*"([FDI]+)")?
           .*? Output: \s* (1st.Dies|2nd.Dies|Both.Die|Neither.Die)? /xsi]}
         split/\n\n/,join"",<DATA>;
my $t=0;
for(@test){ $t++;
  my $r=co(@$_);#result
  $r=~s,0,Neither Die,; $r=~s,3,Both Die,;
  print $$_[-1]=~/^$r/
    ? "Ok $t\n"
    : "Not ok, combat $t --> $r, wrong! (".join(",",@$_).")\n"
}
__DATA__
Input: [[2,2], [1,1]]
Output: 2nd Dies

Input: [[0,2], [0,1]] #0/2 vs 0/1
Output: Neither Die

Input: [[2,1], [2,1]] #2/1 vs 2/1
Output: Both Die

Input: [[1,1, "D"], [2,2]] #1/1 Deathtoucher vs 2/2
Output: Both Die

Input: [[2,2], [0,1, "D"]] #2/2 vs 0/1 Deathtoucher
Output: 2nd Dies

Input: [[2,2], [1,1, "DF"]] #2/2 vs 1/1 First-strike, Deathtoucher
Output: 1st Dies

Input: [[2,2], [2,2, "F"]] #2/2 vs 2/2 First-striker
Output: 1st Dies

Input: [[2,2, "I"], [1,1, "DF"]] #2/2 Indestructible vs 1/1 First-strike, Deatht.
Output: 2nd Dies

Input: [[99999,99999], [1,1, "I"]] #99999/99999 vs 1/1 Indestructible
Output: Neither Die

Input: [[2,2, "F"], [1,1, "F"]] #2/2 First-Striker vs 1/1 First-Striker
Output: 2nd Dies

JavaScript, 137 125 120 111 bytes
i=>(k=(a,b)=>!(b[2]%2)&&a[0]/(a[2]<=3)>=b[1],[c,d]=i,g=c[2]&2,h=k(c,d),j=k(d,c),d[2]&2-g&&(g?h&&2:j&&1)||j+2*h)

I am using bitmap numbers for abilities D=4 F=2 I=1 do "DFI" would be 7. My output is Neither Died 0,
1st Died 1,
2nd Died 2,
Both died 3.
Tests with:
f([[2, 2, 0], [1,1, 0]]); // 2
f([[0, 2, 0], [0,1, 0]]); // 0
f([[2, 1, 0], [2,1, 0]]); // 3
f([[1, 1, 4], [2,2, 0]]); // 3
f([[2, 2, 0], [0,1, 4]]); // 2
f([[2, 2, 0], [1,1, 6]]); // 1
f([[2, 2, 0], [2,2, 2]]); // 1
f([[2, 2, 1], [1,1, 6]]); // 2
f([[99999, 99999, 0], [1,1, 1]]); // 0
f([[2, 2, 2], [1,1, 2]]); // 2)

This was my my first working code
const kills = (c1, c2) => { // Return true if c1 kills c2
    if (c2[2] % 2) {
        console.log("Indestructible");
        return false;
    }
    const c1p = c1[0] / (c1[2] <= 3); // Infinity if Deathtoucher && P > 0
    const c2t = c2[1];
    return c1p >= c2t;
}
const f = (input) => {
    console.log("Match:", input);
    const [c1, c2] = input;
    const f1 = (c1[2] & 2);
    const f2 = (c2[2] & 2);
    if (f2 !== f1) {
        if (f1) {
            if (kills(c1, c2)) {
                console.log("c1 killed c2 in first round");
                return 2;
            }
        } else {
            if (kills(c2, c1)) {
                console.log("c2 killed c1 in first round");
                return 1;
            }
        }
    }
    return kills(c2, c1) + 2 * kills(c1, c2);
};

Which I reduced to this intermediate:
const f = i => {
    const k = (a, b) => !(b[2] % 2) && a[0] / (a[2] <= 3) >= b[1];
    const [c, d] = i;
    const g = c[2] & 2;
    const h = k(c, d);
    const j = k(d, c);
    return d[2] & 2 - g &&
        (g  ? h && 2
            : j && 1
        ) || j + 2 * h
}

Welcome to PPCG! And very nice first solution :) I can see some potential for further golfing but I'm on my phone, after a few beers so can't test properly.

Here's a quick 7 byte saving, though: https://tio.run/##bc/RbsIgFAbg@z0FuxgBd7RwNEu2SPcgjERKtak1ZVHjle/eUbAxbUdIOOTL@Q8c7c1e3Ln@vS5bX@67g@pqlbNGMQsFV/krKzSaN@SUWi1Mxmy4btWa56rQ0oB2UBpVQ6VcAIpQxmNZUcqq74YFDq341bASXKgkv99T/Y6LxLxzvr3403518hXTLwemNQIJWxggWoLsK8OBZBnByOLJYsRi6JYPxhGvI8vIm8Q4Y5yEb8azp0/7GFhOOYbjfyzn3Sn8s19AHsdziJx9MEYP3A9JIWZ19HW7@2l3vPsD

@Shaggy. Nice one! Of course the comma operator - what a noob I am.

We were all new once :)

JavaScript (ES6), 83 76 bytes
Takes input as 6 distinct arguments: 2 x (Power, Toughness, Abilities). Abilities are expected as bitmasks with:

\$1\$ = Death Touch
\$2\$ = First Strike
\$4\$ = Indestructible

Returns \$0\$ for Neither Die, \$1\$ for 1st Dies, \$2\$ for 2nd Dies or \$3\$ for Both Die.
(p,t,a,P,T,A)=>(x=A<4&&p>=T|a&!!p)&(y=a<4&&P>=t|A&!!P)&&(a^A)&2?a+2>>1:x*2+y

Try it online!
Commented
(p, t, a, P, T, A) => // (p, t, a) = arguments for the first player (P1)
                      // (P, T, A) = arguments for the second player (P2)
  ( x =               // x is a flag which means 'P1 can kill P2',
                      // regardless of the 'First Strike' abilities
    A < 4 &&          // it is set to 1 if P2 is not Indestructible and:
    p >= T |          //   the power of P1 is greater than or equal to the toughness of P2
    a & !!p           //   or the power of P1 is not zero and P1 has the Death Touch
  ) &                 //
  ( y = a < 4 &&      // y is the counterpart of x and is computed the same way
    P >= t |          //
    A & !!P           //
  ) &&                // if both x and y are set
  (a ^ A) & 2 ?       // and exactly one player has the First Strike:
    a + 2 >> 1        //   return 2 if P1 has the First Strike, or 1 otherwise
  :                   // else:
    x * 2 + y         //   return the default outcome: x * 2 + y

C (gcc), 114 113 95 bytes
A lot of golfing thanks to ceilingcat and Logern.
g(Z{return F&1|F&4&&!(f&4||P<t)||!(f&2)&T>p;}
f(Z{return g(Z+2*g(p,t,f,P,T,F);}

Compile with -DZ=P,T,F,p,t,f).
Try it online!
We check (independently, because of the symmetry of combat mechanics) whether each of creatures survives the combat, which happens if either is true:

the creature is indestructible;
the creature has first strike AND the other one does not AND its power is greater or equal to other's toughnes (therefore we may disregard other's death touch);
other creature does not have death touch AND its power is less than our toughness.

(The former conditions are more important).
The inputs are power and toughness as integers, and abilities as a bitfield (1 = Indestructible, 2 = Death touch, 4 = First strike), the output is also a bitfield (1 = First creature survives, 2 = Second creature survives).

Using a macro -DZ=P,T,F,p,t,f) 96 bytes-Try it online!

Using P=… instead of return … and removing the newline takes you to 85 bytes.

Also, -3  bytes by replacing logical operators &&, || with bitwise &, |

Retina 0.8.2, 123 bytes
\d+
$*
(.*1)(.*;)(.*1)
$3$2$1
F(.*)F
$1
1+D
1
1*(,1+)I
$1
(1+)(F?;1*,)(1+)
$3$2$1
(1*)1*,\1(1+)?
$#2
0(F)?;0(F)?
$#1;$#2
F

Try it online! Link includes test cases, although I've substituted 9 for 99999 for speed. Input uses the letters DFI although D must precede I. Output is in the format 1 for survives and 0 for dies. Explanation:
\d+
$*

Convert the stats to unary.
(.*1)(.*;)(.*1)
$3$2$1

Exchange the stats temporarily.
F(.*)F
$1

Two Fs cancel out.
1+D
1

Death Touch lowers the opponent's Toughness to 1.
1*(,1+)I
$1

Indestructable lowers the opponent's Power to 0.
(1+)(;1*,)(1+)
$3$2$1

Switch the Toughness back, so now you have P2,T1,F1;P1,T2,F2
(1*)1*,\1(1+)?
$#2

If the Toughness is higher than the opponent's Power then it survives.
0(F)?;0(F)?
$#1;$#2

If both would die, the one with First Strike survives.
F

Otherwise First Strike makes no difference.

C++, 177 131 127 121 bytes
Here's my not so short solution in C++. Abilities are 3 bits for each creature:

D = 0x1 (0001)
F = 0x2 (0010)
I = 0x4 (0100)

And it simply returns 0: if nobody dies, 1: if the first creatures dies, 2: if the second creature dies and 3: if both creatures die.
[](int p,int t,int a,int r,int k,int b){return(a&2&&b^4)^(b&2&&a^4)?1+(a&2):((t<r||b&1&&r)&&a^4)+((k<p||a&1&&p)&&b^4)*2;}

Try it Online!
C++, 85 81 bytes (Alternative)
By slightly cheating and capture the variables in lambda and not pass them as arguments it is possible to get down to 81 bytes. I don't know if that's an acceptable solution so I post it as an alternative.
[&]{s=(a&2&&b^4)^(b&2&&a^4)?1+(a&2):((t<r||b&1&&r)&&a^4)+((k<p||a&1&&p)&&b^4)*2;}

Try it Online!

This is [tag:code-golf], such hacks are expected, if not required, in order to compete ... unless you're using purpose-built code-golfing languages, which changes the game a bit.

Perl 5, 245 bytes
$F[0]*=$F[4]if$F[2]=~/D/;$F[3]*=$F[1]if$F[5]=~/D/;$F[3]=0 if$F[2]=~/I/;$F[0]=0 if$F[5]=~/I/;$F[4]-=$F[0]if$F[2]=~/F/;$F[1]-=$F[3]if$F[5]=~/F/;if($F[1]>0&&$F[4]>0){$F[4]-=$F[0]if$F[2]!~/F/;$F[1]-=$F[3]if$F[5]!~/F/}$_=(0+($F[1]<=0)).(0+($F[4]<=0))

Run with -lapE
Ungolfed:
# Takes input in one lines, of the form:
# PPP TTT "<abilities>" PPP TTT "<abilities>"

$F[0] *= $F[4] if $F[2] =~ /D/;
$F[3] *= $F[1] if $F[5] =~ /D/;

$F[3] = 0 if $F[2] =~ /I/;
$F[0] = 0 if $F[5] =~ /I/;

$F[4] -= $F[0] if $F[2] =~ /F/;
$F[1] -= $F[3] if $F[5] =~ /F/;

if ($F[1] > 0 && $F[4] > 0) {
    $F[4] -= $F[0] if $F[2] !~ /F/;
    $F[1] -= $F[3] if $F[5] !~ /F/;
}

$_ = (0+ ($F[1] <= 0)) . (0+ ($F[4] <= 0));

"Deathtouch" translates to "your power is now multiplied by your enemy's toughness", and "indestructible" translates to "your enemy's power is now zero", with the latter taking precedent. The code runs two rounds, one where only the first-strikers get to attack, and the other where only non-first-strikers can attack. If the first round results in a death, the second round doesn't happen. Since we already dealt with the deathtouch and indestructible at the beginning, "death" is as simple as checking whether toughness is greater than zero or not.