For this Question: Taro is super small, she has recently learned the skill of walking. She wants to walk on the road from l to r (l < r, l and r must be integers). She cannot walk over a cake.
The road starts from 1 and goes till n (both inclusive). There are m cakes placed on the road at coordinates a[1], a[2],..., a[m].
Please help Taro find the number of ways she can choose l, r. 
Note: She cannot choose l and r such that l <= a[i] <= r, for all values of i from 1 to m.The first line of the input contains two integers n, m.
The next line contains m integers, a[1], a[2], ..., a[m].

(There may be many cakes at the same location)

Constraints
1 <= n <= 2000
0 <= m <= 2000
1 <= a[i] <= nOutput a single integer, the number of distinct (l, r) pairs on which Taro can walk.Sample Input
7 2
3 7  

Sample Output
4

Explanation: The ways of choosing (l, r) pairs are (1, 2), (4, 5), (4, 6), (5, 6)., I have written this Solution Code: 
// author-Shivam gupta

#include <bits/stdc++.h>


using namespace std;

#define MEM(a, b) memset(a, (b), sizeof(a))

#define FOREACH(it, l) for (auto it = l.begin(); it != l.end(); it++)

#define IN(A, B, C) assert( B <= A && A <= C)

#define MP make_pair
#define FOR(i,a) for(int i=0;i<a;i++)

#define FOR1(i,j,a) for(int i=j;i<a;i++)

#define EB emplace_back

#define INF (int)1e9

#define EPS 1e-9

#define PI 3.1415926535897932384626433832795

#define MOD 1000000007
const int N = 3e5+5;

#define read(type) readInt<type>()
#define max1 100001
#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
const double pi=acos(-1.0);

typedef pair<int, int> PII;

typedef vector<int> VI;

typedef vector<string> VS;

typedef vector<PII> VII;

typedef vector<VI> VVI;

typedef map<int,int> MPII;

typedef set<int> SETI;

typedef multiset<int> MSETI;

typedef long int li;

typedef unsigned long int uli;

typedef long long int ll;

typedef unsigned long long int  ull;
const ll inf = 0x3f3f3f3f3f3f3f3f;
const ll mod = 998244353;
using vl = vector<ll>;

bool isPowerOfTwo (int x)
{
  /* First x in the below expression is
    for the case when x is 0 */
  return x && (!(x&(x-1)));
}
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
ll power(ll x, ll y, ll p)
{
    ll res = 1;      // Initialize result

    x = x % p;  // Update x if it is more than or
                // equal to p

    while (y > 0)
    {
        // If y is odd, multiply x with result
        if (y & 1)
            res = (res*x) % p;

        // y must be even now
        y = y>>1; // y = y/2
        x = (x*x) % p;
    }
    return res;
}

long long phi[max1], result[max1],F[max1];
// Precomputation of phi[] numbers. Refer below link
// for details : https://goo.gl/LUqdtY
void computeTotient()
{
    // Refer https://goo.gl/LUqdtY
    phi[1] = 1;
    for (int i=2; i<max1; i++)
    {
        if (!phi[i])
        {
            phi[i] = i-1;
            for (int j = (i<<1); j<max1; j+=i)
            {
                if (!phi[j])
                    phi[j] = j;

                phi[j] = (phi[j]/i)*(i-1);
            }
        }
    }
    for(int i=1;i<=100000;i++)
{
	for(int j=i;j<=100000;j+=i)
	{  int p=j/i;
	F[j]+=(i*phi[p])%mod;
         F[j]%=mod;

          }
}
}
int gcd(int a, int b, int& x, int& y) {
    if (b == 0) {
        x = 1;
        y = 0;
        return a;
    }
    int x1, y1;
    int d = gcd(b, a % b, x1, y1);
    x = y1;
    y = x1 - y1 * (a / b);
    return d;
}

bool find_any_solution(int a, int b, int c, int &x0, int &y0, int &g) {
    g = gcd(abs(a), abs(b), x0, y0);
    if (c % g) {
        return false;
    }

    x0 *= c / g;
    y0 *= c / g;
    if (a < 0) x0 = -x0;
    if (b < 0) y0 = -y0;
    return true;
}

int main() {

   int n,m;
   cin>>n>>m;
   int a[m+2];
   a[0]=0;
   a[m+1]=n+1;
   for(int i=1;i<=m;i++){
    cin>>a[i];
   }
   sort(a,a+m+2);
   int ans=0;
   for(int i=1;i<m+2;i++){
    if((a[i]-a[i-1])>=2){ans+=((a[i]-a[i-1]-1)*(a[i]-a[i-1]-2))/2;}
   }
   out(ans);
}
, In this Programming Language: C++, Now tell me if this Code is compilable or not?