[Question]
  [
Consider a one-dimensional sequence of numbers within a fixed range, i.e.
```
[1, 2, 4, 6, 8, 0, 2, 7, 3] in range [0, 10⟩
```
The Ever-Increasing Graph\* \*\* is a line that connects all the points in this sequence left to right, and always goes upwards or stays level. If necessary, the line wraps around from top to bottom and continues going up from there to meet the next point. 
The goal of this challenge is to split the sequence in different subsequences that are all nondecreasing, so that when plotted together with a limited vertical axis they will form an Ever-Increasing Graph. This is done by adding an a point to the end of one subsequence and to the beginning of the next subsequence, so that the angle of the line that crosses the top boundary aligns with the line that crosses the bottom boundary, and the two crossing points have the same horizontal coordinate. The example above would give the following output:
```
[1, 2, 4, 6, 8, 10]
[-2, 0, 2, 7, 13]
[-3, 3]
```
And the corresponding graph will look as follows:
[![The Ever-Increasing Graph which should actually be called Ever Nondecreasing Graph](https://i.stack.imgur.com/cby5a.png)](https://i.stack.imgur.com/cby5a.png)
And with the axis extended for a better view:
[![Ever-Increasing Graph which should actually be called Ever Nondecreasing Graph with extended vertical axis.](https://i.stack.imgur.com/OqLqA.png)](https://i.stack.imgur.com/OqLqA.png)
The required output is a list of subsequences that form the parts of the Ever-Increasing Graph. Making a plot is not required but will earn you bonus points ;). The output must clearly separate the subsequences in some way. 
**Notes**
* The range will be always have zero as the left (inclusive) boundary, and the right boundary will be some integer N.
* The sequence will never contain values that are not within the range.
* The first subsequence does not have an additional point at the beginning.
* The last subsequence does not have an additional point at the end.
* It is not required to provide the starting indices that would be required to plot the subsequences.
**Test cases** 
```
Input: [0, 2, 4, 6, 1, 3, 5, 0], 7
Output: [0, 2, 4, 6, 8], [-1, 1, 3, 5, 7], [-2, 0]
Input: [1, 1, 2, 3, 5, 8, 3, 1], 10
Output: [1, 1, 2, 3, 5, 8, 13],[-2, 3, 11],[-7, 1]
Input: [5, 4, 3, 2, 1], 10
Output: [5, 14],[-5, 4, 13],[-6, 3, 12],[-7, 2, 11],[-8, 1]
Input: [0, 1, 4, 9, 16, 15, 0], 17
Output: [0, 1, 4, 9, 16, 32], [-1, 15, 17], [-2, 0]
```
**Scoring**
This is code-golf, the shortest code in bytes wins. 
\*Not actual jargon
\*\*Actually should be called Ever Non-Decreasing Graph, as @ngm pointed out, but that sounds less impressive. 
  
[Answer]
# [**R**](https://www.r-project.org/about.html), 179 158 151 bytes
```
function(s,m){p=1;t=c(which(diff(s)<0),length(s));for(i in t){d=c(s[p]-m,s[(p+1):i],s[i+1]+m);if(p==1)d[1]=s[1];if(p==t[-1])d=head(d,-1);print(d);p=i}}
```
[Try it online!](https://tio.run/##LYrBCsMgEER/xeMuUei2FEqNXyIeisa60BiJlh5Cvj2VUpgZ3gyzHnFUR3xn33jJUOWMWzGkm/HwSewTBI4RKo4nlK8pP1vqBXVcVmDBWTTcQv9WW5yaZbVQBsI7u448kBtm1ByhGEMYLDlTe/yXZhU5DCZNjwBBKkJdVs4NQgfD@35E8EBSdJ2luEhxleL2A8LuEx5f)
**Edit:** Code is now a function and takes input. (Thanks to Giuseppe, user202729 and JayCe for calmly pointing that out)  
**Edit:** -21 bytes suggested by Giuseppe.  
**Edit:** -7 bytes by removing `d=NULL;`.
[Answer]
# [Python 2](https://docs.python.org/2/), 60 bytes
Input is N, followed by all points as individual arguments. Subsequences in the output are seperated by `0.5`.
```
f=lambda N,k,*l:(k,)+(l and(l[0]+N,.5,k-N)*(l[0]<k)+f(N,*l))
```
[Try it online!](https://tio.run/##XY9BCoMwFET3nmKWif6WRGu1Uq@QC4gLi0hL0iiSTU@fxmBBupv582bgLx/3nG3u/dSa4f0YByjSlJqGaeIZMxjsyEwn@kzRuSR9UjyN/q55NjEVUM69Q4suAVgnCTnhQrgSaoKItiIUPUEKThESBygUCkIZ0EBUOyDjPf9FdRTyOFHGfhEh@bctY3YLYtvfp2XFkz5JpnmFISi8LFwTGsv6sg7bJwiv@C8 "Python 2 – Try It Online")
---
# [Python 2](https://docs.python.org/2/), ~~92~~ ~~77~~ 68 bytes
Subsequences are seperated by `[...]`.
```
l,N=input();r=[];k=0
for a in l:r+=[a+N,r,k-N]*(a<k)+[a];k=a
print r
```
[Try it online!](https://tio.run/##TYxNDoIwEIX3PcWEFT9j0oIIir0CF2hYNIihgRTSYKKnr20h0d2bee/71s82Ljq3/fIYeBRFdsaWK72@tjhpDBddM3FKnosBCUrDfDMZFzJr0eB0ars0lvcpyYT0O0lWo/QGxjoRIcN76MF709IKhpAjnBEuCDUCDWeFUHQIjBJB/3q3LRBKt3JlRTy74/u3DoEdYBmoIvTsJ2PhfXXBCw8Xq74 "Python 2 – Try It Online")
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), ~~279~~ ~~269~~ 258 bytes
```
import StdEnv
s=snd o unzip
$[]=[]
$l#(a,b)=span(uncurry(<))(zip2[-1:l]l)
=[s a: $(s b)]
?l n#[h:t]= $l
=[h:if(t>[])(?(map((+)n)(flatten t))n)t]
@l n#l= ?l n
=[[e-i*n\\e<-k]\\k<-[a++b++c\\a<-[[]:map(\u=[last u])l]&b<-l&c<-tl(map(\u=[hd u])l)++[[]]]&i<-[0..]]
```
[Try it online!](https://tio.run/##RZDLasMwEEX3@oqBmCDVUkj6BGM1WbSLQndZyrOQH2lEZNlYUiH9@LpKSunycO@5MNPYTru5H9poO@i1cbPpx2EKsA/tq/skXnrXwgDRfZmRZAqlQpLZBdW8ZtKP2tHomjhNZ1oyRlPpVolNYdEyIpUHXUBGPdQMydaCW6hjEVBCZlN6LMyBhmeFjG5pr0dKc@YYPVgdQucgsEQBye7iWQkXP1mqE@bGVVVXihNW1akUSud5nedNVekECovLVhWlstoHiMgsLutS2GVTimDpX3psrxnL8@QgLk2S16sV4rwPegpkAdYkX4Jac7jlcM/hkcOGwx2HBw5rTA0X@7qbUucpwSF9IpjBJdwR@Y/Xmd/m/N2k8z78LN7e55ez071p/A8 "Clean – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), ~~104~~ 82 bytes
```
n=>a=>a.map((e,i)=>e>a[s.push(e),++i]&&s.push(a[r.push(s=[e-n]),i]+n),r=[s=[]])&&r
```
[Try it online!](https://tio.run/##dY5NDsIgEEb3noIVgXTalNb6E0MvQliQSiqmQgPq9RGxXZhoMos3kzcz31U9VRi8me@ldWcdRx4t71Wq6qZmQjQYynvdKxGq@REuRFMoCiMxXnol/AcCF7q0koKRhaXguUgTKSnGPg7OBjfpanIjGcmeElEDagBtAe0AMUAtoA5QLSk9bb5lViebZalZvUMG9s/u8uE2L/yUlgAse8cE7xDr//gC "JavaScript (Node.js) – Try It Online") Port of @ovs's Python answer.
[Answer]
# Haskell, ~~82~~ ~~81~~ 80 bytes
This is a port of [my Clean answer](https://codegolf.stackexchange.com/a/165066/42682).
```
r!n|let f x(r@(a:_):s)|x>a=[x,n+a]:(x-n:r):s|y<-x:r=y:s=foldr f[[last r]]$init r
```
[Try it online!](https://tio.run/##HYhPC8IgHIa/yjvYwZGDraLiR0bXoFtHkRDamGQu1MjBvruNTs@fQYdnZ23OvnCz7SJ6JObPTNO9olDN6aSFTNyttCKWakd@2fN0rBN5MVEQ/WgfHr2UVocIr1RpnFkkv7RxEHh/4i36q0OJMIzfBbLlWHNsOXYcB47mn3uOjUIB1jYgwsXFKv8A "Haskell – Try It Online")
-1, -1 thanks to [Laikoni](https://codegolf.stackexchange.com/users/56433/laikoni)
[Answer]
# [Jelly](https://github.com/DennisMitchell/jelly), 20 bytes
```
⁹;+⁴,N¤j.x>ṭḷ
çƝF;Ṫ{
```
[Try it online!](https://tio.run/##y0rNyan8//9R405r7UeNW3T8Di3J0quwe7hz7cMd27kOLz8218364c5V1f///4821FEAIiMdBWMdBVMdBQswwzD2v6EBAA "Jelly – Try It Online")
Subsequences are splitted by `0.5`.
[Answer]
# [Clean](http://clean.cs.ru.nl), 92 bytes
```
import StdEnv
@r n=foldr(\x[r=:[a:_]:s]|x>a=[[x,n+a]:[x-n:r]:s]=[[x:r]:s])[[last r]](init r)
```
[Try it online!](https://tio.run/##JYw9C8IwFAB3f8UbW4zQqqgEIh10ENw6xiCPfkggeZUkSgR/u7HV7e6Ga0yHlOzQPkwHFjUlbe@DC1CH9kjPWeWARD@Y1mWXKJ3gEvlVca/ecY9CyshojorLuCDupj61P@VSGvQBnFKZJj1CnuqA41tABbJksGSwZrBhsGNQ/HTLYKWgLNKn6Q3efFqczunwIrS68V8 "Clean – Try It Online")
The operator argument to `foldr` is a lambda with guard; it is parsed as:
```
\x [r=:[a:_]:s]
    | x > a     = [[x,n+a]:[x-n:r]:s]
    | otherwise = [[x:run]:s]
```
I ported this [to Haskell](https://codegolf.stackexchange.com/a/165069/42682).
[Answer]
# [Clean](https://github.com/Ourous/curated-clean-linux), ~~110~~ ~~109~~ ~~104~~ ~~100~~ 97 bytes
```
import StdEnv
@[x:r]n=let$s=:[x:r]a|x<last a=[a++[n+x]: $s[last a-n]]= $r(a++[x]);$_ a=[a]in$r[x]
```
[Try it online!](https://tio.run/##JY2xCsIwFEV3v@INGZSm0KqoVAMddBDcOoYgj7ZKIHmVJEoEv92odTznHrit6ZGSHbq76cGipqTtbXABmtAd6DGpZaycImH6wLyoRsJX3Bn0AVBIzDJJWVQVMC//MielBDA3/W1RzbbsPJZKE3NfkZqA3wMBNciSw5zDksOKw4ZDMeKaw0JBWaR3ezF49Sk/ntL@SWh16z8 "Clean – Try It Online")
*-1 byte thanks to [Keelan](https://codegolf.stackexchange.com/users/42682/keelan)*
[Answer]
# [Haskell](https://www.haskell.org/), 82 bytes
```
(x:r)#n|let b@(a:_)%s@(x:r)|x<a=(n+x:b):[a-n]%s|c<-x:b=c%r;a%_=[a]=reverse<$>[x]%r
```
[Try it online!](https://tio.run/##ZY/taoMwFIb/exUH2oCyCCa21WVm9AbGLiCEkpbAymyQaIcwd@0uiXP98tfxnOc958mHaj91XY9j3DObLMxQ6w7221ixXYLabegOfaV4bJ56tk@YUKmRqB0OVer@@QHZF4V2XCjJrf7SttXV8lX0EtnxpI4GOJxU8waNPZoOlhCB@wSIDAPFsMKwwUAw5BjWGDIJCygCgkGQMKHzsAwF8QjJZmYdduQBuxtlIe6mz67wV@YDZLogo@g7jd7PXXPu2K1QKV0@JVdmRehQv@ESeRQkucQB86bE14X3ukQcRla@P4lP/Gbi6R9P52x5m71/UE7/Nf3aa8X0Z/wF "Haskell – Try It Online") Port of my [Clean answer](https://codegolf.stackexchange.com/a/165061/56433).
---
### Alternative, also 82 bytes
```
(x:r)#n|let a%s@(x:r)|x<last a=(a++[n+x]):[last a-n]%s|c<-a++[x]=c%r;a%_=[a]=[x]%r
```
[Try it online!](https://tio.run/##ZY/rasMwDIX/5ykEnaElMkRO22RZDXuBsQcwZphSaFlqQpJCYNmzZ74s62X@Jel8Rzo@mu7zUNfTtByqdrWwY33owbDuNfTjsKtN5wZyadJU2XTQq0rFEbeadeN@x70yaLln7YthH1IZLV3P2ulsThYknE3zBk17sj08QQLuKVAZgkBYI2wRCCFH2CBkGhZQBARBUVDELJahII9QNjObsCMP2IOUBbtTn13hr8wHKF7QSfLFk/dL31z66j5QqZ2f002yIkyE33C1/A9IucaA@aTk68LnulocRms/j8Ejv428@OXF7C3vvY8fysVfTL/2NiL/nn4A "Haskell – Try It Online")
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 98 bytes
```
a=>m=>(r=[],b=[],a.map((e,i)=>e<a[--i]?(b[p](m+e),r[p](b),b=[a[i]-m,e]):b[p='push'](e)),r[p](b),r)
```
[Try it online!](https://tio.run/##dc7JDoIwEAbgu0/RGzNxSiiIe/FBmh4KNohhC6ivj7TRmBi9TP5kvlmu5mHGYqj6G2@7s51KORmZNTKDQSpNuSsmbEwPYKlCmdmjUZxX@gS56jU0S4s0uJSj00ZVmjdkNe7nvgz6@3gJNFj8qAGnomvHrrZh3ZVQgoqIxcRWxNbEBLGEWEos0ggbxMPiCwtv4jfb@iBmLKIfOvV7Ez/wF0V@5ex2c3A/vM4Ld396Ag "JavaScript (Node.js) – Try It Online") This is quite a bit longer than the other JS answer, but it uses a different approach.
## Ungolfed and simplified explanation
```
g=(a,m)=>{
    // r is the final array of arrays to return.
    // b is the current subset of only ascending numbers.
    r=[],b=[];
    a.map((e,i)=>{
        if(e<a[i-1]){
            // if the current value is less than the previous one,
            // then we're descending, so start a new array b.
            // add the proper value to b to match slopes with the next
            b.push(m+e);
            // add r to b, and restart b with the starter value and the current value in a
            r.push(b);
            b=[a[i-1]-m,e];
        } else{
            // otherwise, we're ascending, so just addd to to b.
            b.push(e);
        }
    });
    r.push(b); // add the final b to r, and return r
    return r;
}
```
[Answer]
# [JavaScript (Node.js)](https://nodejs.org), 48 bytes, arrays separated by `,,`
```
s=>n=>s.map(r=t=>(t<r?[t+n,,r-n,,]:``)+(r=t))+``
```
[Try it online!](https://tio.run/##fc5NCsIwEAXgvaeYZUKnJWmt/6m7XqIUUmoRpSYlCV4/JkE3IsIwPJiP4d2H52BHc1tcrvRl8q3wVjRKNLZ4DAsxwomGuJM5dy5TiCYPqz9ISbN4ozST0o9aWT1PxayvpCUdQygR1ggbBI5QIdQIrKdkS@lx9YV5MuWH7VLgAXP2Q9fpb5Wm/ONY@hroPoRY492Axwr@BQ "JavaScript (Node.js) – Try It Online")
# [JavaScript (Node.js)](https://nodejs.org), 50 bytes, arrays separated by `|`
```
s=>n=>s.map(r=t=>(t<r?t+n+`|${r-n},`:``)+(r=t))+``
```
[Try it online!](https://tio.run/##fc5NCsIwEAXgvaeYhYuETEvSWv9Td72ECCm1iFKTkgQ36tljG3QjIsziwXw83qW@1a6x594n2hzbUMngZKll6dJr3RMrvSyJ39qdZ5qpx/RuE/1EtVaKsvFLKVMqNEY707VpZ06kInuOkCHMEOYIAiFHKBD4gZIFpZvJFxbRZB@2jEEMWPAfuoi9ebzsj@OxdaCrIYwz3gvEOCG8AA "JavaScript (Node.js) – Try It Online")
]