Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <string>

#define repd(i,a,b) for (int i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
typedef long long ll;

using namespace std;


int inputValue(){
    int a;
    cin >> a;
    return a;
};

void inputArray(int * p, int a){
    rep(i, a){
        cin >> p[i];
    }
};

void inputVector(vector<int> * p, int a){
    rep(i, a){
        int input;
        cin >> input;
        p -> push_back(input);
    }
}

template <typename T>
void output(T a, int precision) {
    if(precision > 0){
        cout << setprecision(precision)  << a << "\n";
    }
    else{
        cout << a << "\n";
    }
}

int main(int argc, const char * argv[]) {
    
    // source code
  int n = inputValue();
  int k = inputValue();
  int[] a;
  int[n] init;
  int[n] dist;
  ll answer;
  ll div = 10*10*10*10*10*10*10*10*10 + 9;
  inputArray(*a,n);
  map<int,int> mapdict{};
  rep(i,n)
  {
    if(mapdict.count(i) == 0)
    {
      mapdict.emplace(i,1);
    }
    else
    {
      mapdict(i)++;
    }
  }
  rep(i,n)
  {
	repd(j,0,i)
    {
      if(a[i]<a[j])
      {
        init[i]++;
      }
    }
    for (const auto& [key, value] : mapdict){
      if(key < a[i])break;
      dist[i] += value;
    }
  }
  rep(i,n)
  {
    answer += init[i] + dist[i] * (k - 1);
    if(answer >= div)
    {
      answer = answer%div;
    }
  }
  
  
    return 0;
}

Compiler output:
a.cc: In function 'int main(int, const char**)':
a.cc:54:6: error: structured binding declaration cannot have type 'int'
   54 |   int[] a;
      |      ^~
a.cc:54:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:54:6: error: empty structured binding declaration
a.cc:54:9: error: expected initializer before 'a'
   54 |   int[] a;
      |         ^
a.cc:55:6: error: structured binding declaration cannot have type 'int'
   55 |   int[n] init;
      |      ^~~
a.cc:55:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:55:7: error: conflicting declaration 'auto n'
   55 |   int[n] init;
      |       ^
a.cc:52:7: note: previous declaration as 'int n'
   52 |   int n = inputValue();
      |       ^
a.cc:55:10: error: expected initializer before 'init'
   55 |   int[n] init;
      |          ^~~~
a.cc:56:6: error: structured binding declaration cannot have type 'int'
   56 |   int[n] dist;
      |      ^~~
a.cc:56:6: note: type must be cv-qualified 'auto' or reference to cv-qualified 'auto'
a.cc:56:7: error: conflicting declaration 'auto n'
   56 |   int[n] dist;
      |       ^
a.cc:52:7: note: previous declaration as 'int n'
   52 |   int n = inputValue();
      |       ^
a.cc:56:10: error: expected initializer before 'dist'
   56 |   int[n] dist;
      |          ^~~~
a.cc:59:15: error: 'a' was not declared in this scope
   59 |   inputArray(*a,n);
      |               ^
a.cc:60:3: error: 'map' was not declared in this scope
   60 |   map<int,int> mapdict{};
      |   ^~~
a.cc:10:1: note: 'std::map' is defined in header '<map>'; this is probably fixable by adding '#include <map>'
    9 | #include <stack>
  +++ |+#include <map>
   10 | #include <string>
a.cc:60:7: error: expected primary-expression before 'int'
   60 |   map<int,int> mapdict{};
      |       ^~~
a.cc:63:8: error: 'mapdict' was not declared in this scope
   63 |     if(mapdict.count(i) == 0)
      |        ^~~~~~~
a.cc:78:9: error: 'init' was not declared in this scope; did you mean 'int'?
   78 |         init[i]++;
      |         ^~~~
      |         int
a.cc:81:37: error: 'mapdict' was not declared in this scope
   81 |     for (const auto& [key, value] : mapdict){
      |                                     ^~~~~~~
a.cc:83:7: error: 'dist' was not declared in this scope
   83 |       dist[i] += value;
      |       ^~~~
a.cc:88:15: error: 'init' was not declared in this scope; did you mean 'int'?
   88 |     answer += init[i] + dist[i] * (k - 1);
      |               ^~~~
      |               int
a.cc:88:25: error: 'dist' was not declared in this scope
   88 |     answer += init[i] + dist[i] * (k - 1);
      |                         ^~~~