Language: C++

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define mod 1000000007
/* 
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
*/
struct BIT {
  private:
   vector<int> bit;
   int N;
 
  public:
   BIT(int size) {
     N = size;
     bit.resize(N + 1);
   }
 
   // 一点更新です
   void add(int a, int w) {
     for (int x = a; x <= N; x += x & -x) bit[x] += w;
   }
 
   // 1~Nまでの和を求める。
   int sum(int a) {
     int ret = 0;
     for (int x = a; x > 0; x -= x & -x) ret += bit[x];
     return ret;
   }
 };

int main(){
    ll n,k; cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0 ; i < n ; i++){
        cin >> a[i];
    }
     /* 
    for(int i = 1 ; i < k ; i++){
        for(int j = 0; j < n ; j++){
            a.push_back(a[j]);
        }
    }*/

    BIT bit(n);

    ll ans = 0;
    for(int j = 0; j < n ; j++){
        ans += (j-bit.sum(a[j]))%mod;
        bit.add(a[j],1);
    }

    ll res = 0;

    for(int i = 1; i <= k ; i++){
        res += (ans*i)%mod;
        res = res%mod;
    }
  
    cout << ans << endl;


    cout << res%mod << endl;

    return 0;
}#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define mod 1000000007
/* 
template< typename T >
struct BinaryIndexedTree {
  vector< T > data;

  BinaryIndexedTree(int sz) {
    data.assign(++sz, 0);
  }

  T sum(int k) {
    T ret = 0;
    for(++k; k > 0; k -= k & -k) ret += data[k];
    return (ret);
  }

  void add(int k, T x) {
    for(++k; k < data.size(); k += k & -k) data[k] += x;
  }
};
*/
struct BIT {
  private:
   vector<int> bit;
   int N;
 
  public:
   BIT(int size) {
     N = size;
     bit.resize(N + 1);
   }
 
   // 一点更新です
   void add(int a, int w) {
     for (int x = a; x <= N; x += x & -x) bit[x] += w;
   }
 
   // 1~Nまでの和を求める。
   int sum(int a) {
     int ret = 0;
     for (int x = a; x > 0; x -= x & -x) ret += bit[x];
     return ret;
   }
 };

int main(){
    ll n,k; cin >> n >> k;
    vector<ll> a(n);
    for(int i = 0 ; i < n ; i++){
        cin >> a[i];
    }
     /* 
    for(int i = 1 ; i < k ; i++){
        for(int j = 0; j < n ; j++){
            a.push_back(a[j]);
        }
    }*/

    BIT bit(n);

    ll ans = 0;
    for(int j = 0; j < n ; j++){
        ans += (j-bit.sum(a[j]))%mod;
        bit.add(a[j],1);
    }

    ll res = 0;

    for(int i = 1; i <= k ; i++){
        res += (ans*i)%mod;
        res = res%mod;
    }
  
    cout << ans << endl;


    cout << res%mod << endl;

    return 0;
}

Compiler output:
a.cc:84:2: error: stray '#' in program
   84 | }#include <bits/stdc++.h>
      |  ^
a.cc:84:3: error: 'include' does not name a type
   84 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:109:8: error: redefinition of 'struct BIT'
  109 | struct BIT {
      |        ^~~
a.cc:26:8: note: previous definition of 'struct BIT'
   26 | struct BIT {
      |        ^~~
a.cc:133:5: error: redefinition of 'int main()'
  133 | int main(){
      |     ^~~~
a.cc:50:5: note: 'int main()' previously defined here
   50 | int main(){
      |     ^~~~