Language: Java

#include <bits/stdc++.h>
#include<algorithm>
#include<math.h>
#include<string>
#include<iostream>
#include <vector>
#include <cstdlib>
using namespace std;
 
template <class T> using V = vector<T>;

template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}

const long long INF = 1LL << 60;
 
using ll = long long;
using db = double;
using st = string;
using ch = char;
using bl = bool;
using vll = V<ll>;
using vpll =V<pair<ll,ll>>;
using vst = V<st>;
using vdb = V<db>;
using vch = V<ch>;
using vbl = V<bl>;
 
 
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
#define bgn begin()
#define en end()
#define SORT(a) sort((a).bgn,(a).en)
#define REV(a) reverse((a).bgn,(a).en)
#define M(a,b) max(a,b)
#define rM(a,b) min(a,b)
#define fi first
#define se second
#define sz size()
#define gcd(a,b) __gcd(a,b)
#define co(a) cout<<a<<endl;
#define ci(a) cin>>a;
 
 
ll sum(ll n) {
  ll m=0;
  FOR(i,0,20){
    m+=n%10;
    n/=10;
    if(n==0){
      break;
    }
  }
  return m;
}
 
 
ll combi(ll n,ll m) {
  ll ans=1;
  rFOR(i,n,n-m){
    ans*=i;
  }
  FOR(i,1,m+1){
    ans/=i;
  }
  return ans;
}
 
 
ll lcm(ll a,ll b){
  ll n;
  n=a/gcd(a,b)*b;
  return n;
}
 
 
/****************************************\
| Thank you for viewing my code:)        |
| Written by RedSpica a.k.a. RanseMirage |
| Twitter:@asakaakasaka                  | 
\****************************************/
 
 
signed main() {
  ll n;
  ci(n);
  vll A(n);
  FOR(i,0,n){
    ci(A[i]);
    A[i]-=i+1;
  }
  SORT(A);
  ll count=1;
  ll countA=0;
  ll b;
  FOR(i,1,n){
    if(A[i-1]==A[i]){
      count++;
    }
    else{
      if(countA<count){
        b=A[i-1];
        countA=count;
        count=1;
      }
    }
  }
  if(count<countA){
    countA=count;
    b=A[n-1];
  }
    ll sum=0;
    FOR(i,0,n){
      sum+=A[i];
    }
    if(countA==1){
      b=sum/2;
    }
    
    ll ans=0;
    FOR(i,0,n){
      ans+=abs(A[i]-b);
    }
    co(ans)
  }

Compiler output:
Main.java:1: error: illegal character: '#'
#include <bits/stdc++.h>
^
Main.java:1: error: class, interface, enum, or record expected
#include <bits/stdc++.h>
         ^
Main.java:2: error: illegal character: '#'
#include<algorithm>
^
Main.java:3: error: illegal character: '#'
#include<math.h>
^
Main.java:4: error: illegal character: '#'
#include<string>
^
Main.java:5: error: illegal character: '#'
#include<iostream>
^
Main.java:6: error: illegal character: '#'
#include <vector>
^
Main.java:7: error: illegal character: '#'
#include <cstdlib>
^
Main.java:10: error: class, interface, enum, or record expected
template <class T> using V = vector<T>;
^
Main.java:10: error: '{' expected
template <class T> using V = vector<T>;
                 ^
Main.java:10: error: class, interface, enum, or record expected
template <class T> using V = vector<T>;
                                   ^
