Language: C++

/* 
	Author: ankrypt
*/
#include <bits/stdc++.h>

using namespace std;

const int MAX_LIMIT = 200005;
long long N;
long long arr[MAX_LIMIT];
int temp = -1;
long long temp1 = 1e10;
long long sum, sum1, sum2, sum3 = 0;

int main()
{
	scanf("%lld", &N);
	for(int i = 0; i < N; i++) {
		scanf("%lld", &arr[i]);
		if(arr[i] >= temp) {
			temp = arr[i];
		}
		
	}
	int b = temp - N;
	int c = arr[N - 1] - N;

	for(int i = 0; i < N; i++) {
		sum += abs(arr[i] - (b + (i + 1))); 
		sum1 += abs(arr[i] - (c + (i + 1)));
		// sum3 += abs(arr[i] - (temp1 + (i + 1)));
	}
	// cout << sum1 << " ";

	long long finalAns = min(sum, sum1);
	printf("%lld\n", finalAns);
	
	
	return 0;
}
/*
	Powered by Buggy Plugin
*/
/* 
	Author: ankrypt
*/
#include <bits/stdc++.h>

using namespace std;

const int MAX_LIMIT = 200005;
long long N;
long long arr[MAX_LIMIT];
int temp = -1;
long long temp1 = 1e10;
long long sum, sum1, sum2, sum3 = 0;

int main()
{
	scanf("%lld", &N);
	for(int i = 0; i < N; i++) {
		scanf("%lld", &arr[i]);
		if(arr[i] >= temp) {
			temp = arr[i];
		}
		
	}
	int b = temp - N;
	int c = arr[N - 1] - N;

	for(int i = 0; i < N; i++) {
		sum += abs(arr[i] - (b + (i + 1))); 
		sum1 += abs(arr[i] - (c + (i + 1)));
		// sum3 += abs(arr[i] - (temp1 + (i + 1)));
	}
	// cout << sum1 << " ";

	long long finalAns = min(sum, sum1);
	printf("%lld\n", finalAns);
	
	
	return 0;
}
/*
	Powered by Buggy Plugin
*/


Compiler output:
a.cc:51:11: error: redefinition of 'const int MAX_LIMIT'
   51 | const int MAX_LIMIT = 200005;
      |           ^~~~~~~~~
a.cc:8:11: note: 'const int MAX_LIMIT' previously defined here
    8 | const int MAX_LIMIT = 200005;
      |           ^~~~~~~~~
a.cc:52:11: error: redefinition of 'long long int N'
   52 | long long N;
      |           ^
a.cc:9:11: note: 'long long int N' previously declared here
    9 | long long N;
      |           ^
a.cc:53:11: error: redefinition of 'long long int arr [200005]'
   53 | long long arr[MAX_LIMIT];
      |           ^~~
a.cc:10:11: note: 'long long int arr [200005]' previously declared here
   10 | long long arr[MAX_LIMIT];
      |           ^~~
a.cc:54:5: error: redefinition of 'int temp'
   54 | int temp = -1;
      |     ^~~~
a.cc:11:5: note: 'int temp' previously defined here
   11 | int temp = -1;
      |     ^~~~
a.cc:55:11: error: redefinition of 'long long int temp1'
   55 | long long temp1 = 1e10;
      |           ^~~~~
a.cc:12:11: note: 'long long int temp1' previously defined here
   12 | long long temp1 = 1e10;
      |           ^~~~~
a.cc:56:11: error: redefinition of 'long long int sum'
   56 | long long sum, sum1, sum2, sum3 = 0;
      |           ^~~
a.cc:13:11: note: 'long long int sum' previously declared here
   13 | long long sum, sum1, sum2, sum3 = 0;
      |           ^~~
a.cc:56:16: error: redefinition of 'long long int sum1'
   56 | long long sum, sum1, sum2, sum3 = 0;
      |                ^~~~
a.cc:13:16: note: 'long long int sum1' previously declared here
   13 | long long sum, sum1, sum2, sum3 = 0;
      |                ^~~~
a.cc:56:22: error: redefinition of 'long long int sum2'
   56 | long long sum, sum1, sum2, sum3 = 0;
      |                      ^~~~
a.cc:13:22: note: 'long long int sum2' previously declared here
   13 | long long sum, sum1, sum2, sum3 = 0;
      |                      ^~~~
a.cc:56:28: error: redefinition of 'long long int sum3'
   56 | long long sum, sum1, sum2, sum3 = 0;
      |                            ^~~~
a.cc:13:28: note: 'long long int sum3' previously defined here
   13 | long long sum, sum1, sum2, sum3 = 0;
      |                            ^~~~
a.cc:58:5: error: redefinition of 'int main()'
   58 | int main()
      |     ^~~~
a.cc:15:5: note: 'int main()' previously defined here
   15 | int main()
      |     ^~~~