For this Question: Given an array of N integers, your task is to find the maximum value of a given function F(i, j).

<b>F(i, j) = |Arr[i] - Arr[j]| + |i - j|</b>,The first line of input contains a single integer N, the next line of input contains N space- separated integers depicting the values of the array.

Constraints:-
1 <= N <= 100000
-100000 <= Arr[i] <= 100000Print a single integer containing the maximum value of the given function.Sample Input:-
3
1 3 -1

Sample Output:-
5

Explanation:-
f(1, 1) = f(2, 2) = f(3, 3) = 0
f(1, 2) = f(2, 1) = |1 - 3| + |1 - 2| = 3
f(1, 3) = f(3, 1) = |1 - (-1)| + |1 - 3| = 4
f(2, 3) = f(3, 2) = |3 - (-1)| + |2 - 3| = 5

Sample Input:-
4
1 2 3 4

Sample Output:-
6, I have written this Solution Code: 
#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 max1 100001
#define MOD 1000000007

#define read(type) readInt<type>()

#define out(x) cout<<x<<'\n'
#define out1(x) cout<<x<<" "
#define END cout<<'\n'
#define int long long
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
void fast(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}

int solve(int a[], int b[], int n){
 int ans[2402];
    for(int i=0;i<=2401;i++){
        ans[i]=0;
    }
    for(int i=0;i<n;i++){
        ans[a[i]]++;
        ans[b[i]+1]--;
    }
    int cnt=0;
    int res=0;
    for(int i=0;i<2401;i++){
        cnt+=ans[i];
        res=max(res,cnt);
    }
    return res;


}
signed main(){

    int n;
    cin>>n;
    int A[n],b[n];
    for(int i=0;i<n;i++){
        cin>>A[i];

    }
    int mx1=INT_MIN,mx2=INT_MIN,mn1=INT_MAX,mn2=INT_MAX;
for(int i=0;i<n;i++){
mx1=max(mx1,A[i]+i);
mx2=max(mx2,A[i]-i);
mn1=min(mn1,A[i]+i);
mn2=min(mn2,A[i]-i);
}
out(max(mx1-mn1,mx2-mn2));

}




, In this Programming Language: C++, Now tell me if this Code is compilable or not?