[Question]
  [
# Introduction
In this challenge, your task is to decide whether a given sequence of numbers can be separated into two subsequences, one of which is increasing, and the other decreasing.
As an example, consider the sequence `8 3 5 5 4 12 3`.
It can be broken into two subsequences as follows:
```
  3 5 5   12
8       4    3
```
The subsequence on the first row is increasing, and the one on the second row is decreasing.
Furthermore, you should perform this task efficiently.
# Input
Your input is a non-empty list `L` of integers in the range 0 – 99999 inclusive.
It is given in the native format of your language, or simply delimited by spaces.
# Output
Your output is a truthy value if `L` can be broken into an increasing and a decreasing subsequence, and a falsy value otherwise.
The subsequences need not be strictly increasing or decreasing, and either of them may be empty.
# Rules and bonuses
You can write a full program or a function.
The lowest byte count wins, and standard loopholes are disallowed.
Furthermore, brute forcing is forbidden in this challenge: **your program must run in polynomial time in the length of the input**.
You are not required to actually return the two subsequences, but there is a **bonus of -20%** for doing so.
To make the bonus easier to claim in statically typed languages, it is acceptable to return a pair of empty lists for the falsy instances.
# Test cases
Given in the format `input -> None` for falsy inputs and `input -> inc dec` for truthy inputs.
Only one possible pair of subsequences is given here; there may be more.
```
[4,9,2,8,3,7,4,6,5] -> None
[0,99999,23423,5252,27658,8671,43245,53900,22339] -> None
[10,20,30,20,32,40,31,40,50] -> None
[49,844,177,974,654,203,65,493,844,767,304,353,415,425,857,207,871,823,768,110,400,710,35,37,88,587,254,680,454,240,316,47,964,953,345,644,582,704,373,36,114,224,45,354,172,671,977,85,127,341,268,506,455,6,677,438,690,309,270,567,11,16,725,38,700,611,194,246,34,677,50,660,135,233,462,777,48,709,799,929,600,297,98,39,750,606,859,46,839,51,601,499,176,610,388,358,790,948,583,39] -> None
[0,1,2,3,4] -> [0,1,2,3,4] []
[4,3,2,1,0] -> [] [4,3,2,1,0]
[1,9,2,8,3,7,4,6,5] -> [1,2,3,4,6] [9,8,7,5]
[71414,19876,23423,54252,27658,48671,43245,53900,22339] -> [19876,23423,27658,48671,53900] [71414,54252,43245,22339]
[10,20,30,20,30,40,30,40,50] -> [10,20,20,30,40,40,50] [30,30]
[0,3,7,13,65,87,112,43,22,1] -> [0,3,7,13,65,87,112] [43,22,1]
[7,4,4,7,4,7,7,4,7,4,4,4,7,7] -> [7,7,7,7,7,7,7] [4,4,4,4,4,4,4]
[7,997,991,957,956,952,7,8,21,924,21,923,22,38,42,44,920,49,58,67,71,83,84,85,917,89,907,896,878,878,90,861,115,860,125,128,140,148,858,155,160,836,164,182,826,191,824,805,195,792,205,782,206,210,769,213,756,748,214,745,724,701,234,241,693,268,685,293,679,297,334,671,336,669,341,652,356,648,362,364,370,375,386,630,622,388,389,618,398,408,468,615,470,533,611,539,544,609,586,582,572,565,547,602,536,619,624,528,512,631,640,649,669,671,677,505,678,723,743,489,489,473,454,757,446,445,758,759,764,445,431,770,429,426,418,409,790,383,379,366,363,791,358,795,809,827,835,356,353,841,844,333,867,323,317,879,311,881,309,896,282,281,897,263,904,237,236,226,202,195,914,186,177,917,920,157,926,936,154,138,943,131,945,100,98,947,957,964,95,973,989,57,43,32,21,16,13,11,8,0] -> [7,7,8,21,21,22,38,42,44,49,58,67,71,83,84,85,89,90,115,125,128,140,148,155,160,164,182,191,195,205,206,210,213,214,234,241,268,293,297,334,336,341,356,362,364,370,375,386,388,389,398,408,468,470,533,539,544,586,602,619,624,631,640,649,669,671,677,678,723,743,757,758,759,764,770,790,791,795,809,827,835,841,844,867,879,881,896,897,904,914,917,920,926,936,943,945,947,957,964,973,989] [997,991,957,956,952,924,923,920,917,907,896,878,878,861,860,858,836,826,824,805,792,782,769,756,748,745,724,701,693,685,679,671,669,652,648,630,622,618,615,611,609,582,572,565,547,536,528,512,505,489,489,473,454,446,445,445,431,429,426,418,409,383,379,366,363,358,356,353,333,323,317,311,309,282,281,263,237,236,226,202,195,186,177,157,154,138,131,100,98,95,57,43,32,21,16,13,11,8,0] 
```
  
[Answer]
# Pyth, 34 bytes
```
.N|!N|&ghNT:tNhNY&gYhN:tNThN:QZ^T5
```
[Test Suite](https://pyth.herokuapp.com/?code=.N%7C%21N%7C%26ghNT%3AtNhNY%26gYhN%3AtNThN%3AQZ%5ET5&test_suite=1&test_suite_input=%5B4%2C9%2C2%2C8%2C3%2C7%2C4%2C6%2C5%5D%0A%5B0%2C99999%2C23423%2C5252%2C27658%2C8671%2C43245%2C53900%2C22339%5D%0A%5B10%2C20%2C30%2C20%2C32%2C40%2C31%2C40%2C50%5D%0A%5B49%2C844%2C177%2C974%2C654%2C203%2C65%2C493%2C844%2C767%2C304%2C353%2C415%2C425%2C857%2C207%2C871%2C823%2C768%2C110%2C400%2C710%2C35%2C37%2C88%2C587%2C254%2C680%2C454%2C240%2C316%2C47%2C964%2C953%2C345%2C644%2C582%2C704%2C373%2C36%2C114%2C224%2C45%2C354%2C172%2C671%2C977%2C85%2C127%2C341%2C268%2C506%2C455%2C6%2C677%2C438%2C690%2C309%2C270%2C567%2C11%2C16%2C725%2C38%2C700%2C611%2C194%2C246%2C34%2C677%2C50%2C660%2C135%2C233%2C462%2C777%2C48%2C709%2C799%2C929%2C600%2C297%2C98%2C39%2C750%2C606%2C859%2C46%2C839%2C51%2C601%2C499%2C176%2C610%2C388%2C358%2C790%2C948%2C583%2C39%5D%0A%5B0%2C1%2C2%2C3%2C4%5D%0A%5B4%2C3%2C2%2C1%2C0%5D%0A%5B1%2C9%2C2%2C8%2C3%2C7%2C4%2C6%2C5%5D%0A%5B71414%2C19876%2C23423%2C54252%2C27658%2C48671%2C43245%2C53900%2C22339%5D%0A%5B10%2C20%2C30%2C20%2C30%2C40%2C30%2C40%2C50%5D%0A%5B0%2C3%2C7%2C13%2C65%2C87%2C112%2C43%2C22%2C1%5D%0A%5B7%2C4%2C4%2C7%2C4%2C7%2C7%2C4%2C7%2C4%2C4%2C4%2C7%2C7%5D%0A%5B7%2C997%2C991%2C957%2C956%2C952%2C7%2C8%2C21%2C924%2C21%2C923%2C22%2C38%2C42%2C44%2C920%2C49%2C58%2C67%2C71%2C83%2C84%2C85%2C917%2C89%2C907%2C896%2C878%2C878%2C90%2C861%2C115%2C860%2C125%2C128%2C140%2C148%2C858%2C155%2C160%2C836%2C164%2C182%2C826%2C191%2C824%2C805%2C195%2C792%2C205%2C782%2C206%2C210%2C769%2C213%2C756%2C748%2C214%2C745%2C724%2C701%2C234%2C241%2C693%2C268%2C685%2C293%2C679%2C297%2C334%2C671%2C336%2C669%2C341%2C652%2C356%2C648%2C362%2C364%2C370%2C375%2C386%2C630%2C622%2C388%2C389%2C618%2C398%2C408%2C468%2C615%2C470%2C533%2C611%2C539%2C544%2C609%2C586%2C582%2C572%2C565%2C547%2C602%2C536%2C619%2C624%2C528%2C512%2C631%2C640%2C649%2C669%2C671%2C677%2C505%2C678%2C723%2C743%2C489%2C489%2C473%2C454%2C757%2C446%2C445%2C758%2C759%2C764%2C445%2C431%2C770%2C429%2C426%2C418%2C409%2C790%2C383%2C379%2C366%2C363%2C791%2C358%2C795%2C809%2C827%2C835%2C356%2C353%2C841%2C844%2C333%2C867%2C323%2C317%2C879%2C311%2C881%2C309%2C896%2C282%2C281%2C897%2C263%2C904%2C237%2C236%2C226%2C202%2C195%2C914%2C186%2C177%2C917%2C920%2C157%2C926%2C936%2C154%2C138%2C943%2C131%2C945%2C100%2C98%2C947%2C957%2C964%2C95%2C973%2C989%2C57%2C43%2C32%2C21%2C16%2C13%2C11%2C8%2C0%5D&debug=0)
Uses memoized recursion to keep the runtime down. Defines a 3 input function `:`, which takes inputs `list suffix, end of increasing sequence, end of decreasing sequence.
[Answer]
# [Brachylog](https://github.com/JCumin/Brachylog), 16 bytes - 20% = 12.8 (but it's almost certainly not polynomial)
```
⊇≥₁X&⊇≤₁Y;X.cp?∧
```
[Try it online!](https://tio.run/##jY47TgMxFEW3Ek2R6oL8Ph7bQoIdUAeNpoAoggIRRBOhkIIgAaFiESBaGhp2E29k8jwEQUGBi@vrJ9vnnFwdj8@uz6en3M1n1WBnf1DNhvN8/56Xdzf58a06nF5MqsX6c7VYfzx3@ekhr17z8nY07OuL1aO90e748sAud13TKBIYEYIARQ3fonFIZYFFWeDZMzjUPiLWgaDC6uElOQdmkWQvyKqDfCVDLamkd/13ZAiBWlfb2c5lTn@gAykpKMVQf@P1h6//E3C9gPslUBAkqD2iFTJD0zCPQjS29gZhm7qdhLbdAA "Brachylog – Try It Online")
Fails if there's no pair of compliant subsequences and outputs them through its output variable if there is one (but will just print `true.` if it's run as a program). I say it's *almost* certainly not polynomial because the beauty of Brachylog is that since it's a declarative language, you don't do so much in the way of implementing an algorithm as you do just describing relationships between variables and asking the computer to crank out results. So chances are this is hardcore brute force, but I spent long enough copy pasting the test cases (two of which it just times out on) that I feel like I should submit this anyhow, if for no other reason than to drag this challenge up from the back of the [decision-problem](/questions/tagged/decision-problem "show questions tagged 'decision-problem'") "Newest" list.
```
   X                X is a
 ≥₁                 non-increasing
⊇                   sublist of the input
    &               and
        Y           Y is a
      ≤₁            non-decreasing
     ⊇              sublist of the input
         ;X         which paired with X
           .        is the output variable
            c       which when its elements are concatenated
             p      is a permutation of
              ?     the input
               ∧    which is not unified with the output.
```
[Answer]
# [Haskell](https://www.haskell.org/), 65 bytes
```
(>[]).foldl(%)[(0,9^6)]
p%x=do(u,d)<-p;[(x,d)|x>=u]++[(u,x)|x<=d]
```
[Try it online!](https://tio.run/##jVLLTtxAELznK3wIklcUaB7d0zMK5kccR1qx2QTFgBVA2gPfjlPtrJJLDvFhxu5HVXWXv@@ff3yd5/U4fF7723HaXR@f5sPcX@zGPqB9Kbvpw3JxGg5P/SsOu5ur5dPYn/j2drodXqfLy5HxE79uhsO0PuzvH7uhW37eP750H7uH/dIdeY@joCGhIsMgKNAJI@H9QcqSMjRpQrKiFbVYhOQkCs0tBKSUc2NH5GtA/n0mCM/opwYmpaGKIJqhGTlUWJZ5Q1reUlaMzYKsGRIZT4qqxjJDJWWlDCsVkTxCWuOdFZnZCq0sJGapTDr2xl4gpCscj5iZggt5tCaY8xhjhXCsTsIuornABB@wUWhVxERREpFIrIF4ShAWcE@5ojSflzsyTkn5MYKcRuFMGjUWjzSXUwiz9SmjJSBSOvcGKVTjcN7QYNx4Sw3F99oonqYw6k1kr9rYgMqQRka4XtZHoyJfBveQaZBRVRPfCQdsm5UcgOaK@8A78ds9if@w3aJwIbFVgp6tl7/ey/@ZHzbzwx/zw0YRN7urr4l/B2VQhzOSWzYFdj7lHLFpWt/vjvP@2/N6dbcsvwA "Haskell – Try It Online")
Iterates through the list, tracking the possible pairs `(u,d)` of the max of the increasing sequence and the min of the decreasing one. Each new element `x` replaces either `u` or `d`, which corresponds to it being append to that subsequence. It could be that both or neither options are valid. In the end, we check that the list of possibilities is nonempty.
The initial bounds `(0,9^6)` use that the problem specifies the numbers to be in the range 0 – 99999. A more general solution could do `(1/0,-1/0)` to makes `(-inf,inf)`.
]