Here is the code. The link to the problem statement is https://www.codechef.com/problems/SUBINC

```
#include<iostream>
#include<stdio.h>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<set>
#include<vector>
#include<utility>
using namespace std;
int main() {
int t, n;
int ar[100004];
cin>>t;
while ( t-- ) {
cin>>n;
int lindex,rindex;
for ( int i = 0; i < n; i++ ) {
cin>>ar[i];
}
int res = n;
rindex = 0;
lindex = 0;
while ( ( rindex < (n-1) ) && lindex < (n-1) ) {
if ( ar[rindex] <= ar[rindex+1] ) {
rindex++;
}
else {
if ( lindex == rindex ) {
lindex++;
rindex++;
}
else {
int diff = rindex - lindex;
res += ( ( (diff) * (diff+1 ) ) / 2 );
lindex = rindex+1;
rindex = lindex;
}
}
}
if ( rindex == (n-1) ) {
if ( lindex < rindex) {
int diff = rindex - lindex;
res += ( ( (diff) * (diff+1 ) ) / 2 );
}
}
cout<<res<<endl;
}
return 0;
}
```