Main.java:12: error: class, interface, enum, or record expected
template<class T> inline bool chmin(T& a, T b) {
^
Main.java:12: error: '{' expected
template<class T> inline bool chmin(T& a, T b) {
                ^
Main.java:13: error: illegal start of type
    if (a > b) {
    ^
Main.java:13: error: <identifier> expected
    if (a > b) {
         ^
Main.java:13: error: <identifier> expected
    if (a > b) {
             ^
Main.java:17: error: illegal start of type
    return false;
    ^
Main.java:19: error: class, interface, enum, or record expected
template<class T> inline bool chmax(T& a, T b) {
^
Main.java:19: error: '{' expected
template<class T> inline bool chmax(T& a, T b) {
                ^
Main.java:20: error: illegal start of type
    if (a < b) {
    ^
Main.java:20: error: > or ',' expected
    if (a < b) {
             ^
Main.java:24: error: illegal start of type
    return false;
    ^
Main.java:27: error: class, interface, enum, or record expected
const long long INF = 1LL << 60;
^
Main.java:29: error: unnamed classes are a preview feature and are disabled by default.
using ll = long long;
^
  (use --enable-preview to enable unnamed classes)
Main.java:29: error: '.class' expected
using ll = long long;
                ^
Main.java:30: error: '.class' expected
using db = double;
                 ^
Main.java:32: error: '.class' expected
using ch = char;
               ^
Main.java:34: error: illegal start of expression
using vll = V<ll>;
                 ^
Main.java:35: error: ';' expected
using vpll =V<pair<ll,ll>>;
                        ^
Main.java:36: error: illegal start of expression
using vst = V<st>;
                 ^
Main.java:37: error: illegal start of expression
using vdb = V<db>;
                 ^
Main.java:38: error: illegal start of expression
using vch = V<ch>;
                 ^
Main.java:42: error: illegal character: '#'
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
^
Main.java:42: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
        ^
Main.java:42: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
                                ^
Main.java:42: error: class, interface, enum, or record expected
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
                                      ^
Main.java:43: error: illegal character: '#'
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
^
Main.java:43: error: class, interface, enum, or record expected
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
                                 ^
Main.java:43: error: class, interface, enum, or record expected
#define rFOR(i,a,b) for(ll i=(a);i>(b);i--)
                                       ^
Main.java:44: error: illegal character: '#'
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
^
Main.java:44: error: class, interface, enum, or record expected
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
                                 ^
Main.java:44: error: class, interface, enum, or record expected
#define oFOR(i,a,b) for(ll i=(a);i<(b);i+=2)
                                       ^
Main.java:45: error: illegal character: '#'
#define bgn begin()
^
Main.java:46: error: illegal character: '#'
#define en end()
^
Main.java:47: error: illegal character: '#'
#define SORT(a) sort((a).bgn,(a).en)
^
Main.java:48: error: illegal character: '#'
#define REV(a) reverse((a).bgn,(a).en)
^
Main.java:49: error: illegal character: '#'
#define M(a,b) max(a,b)
^
Main.java:50: error: illegal character: '#'
#define rM(a,b) min(a,b)
^
Main.java:51: error: illegal character: '#'
#define fi first
^
Main.java:52: error: illegal character: '#'
#define se second
^
Main.java:53: error: illegal character: '#'
#define sz size()
^
Main.java:54: error: illegal character: '#'
#define gcd(a,b) __gcd(a,b)
^
Main.java:55: error: illegal character: '#'
#define co(a) cout<<a<<endl;
^
Main.java:56: error: illegal character: '#'
#define ci(a) cin>>a;
^
Main.java:56: error: class, interface, enum, or record expected
#define ci(a) cin>>a;
        ^
Main.java:61: error: ';' expected
  FOR(i,0,20){
             ^
Main.java:74: error: ';' expected
  rFOR(i,n,n-m){
               ^
Main.java:77: error: ';' expected
  FOR(i,1,m+1){
              ^
Main.java:101: error: not a statement
  vll A(n);
        ^
Main.java:101: error: ';' expected
  vll A(n);
       ^
Main.java:101: error: ';' expected
  vll A(n);
         ^
Main.java:102: error: ';' expected
  FOR(i,0,n){
            ^
Main.java:110: error: ';' expected
  FOR(i,1,n){
            ^
Main.java:127: error: ';' expected
    FOR(i,0,n){
              ^
Main.java:135: error: ';' expected
    FOR(i,0,n){
              ^
Main.java:138: error: ';' expected
    co(ans)
           ^
66 errors