criyle/codenet-compile-errors huggingface dataset:
Language: C++

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const ll MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

struct fenwick_tree {
  typedef ll T;
  T n;
  vector<T> bit;

  // 各要素の初期値は 0
  fenwick_tree(T num) : bit(num+1, 0) { n = num; }

  // a_i += w
  void add(T i, T w) {
    for (T x = i; x <= n; x += x & -x) {
      bit[x] += w;
    }
  }
  // [1, i] の和を計算.
  T sum(T i) {
    T ret = 0;
    for (T x = i; x > 0; x -= x & -x) {
    ret += bit[x];
    }
    return ret;
  }
  // [left+1, right] の和を計算.
  T sum(T left, T right) {
    return sum(right) - sum(left);
  }
};

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll N,K;
  cin>>N>>K;
  fenwick_tree f_tree(ll(N));
  vector<ll>A(N);
  REP(i,N)cin>>A[i];
  ll ans=0ll;
  REP(j,N){
    ans+=j-f_tree.sum(A[j]);
    f_tree.add(A[j], 1ll);
  }
  ans*=K;
  ans%=MOD;

  vector<ll>cnt(N);
  sort(ALL(A));
  cnt[0]=0;
  ll tmp=0;
  REP(i,N-1){
    tmp++;
    if(A[i+1]!=A[i]){
      cnt[i+1]=cnt[i]+tmp;
      tmp=0;
    }else{
      cnt[i+1]=cnt[i];
    }
  }
  ll sum = accumulate(ALL(cnt),0ll);
  ans+=sum*K%MOD*(K-1)%MOD*modinv(2ll,MOD)%MOD;
  ans%=MOD;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:22: warning: parentheses were disambiguated as a function declaration [-Wvexing-parse]
   70 |   fenwick_tree f_tree(ll(N));
      |                      ^~~~~~~
a.cc:70:22: note: replace parentheses with braces to declare a variable
   70 |   fenwick_tree f_tree(ll(N));
      |                      ^~~~~~~
      |                      -
      |                      {     -
      |                            }
a.cc:75:19: error: request for member 'sum' in 'f_tree', which is of non-class type 'fenwick_tree(ll)' {aka 'fenwick_tree(long long int)'}
   75 |     ans+=j-f_tree.sum(A[j]);
      |                   ^~~
a.cc:76:12: error: request for member 'add' in 'f_tree', which is of non-class type 'fenwick_tree(ll)' {aka 'fenwick_tree(long long int)'}
   76 |     f_tree.add(A[j], 1ll);
      |            ^~~
Language: C++

#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
using ll = long long;
const ll mod = 1e9+7;
int main() 
{
    int n, k;
    cin >> n >> k;
    int a[2010] = {};
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }

    int cntl[2010] = {};
    int cntr[2010] = {};
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < i; j++)
        {
            if (a[i] < a[j]) cntl[i]++;
        }
        for (int j = i+1; j < n; j++)
        {
            if (a[i] < a[j]) cntr[i]++;
        }
        
    }

    ll ans = 0;
   for (int i = 0; i < n; i++)
        {
            ans = (ans + k%mod*(2*cntl[i]+(k-1)%mod*(cntl[i]+cntr[i])/2)%mod)) % mod;
        }
    
    
    cout << ans << "\n";
    
    
    
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:78: error: expected ';' before ')' token
   34 |             ans = (ans + k%mod*(2*cntl[i]+(k-1)%mod*(cntl[i]+cntr[i])/2)%mod)) % mod;
      |                                                                              ^
      |                                                                              ;
Language: C++

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

signed main()
{
    int n, k;
    cin >> n >> k;
    vector<int> v(n);
    for (int i = 0; i < n; ++i) {
        cin >> v.at(i);
    }
    vector<int> sum(n);
    vector<int> sum2(n);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < n; ++j) {
            if (v[i] < v[j]) {
                if (i > j)
                    sum[i]++;
                else if (i < j)
                    sum2[i]++;
            }
        }
    }
    int result = 0;
    int com1 = (k * (k + 1) / 2) % MOD;
    int com2 = (k * (k - 1) / 2) % MOD;
    for (int i = 0; i < n; ++i) {
        result += (sum[i] * com1 + sum2[i] * com210 998244353
        10 9 8 7 5 6 3 4 2 1
        ) % MOD;
    }
    cout << result % MOD<< "\n";
}

Compiler output:
a.cc: In function 'int main()':
a.cc:31:46: error: 'com210' was not declared in this scope; did you mean 'com2'?
   31 |         result += (sum[i] * com1 + sum2[i] * com210 998244353
      |                                              ^~~~~~
      |                                              com2
a.cc:31:52: error: expected ')' before numeric constant
   31 |         result += (sum[i] * com1 + sum2[i] * com210 998244353
      |                   ~                                ^~~~~~~~~~
      |                                                    )
Language: C++

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
 
template < typename T > using index_set = tree < T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update >;
template < typename T > using MinPriorityQueue = priority_queue < T, vector < T >, greater < T > >;

#define pb push_back
#define po pop_back
#define mp make_pair
#define mt make_tuple
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define unique_sort(x) sort(all(x)), x.resize(distance(x.begin(), unique(all(x))))
#define all(c) c.begin(),c.end()
#define str string
#define edl "\n"
#define add insert
#define cot continue
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)


const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;
const double PI = acos(-1);
const ll LINF = LLONG_MAX;

int main() 
{

  #endif
    fast();
      

    ll n,k;
    cin>>n>>k;
    vec q(n);
    f(i,0,n)
    {
      cin>>q[i];
    }
    ll array[n]={0};
    f(i,0,n)
    {
      f(j,i+1,n)
      {
        if(q[i]>q[j])
        {
          array[i]++;
        }
      }
    }
    ll array1[n]={0};
    f(i,0,n)
    {
      f(j,0,n)
      {
        if(i!=j&&q[i]>q[j])
        {
          array1[i]++;
        }
      }
    }
    

    // f(i,0,n)
    // {
    //   cout<<array[i]<<edl;
    // }
    ll s=0;
    f(i,0,n)
    {
      s=(s%MOD+array[i]%MOD*k%MOD)%MOD;
      s%=MOD;
      
      s=(s%MOD+(((k*(k-1))/2)%MOD*array1[i])%MOD)%MOD;
      


    }
    cout<<(s)%MOD<<edl;
  

    cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}


Compiler output:
a.cc:39:4: error: #endif without #if
   39 |   #endif
      |    ^~~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const ll MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

struct fenwick_tree {
  typedef int T;
  T n;
  vector<T> bit;

  // 各要素の初期値は 0
  fenwick_tree(T num) : bit(num+1, 0) { n = num; }

  // a_i += w
  void add(T i, T w) {
    for (T x = i; x <= n; x += x & -x) {
      bit[x] += w;
    }
  }
  // [1, i] の和を計算.
  T sum(T i) {
    T ret = 0;
    for (T x = i; x > 0; x -= x & -x) {
    ret += bit[x];
    }
    return ret;
  }
  // [left+1, right] の和を計算.
  T sum(T left, T right) {
    return sum(right) - sum(left);
  }
};

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll N,K;
  cin>>N>>K;
  fenwick_tree<ll> f_tree(N);
  vector<ll>A(N);
  REP(i,N)cin>>A[i];
  ll ans=0ll;
  REP(j,N){
    ans+=j-f_tree.sum(A[j]);
    f_tree.add(A[j], 1);
  }
  ans*=K;
  ans%=MOD;

  vector<ll>cnt(N);
  sort(ALL(A));
  cnt[0]=0;
  ll tmp=0;
  REP(i,N-1){
    tmp++;
    if(A[i+1]!=A[i]){
      cnt[i+1]=cnt[i]+tmp;
      tmp=0;
    }else{
      cnt[i+1]=cnt[i];
    }
  }
  ll sum = accumulate(ALL(cnt),0ll);
  ans+=sum*K%MOD*(K-1)%MOD*modinv(2ll,MOD)%MOD;
  ans%=MOD;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:3: error: 'fenwick_tree' is not a template
   70 |   fenwick_tree<ll> f_tree(N);
      |   ^~~~~~~~~~~~
Language: C++

#include <iostream>
#include <iomanip>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <numeric>
#include <random>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

const int INF = (1 << 30) - 1;
const ll INFLL= (1LL << 61) - 1;
const int MOD = 1000000007;
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

struct fenwick_tree {
  typedef int T;
  T n;
  vector<T> bit;

  // 各要素の初期値は 0
  fenwick_tree(T num) : bit(num+1, 0) { n = num; }

  // a_i += w
  void add(T i, T w) {
    for (T x = i; x <= n; x += x & -x) {
      bit[x] += w;
    }
  }
  // [1, i] の和を計算.
  T sum(T i) {
    T ret = 0;
    for (T x = i; x > 0; x -= x & -x) {
    ret += bit[x];
    }
    return ret;
  }
  // [left+1, right] の和を計算.
  T sum(T left, T right) {
    return sum(right) - sum(left);
  }
};

long long modinv(long long a, long long m) {
    long long b = m, u = 1, v = 0;
    while (b) {
        long long t = a / b;
        a -= t * b; swap(a, b);
        u -= t * v; swap(u, v);
    }
    u %= m;
    if (u < 0) u += m;
    return u;
}

int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  ll N,K;
  cin>>N>>K;
  fenwick_tree<ll> f_tree(N);
  vector<ll>A(N);
  REP(i,N)cin>>A[i];
  ll ans=0ll;
  REP(j,N){
    ans+=j-f_tree.sum(A[j]);
    f_tree.add(A[j], 1);
  }
  ans*=K;
  ans%=MOD;

  vector<ll>cnt(N);
  sort(ALL(A));
  cnt[0]=0;
  ll tmp=0;
  REP(i,N-1){
    tmp++;
    if(A[i+1]!=A[i]){
      cnt[i+1]=cnt[i]+tmp;
      tmp=0;
    }else{
      cnt[i+1]=cnt[i];
    }
  }
  ll sum = accumulate(ALL(cnt),0ll);
  ans+=sum*K%MOD*(K-1)%MOD*modinv(2ll,MOD)%MOD;
  ans%=MOD;
  cout<<ans<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:70:3: error: 'fenwick_tree' is not a template
   70 |   fenwick_tree<ll> f_tree(N);
      |   ^~~~~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define hell 1000000007
#define fast ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pb push_back
#define ll long long int
#define pi 3.1415926536
using namespace std;

ll merge(vector<ll> &v,ll l,ll m,ll r)
{
	ll n1=m-l+1;
	ll n2=r-m;
	ll inv=0;
	vector<ll> a(n1),b(n2);
	for(ll i=0;i<n1;i++)
	a[i]=v[l+i];
	for(ll i=0;i<n2;i++)
	b[i]=v[m+1+i];
	ll i=0,j=0,k=l;
	while(i<n1&&j<n2)
	{
		if(a[i]<=b[j])
		{  
			v[k]=a[i];
			i++;
		}
		else
		{   inv+=(n1-i);
			v[k]=b[j];
			j++;
		}
		k++;
	}
	while(i<n1)
	{   
		v[k]=a[i];
		i++;
		k++;
	}
	while(j<n2)
	{   
		v[k]=b[j];
		j++;
		k++;
	}
	return inv;
}
ll mergesort(vector<ll> &v,ll l,ll r)
{  ll inv=0;
	if(l<r)
	{
		ll m=l+(r-l)/2;
		inv=mergesort(v,l,m);
		inv+=mergesort(v,m+1,r);
		inv+=merge(v,l,m,r);
	}
	return inv;
}
void solve()
{ll t,n,k,x,y,z,d=1,p,q,l=INT_MAX,mini=0,prev;
  cin>>n>>k;
  vector<ll> a(n),b(3); 
  for(ll i=0;i<n;i++)
  cin>>a[i];
  
  while(d<=min(3LL,k))
  {
   vector<ll> v(d*n);
   for(ll i=0;i<n;i++)
   v[i]=a[i];
  for(ll i=n;i<d*n;i++)
  v[i]=v[i-n];
  b[d-1]=mergesort(v,0,d*n-1);
  d++;
 }
  if(k<3)
  cout<<b[k-1];
  else
  {
  	d=b[1]-b[0];
  	x=(b[2]-b[1])-(b[1]-b[0]);
  	ll ans=b[0];
  	for(ll i=2;i<=k;i++)
  	{
  		ans=((ans%hell)+(d%hell))%hell;
  		d+=x
	}
	cout<<ans;
  }
}
 
int main()
{
  fast
ll t=1;
 
while(t--)
{solve();
 //cout<<ma<<endl;
}
return 0;}

Compiler output:
a.cc: In function 'void solve()':
a.cc:86:21: error: expected ';' before '}' token
   86 |                 d+=x
      |                     ^
      |                     ;
   87 |         }
      |         ~
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, f) for (int i = (a); i < (f); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

cpp_int M = 1000000007;
typedef pair<int, int> P;

bool ps1(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first昇順
	return forall_a_in_P.first < forall_b_in_P.first;
}
bool ps2(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first降順
	return forall_a_in_P.first > forall_b_in_P.first;
}
bool ps3(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second昇順
	return forall_a_in_P.second < forall_b_in_P.second;
}
bool ps4(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second降順
	return forall_a_in_P.second > forall_b_in_P.second;
}
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}
int GCD(int x, int y)
{
	return x ? GCD(y % x, x) : y;
}


template <typename Abel> struct BIT {
    const Abel UNITY_SUM = 0;
    vector<Abel> dat;
    BIT(int n) : dat(n + 1, UNITY_SUM) { }  // [1, n]
    inline void add(int i, Abel x) {
        while (i < dat.size()) { dat[i] += x; i += i & -i; }
    }
    inline Abel sum(int i) {    // [1, i]
        Abel res = UNITY_SUM;
        while (i > 0) { res += dat[i]; i -= i & -i; }
        return res;
    }
    inline Abel sum(int a, int b) { return sum(b - 1) - sum(a - 1); }   // [a, b)
    /* debug */
    Abel operator[](int i) { return sum(i, i + 1); }
    void debug() {
        for (int i = 1; i < dat.size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

template<typename T> cpp_int inversion_number(const vector<T> &a) {
    int n = a.size();
    vector<T> b = a;
    sort(begin(b), end(b)); b.erase(unique(begin(b), end(b)), end(b));
    long long res = 0;
    BIT<int> bit(n);
    for (T ai: a) {
        int order = lower_bound(begin(b), end(b), ai) - begin(b) + 1;
        res += bit.sum(order + 1, n + 1); bit.add(order, 1);
    }
    return res;
}
int main(){
    cpp_int n,k;
    cin>>n>>k;
    vector<cpp_int>a(n);
    rep(i,n){
        cin>>a[i];
    }

    cpp_int tmp=(cpp_int)k*(k+1)/2%M;
    cpp_int t=(cpp_int)inversion_number(a)*tmp%M;
    t%=M;
    cout<<t<<endl;
}


Compiler output:
a.cc:18:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   18 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, f) for (int i = (a); i < (f); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

cpp_int M = 1000000007;
typedef pair<int, int> P;

bool ps1(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first昇順
	return forall_a_in_P.first < forall_b_in_P.first;
}
bool ps2(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first降順
	return forall_a_in_P.first > forall_b_in_P.first;
}
bool ps3(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second昇順
	return forall_a_in_P.second < forall_b_in_P.second;
}
bool ps4(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second降順
	return forall_a_in_P.second > forall_b_in_P.second;
}
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}
int GCD(int x, int y)
{
	return x ? GCD(y % x, x) : y;
}


template <typename Abel> struct BIT {
    const Abel UNITY_SUM = 0;
    vector<Abel> dat;
    BIT(int n) : dat(n + 1, UNITY_SUM) { }  // [1, n]
    inline void add(int i, Abel x) {
        while (i < dat.size()) { dat[i] += x; i += i & -i; }
    }
    inline Abel sum(int i) {    // [1, i]
        Abel res = UNITY_SUM;
        while (i > 0) { res += dat[i]; i -= i & -i; }
        return res;
    }
    inline Abel sum(int a, int b) { return sum(b - 1) - sum(a - 1); }   // [a, b)
    /* debug */
    Abel operator[](int i) { return sum(i, i + 1); }
    void debug() {
        for (int i = 1; i < dat.size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

template<typename T> long long inversion_number(const vector<T> &a) {
    int n = a.size();
    vector<T> b = a;
    sort(begin(b), end(b)); b.erase(unique(begin(b), end(b)), end(b));
    long long res = 0;
    BIT<int> bit(n);
    for (T ai: a) {
        int order = lower_bound(begin(b), end(b), ai) - begin(b) + 1;
        res += bit.sum(order + 1, n + 1); bit.add(order, 1);
    }
    return res;
}
int main(){
    cpp_int n,k;
    cin>>n>>k;
    vector<cpp_int>a(n);
    rep(i,n){
        cin>>a[i];
    }

    cpp_int tmp=(cpp_int)k*(k+1)/2%M;
    //cout<<tmp<<endl;
    cpp_int t=(cpp_int)inversion_number(a)*tmp%M;
    t%=M;
    cout<<t<<endl;
}


Compiler output:
a.cc:18:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   18 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <stdio.h>

#define a 1000000007

void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}

int main(){
    long long N,K;
    int counta=0;
    long long ans=0;
    scanf("%d%d",&N,&K);
    int A[N],count[N];
    for(int i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    quick_sort(*A,0,N-1);
    for(int i=0;i<N;i++){
            if(A[i]==A[i+1]){
                count[counta]++;
            }else{
                counta++;
            }
    }
    long long eq=0;
    for(int i=0;i<counta;i++){
        eq=eq+(count[i]*count[i])%a;
    }
    ans=(N*N)%a-eq;
    ans=(K*(K-1)%a/2*ans%a)%a;
    printf("%lld",ans);
    
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:56:16: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   56 |     quick_sort(*A,0,N-1);
      |                ^~
      |                |
      |                int
a.cc:37:22: note:   initializing argument 1 of 'void quick_sort(int*, int, int)'
   37 | void quick_sort (int array[], int left, int right) {
      |                  ~~~~^~~~~~~
Language: Java

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

int main() {
  long N,K;
  cin >> N >> K;
  vector<long> vec(N);
  long X = 0;
  
  for(long i=0;i<N;i++){
   cin >> vec.at(i);
  }
  
  for(long i=0;i<N;i++){
    for(long T=0;T<N-i;T++){
      if( vec.at(i) > vec.at(i+T) ){
        X += K*(K+1)/2;
      }
    }
  }
  
  long V = X%1000000007;
  
  cout << V << endl;
  
}

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:6: error: not a statement
  cin >> N >> K;
           ^
Main.java:7: error: not a statement
  vector<long> vec(N);
                   ^
Main.java:11: error: not a statement
   cin >> vec.at(i);
       ^
Main.java:24: error: not a statement
  cout << V << endl;
            ^
Main.java:4: error: unnamed classes are a preview feature and are disabled by default.
int main() {
^
  (use --enable-preview to enable unnamed classes)
Main.java:7: error: ';' expected
  vector<long> vec(N);
                  ^
Main.java:7: error: ';' expected
  vector<long> vec(N);
                    ^
9 errors
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, f) for (int i = (a); i < (f); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using ll = long long;
using namespace std;

cpp_int M = 1000000007;
typedef pair<int, int> P;

bool ps1(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first昇順
	return forall_a_in_P.first < forall_b_in_P.first;
}
bool ps2(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first降順
	return forall_a_in_P.first > forall_b_in_P.first;
}
bool ps3(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second昇順
	return forall_a_in_P.second < forall_b_in_P.second;
}
bool ps4(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second降順
	return forall_a_in_P.second > forall_b_in_P.second;
}
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}
int GCD(int x, int y)
{
	return x ? GCD(y % x, x) : y;
}


template <typename Abel> struct BIT {
    const Abel UNITY_SUM = 0;
    vector<Abel> dat;
    BIT(int n) : dat(n + 1, UNITY_SUM) { }  // [1, n]
    inline void add(int i, Abel x) {
        while (i < dat.size()) { dat[i] += x; i += i & -i; }
    }
    inline Abel sum(int i) {    // [1, i]
        Abel res = UNITY_SUM;
        while (i > 0) { res += dat[i]; i -= i & -i; }
        return res;
    }
    inline Abel sum(int a, int b) { return sum(b - 1) - sum(a - 1); }   // [a, b)
    /* debug */
    Abel operator[](int i) { return sum(i, i + 1); }
    void debug() {
        for (int i = 1; i < dat.size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

template<typename T> long long inversion_number(const vector<T> &a) {
    int n = a.size();
    vector<T> b = a;
    sort(begin(b), end(b)); b.erase(unique(begin(b), end(b)), end(b));
    long long res = 0;
    BIT<int> bit(n);
    for (T ai: a) {
        int order = lower_bound(begin(b), end(b), ai) - begin(b) + 1;
        res += bit.sum(order + 1, n + 1); bit.add(order, 1);
    }
    return res;
}
int main(){
    cpp_int n,k;
    cin>>n>>k;
    vector<int>a(n);
    rep(i,n){
        cin>>a[i];
    }

    cpp_int tmp=(cpp_int)k*(k+1)/2%M;
    //cout<<tmp<<endl;
    cpp_int t=(cpp_int)inversion_number(a)*tmp%M;
    t%=M;
    cout<<t<<endl;
}


Compiler output:
a.cc:18:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   18 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C

#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#define mod 1000000007

void swap (int *x, int *y) {
  int temp;    // 値を一時保存する変数

  temp = *x;
  *x = *y;
  *y = temp;
}

/***
* pivotを決め、
* 全データをpivotを境目に振り分け、
* pivotの添え字を返す
***/
int partition (int array[], int left, int right) {
  int i, j, pivot;
  i = left;
  j = right + 1;
  pivot = left;   // 先頭要素をpivotとする

  do {
    do { i++; } while (array[i] < array[pivot]);
    do { j--; } while (array[pivot] < array[j]);
    // pivotより小さいものを左へ、大きいものを右へ
    if (i < j) { swap(&array[i], &array[j]); }
  } while (i < j);

  swap(&array[pivot], &array[j]);   //pivotを更新

  return j;
}

/* クイックソート */
void quick_sort (int array[], int left, int right) {
  int pivot;

  if (left < right) {
    pivot = partition(array, left, right);
    quick_sort(array, left, pivot-1);   // pivotを境に再帰的にクイックソート
    quick_sort(array, pivot+1, right);
  }
}

int main(void){
    int N,K,*a,i,j,k,s;
    long long int c=0,d=0,t;
    scanf("%d %d",&N,&K);
    a = malloc(sizeof(int)*N);
    for(i=0;i<N;i++){
        scanf("%d",&a[i]);
    }
    for(i=0;i<N;i++){
        for(j=i;j<N;j++){
            if(a[i] > a[j]) c++;
        }
    }
    quick_sort(a,0,N-1);
    for(i=0;i<N;i++){
        s = 0;
        k = 1;
        d += N - i - 1;
        while(i+k<N && s == 0){
            if(a[i] == a[i+k]){
                k++;
                d--;
            }else{
                s = 1;
            }
        }
    }
    c = c*K %mod;
    d = d*K*(K-1)/2 % mod
    t = (c + d) % mod;
    printf("%lld",t);
    return 0;
}

Compiler output:
main.c: In function 'main':
main.c:77:5: error: expected ';' before 't'
   77 |     t = (c + d) % mod;
      |     ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
//#define int ll
typedef vector<vector<pair<int, int> > > vvp;
typedef vector<pair<int, int> > vp;
typedef vector<vector<int> > vvi;
typedef vector<int> vi;
typedef vector<vector<ll> > vvl;
typedef vector<ll> vl;
typedef vector<vector<bool> > vvb;
typedef vector<bool> vb;
typedef vector<string> vs;
typedef pair<string, int> psi;
typedef pair<int, int> pii;

struct node {
	int x;
	int y;
};
typedef vector<node> vn;

#define rep(i,s,n) for(int i = (s); i < (n); i++)
#define all(x) (x).begin(), (x).end()
#define yn(f) (f?"yes":"no")
#define YN(f) (f?"YES":"NO")
#define Yn(f) (f?"Yes":"No")
#define puts(s) cout<<(s)<<endl
#define len(x) int(x.size())
#define inf (1000000007)
#define ll_inf (1000000000000000007)
#define nil -1

class disjoint_set {
public:
	vi p, rank;
	disjoint_set(int size) {
		p.resize(size, 0);
		rank.resize(size, 0);
		for (int i = 0; i < size; i++)makeSet(i);
	}
	void makeSet(int x) {
		p[x] = x;
		rank[x] = 0;
	}
	bool same(int x, int y) {
		return findSet(x) == findSet(y);
	}
	void unite(int x, int y) {
		link(findSet(x), findSet(y));
	}
	void link(int x, int y) {
		if (rank[x] < rank[y]) {
			p[x] = y;
		}
		else {
			p[y] = x;
			if (rank[x] == rank[y]) {
				rank[x]++;
			}
		}
	}
	int findSet(int x) {
		if (x != p[x]) {
			p[x] = findSet(p[x]);
		}
		return p[x];
	}
};
void space_endl(int i, int n) {
	if (i == n) {
		cout << endl;
	}
	else {
		cout << " ";
	}
}
int gcd(int a, int b) {
	return (b == 0) ? a : gcd(b, a % b);
}
int lcm(int a, int b) {
	return (a * b) / gcd(a, b);
}
int extgcd(int a, int b, int& x, int& y) {
	int d = a;
	if (b == 0) {
		x = 1;
		y = 0;
	}
	else {
		d = extgcd(b, a % b, y, x);
		y -= (a / b) * x;
	}
	return d;
}
vi get_primes(int limit) {
	vb A(limit + 1, true);
	for (int i = 2; i < A.size(); i++) {
		if (!A[i])continue;
		for (int j = i * 2; j < A.size(); j += i)A[j] = false;
	}
	vi B;
	for (int i = 2; i < A.size(); i++)
	{
		if (A[i])B.push_back(i);
	}
	return B;
}
bool is_prime(int num) {
	if (num < 2)return false;
	for (int i = 2; i <= sqrt(num); i++)
	{
		if (num % i == 0) {
			return false;
		}
	}
	return true;
}

int bs(vi A) {
	int count = 0;
	rep(i, 0, A.size()) {
		for (int j = A.size()-1; j >= i; j--)
		{
			if (A[j]<A[i]) {
				swap(A[i],A[j]);
				count++;
			}
		}
		count = count % inf;
	}
	return count%inf;
}
signed main() {
	int N, K;
	cin >> N >> K;
	vi A(N);
	rep(i, 0, N)cin >> A[i];
	int count_a = bs(A);
	vi A2(N*2);
	A2.insert(A2.end(), A.begin(), A.end());
	A2.insert(A2.end(), A.begin(), A.end());
	int count_a2 = bs(A2);
	int num = count_a2 - count_a;
	puts((count_a+(1/2)(1+A.size()*A.size())*num)%inf);

}


Compiler output:
a.cc: In function 'int main()':
a.cc:146:28: error: expression cannot be used as a function
  146 |         puts((count_a+(1/2)(1+A.size()*A.size())*num)%inf);
      |                       ~~~~~^~~~~~~~~~~~~~~~~~~~~
a.cc:29:24: note: in definition of macro 'puts'
   29 | #define puts(s) cout<<(s)<<endl
      |                        ^
Language: C++

#include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>
#define _USE_MATH_DEFINES
#include <cmath>
#include <numeric>
#include <iomanip>
#include <deque>
#include <tuple>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <unordered_map>
#include <sstream>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, f) for (int i = (a); i < (f); ++i)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define pb push_back
#define pf push_front

namespace mp = boost::multiprecision;
using cpp_int = mp::cpp_int;
using cpp_int = long long;
using namespace std;

cpp_int M = 1000000007;
typedef pair<int, int> P;

bool ps1(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first昇順
	return forall_a_in_P.first < forall_b_in_P.first;
}
bool ps2(const P &forall_a_in_P, const P &forall_b_in_P)
{ //first降順
	return forall_a_in_P.first > forall_b_in_P.first;
}
bool ps3(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second昇順
	return forall_a_in_P.second < forall_b_in_P.second;
}
bool ps4(const P &forall_a_in_P, const P &forall_b_in_P)
{ //second降順
	return forall_a_in_P.second > forall_b_in_P.second;
}
template <class T>
void print(const T &value)
{
	std::cout << value << std::endl;
}
int GCD(int x, int y)
{
	return x ? GCD(y % x, x) : y;
}


template <typename Abel> struct BIT {
    const Abel UNITY_SUM = 0;
    vector<Abel> dat;
    BIT(int n) : dat(n + 1, UNITY_SUM) { }  // [1, n]
    inline void add(int i, Abel x) {
        while (i < dat.size()) { dat[i] += x; i += i & -i; }
    }
    inline Abel sum(int i) {    // [1, i]
        Abel res = UNITY_SUM;
        while (i > 0) { res += dat[i]; i -= i & -i; }
        return res;
    }
    inline Abel sum(int a, int b) { return sum(b - 1) - sum(a - 1); }   // [a, b)
    /* debug */
    Abel operator[](int i) { return sum(i, i + 1); }
    void debug() {
        for (int i = 1; i < dat.size(); ++i) cout << sum(i, i + 1) << ",";
        cout << endl;
    }
};

template<typename T> long long inversion_number(const vector<T> &a) {
    int n = a.size();
    vector<T> b = a;
    sort(begin(b), end(b)); b.erase(unique(begin(b), end(b)), end(b));
    long long res = 0;
    BIT<int> bit(n);
    for (T ai: a) {
        int order = lower_bound(begin(b), end(b), ai) - begin(b) + 1;
        res += bit.sum(order + 1, n + 1); bit.add(order, 1);
    }
    return res;
}
int main(){
    cpp_int n,k;
    cin>>n>>k;
    vector<int>a(n);
    rep(i,n){
        cin>>a[i];
    }

    cpp_int tmp=(cpp_int)k*(k+1)/2%M;
    //cout<<tmp<<endl;
    cpp_int t=(cpp_int)inversion_number(a)*tmp%M;
    t%=M;
    cout<<t<<endl;
}


Compiler output:
a.cc:18:10: fatal error: boost/multiprecision/cpp_int.hpp: No such file or directory
   18 | #include <boost/multiprecision/cpp_int.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main(){
    long long N, K;
    cin >> N >> K;

    K = K % 1000000007LL;

    vector<int> A(N);
    for ( int i = 0; i < N; i++ ) cin >> A.at(i);


    long long ans = 0LL;
    long long ans1, ans2;

    // K = 1での転倒

    ans1 = 0LL;

    for ( int i = 0; i < N - 1; i++ ){
        for ( int j = i + 1; j < N; j++ ){
            if ( A.at(i) > A.at(j) ){
                ans1++;
            }
        }
    }
	

    ans1 = ( ans1 * K ) % 1000000007LL;

    //cout << ans1 << endl;

    // K > 2での転倒

    ans2 = 0LL; 

    for ( int i = 0; i < N; i++ ){
        for ( int j = 0; j < N; j++ ){
            if ( A.at(i) > A.at(j) ){
                ans2++;
            }
        }
    }

    ans2 *=  ( ( K - 1LL ) % 1000000007LL) * K ) % 1000000007LL )  / 2LL;
    ans2 = ans2 % 1000000007LL;

    ans =  (ans1 + ans2) % 1000000007LL ;

    cout << ans << endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:46:47: error: expected ';' before ')' token
   46 |     ans2 *=  ( ( K - 1LL ) % 1000000007LL) * K ) % 1000000007LL )  / 2LL;
      |                                               ^~
      |                                               ;
Language: C++

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

int main() {
int N;
  int64_t K,c=0;
  cin>>N>>K;

  vector<int> A(N);
  vector<int64_t> B(N*K);
 
    for(int i=0;i<N;i++){
    cin>>A.at(i);
  }
 for(int j=0;j<K;j++){
  for(int i=0;i<N;i++){
   
    B.at(i+j*N)=A.at(i);
 }
 }
   for(int i=0;i<N*K;i++){
    for(int j=i+1;j<N*K;j++){
      if(B.at(i)>B.at(j)){
        c++;
      }
    }
  }
  cout<<c%(std::pow(10,9)+7)<<endl;
      
}


Compiler output:
a.cc: In function 'int main()':
a.cc:28:10: error: invalid operands of types 'int64_t' {aka 'long int'} and '__gnu_cxx::__promote<double>::__type' {aka 'double'} to binary 'operator%'
   28 |   cout<<c%(std::pow(10,9)+7)<<endl;
      |         ~^~~~~~~~~~~~~~~~~~~
      |         |                |
      |         |                __gnu_cxx::__promote<double>::__type {aka double}
      |         int64_t {aka long int}
Language: C++

#include <string>
#include <set>
#include <cmath> //abs();
using namespace std;

long long int wa(long long int n){
    if(n==0) return 0;
    return n+(wa(n-1));
} 

int main(void)
{
    long long int k,ans=0,n,temp=0;
    int i,j;
    cin >> n >> k;
    vector<int> vec(n);
//    set<int> s;

    for(i=0;i<n;i++){
        cin >> vec.at(i);
       // s.insert(vec.at(i));
    }

    for(i=0;i<n-1;i++){
        for(j=1;j<n;j++){
            if(vec.at(i)>vec.at(j)) ans += 1;
        } 
    }
    ans *= k;

    sort(vec.begin(),vec.end());
    for(i=0;i<n-1;i++){
        for(j=1;j<n;j++){
            if(vec.at(i)<vec.at(j)) temp += 1;
        } 
    }

    ans += temp*wa(k-1);

    cout << ans%(1000000000+7);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:15:5: error: 'cin' was not declared in this scope
   15 |     cin >> n >> k;
      |     ^~~
a.cc:4:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
    3 | #include <cmath> //abs();
  +++ |+#include <iostream>
    4 | using namespace std;
a.cc:16:5: error: 'vector' was not declared in this scope
   16 |     vector<int> vec(n);
      |     ^~~~~~
a.cc:4:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
    3 | #include <cmath> //abs();
  +++ |+#include <vector>
    4 | using namespace std;
a.cc:16:12: error: expected primary-expression before 'int'
   16 |     vector<int> vec(n);
      |            ^~~
a.cc:20:16: error: 'vec' was not declared in this scope
   20 |         cin >> vec.at(i);
      |                ^~~
a.cc:26:16: error: 'vec' was not declared in this scope
   26 |             if(vec.at(i)>vec.at(j)) ans += 1;
      |                ^~~
a.cc:31:10: error: 'vec' was not declared in this scope
   31 |     sort(vec.begin(),vec.end());
      |          ^~~
a.cc:31:5: error: 'sort' was not declared in this scope; did you mean 'sqrt'?
   31 |     sort(vec.begin(),vec.end());
      |     ^~~~
      |     sqrt
a.cc:40:5: error: 'cout' was not declared in this scope
   40 |     cout << ans%(1000000000+7);
      |     ^~~~
a.cc:40:5: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>      // std::setprecision
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor_ct.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pending/disjoint_sets.hpp>
#include <boost/icl/interval_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/graph_utility.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
using namespace std;
using namespace boost::math;

int main() {
	long long N, K;

	cin >> N >> K;
  
    vector<long long> A(N);
  
    for (auto& i : A)
      cin >> i;
  
    long long appear[2001] = {0}, added[2001] = {0};
    long long koke = 0;
  
    REP(i, N) {
      appear[A[i]]++;
      for (int j : boost::irange(A[i] + 1, 2001)) {
        koke = (koke + appear[j]) % 1000000007LL;
        added[j]++;
      }
    }

    auto kdan = (K * (K-1LL) % 1000000007LL) / 2LL % 1000000007LL;
  long long hoge = 0;
    REP(i, 2001) {
      appear[i] = appear[i] * added[i] % 1000000007LL;
      appear[i] = appear[i] * kdan % 1000000007LL;
      hoge += appear[i] % 1000000007LL;
    }
    
	cout << (hoge + (koke * K) % 1000000007LL) % 1000000007LL << endl;

	return 0;
}


Compiler output:
a.cc:13:10: fatal error: boost/range/irange.hpp: No such file or directory
   13 | #include <boost/range/irange.hpp>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

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

int main(){
  int n,k,j;
  cin>>n>>k;
  k = k%1000000007;
  int a[2002];
  int i,inv=0;
  for(i=0;i<n;i++){
    cin>>a[i];
    
  }
  int total = 0;
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(a[i]>a[j]) total++;
      else if(a[i]<a[j]) inv++;
    }
  }
  total = total%1000000007;
  int a = (k*(k+1)*total)/2 - k*inv;
  cout<<a%1000000007<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:7: error: conflicting declaration 'int a'
   22 |   int a = (k*(k+1)*total)/2 - k*inv;
      |       ^
a.cc:8:7: note: previous declaration as 'int a [2002]'
    8 |   int a[2002];
      |       ^
a.cc:23:10: error: invalid operands of types 'int [2002]' and 'int' to binary 'operator%'
   23 |   cout<<a%1000000007<<endl;
      |         ~^~~~~~~~~~~
      |         | |
      |         | int
      |         int [2002]
Language: C

#include<stdio.h>

int main(void){

int n;
long int k;
long int i,j;
long int ans=0;

scanf("%d%ld",&n,&k);

int a[2000*1000000000];

for(i=0;i<n;i++){
scanf("%d",&a[i]);
}

for(i=1;i<k;i++){
    for(j=0;j<n;j++){
        a[i*n+j]=a[j];
    }
}
for(i=0;i<k*n;i++){
    for(j=i+1;j<k*n;j++){
        if(a[i]>a[j]){
            ans++;
        }
    }
}
ans=ans%(1000000000+7);

printf("%d",ans);
return 0;

}


Compiler output:
main.c: In function 'main':
main.c:12:11: warning: integer overflow in expression of type 'int' results in '-1454759936' [-Woverflow]
   12 | int a[2000*1000000000];
      |           ^
main.c:12:5: error: size of array 'a' is negative
   12 | int a[2000*1000000000];
      |     ^
Language: C++

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

int main(){
  int n,k,j;
  cin>>n>>k;
  int a[2002];
  int i,inv=0;
  for(i=0;i<n;i++){
    cin>>a[i];
    
  }
  int total = 0;
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(a[i]>a[j]) total++;
      else if(a[i]<a[j]) inv++;
    }
  }
  int a = (k*(k+1)*total)/2 - k*inv;
  cout<<a%1000000007<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: conflicting declaration 'int a'
   20 |   int a = (k*(k+1)*total)/2 - k*inv;
      |       ^
a.cc:7:7: note: previous declaration as 'int a [2002]'
    7 |   int a[2002];
      |       ^
a.cc:21:10: error: invalid operands of types 'int [2002]' and 'int' to binary 'operator%'
   21 |   cout<<a%1000000007<<endl;
      |         ~^~~~~~~~~~~
      |         | |
      |         | int
      |         int [2002]
Language: C++

#include <bits/stdc++.h>
using namespace std;
#define TABLE_SIZE 10000000000
long long a[TABLE_SIZE];
long long b1[TABLE_SIZE];

int main()
{
    long long n,p,b,f,h,c,i,d=0,s,k=0,l,j;

    cin >> n >> b;

    for(i=0; i<n; i++)
    {

        cin >> b1[i];

    }
    for(i=0,j=0; j<b*n; j++)
    {

        a[j]=b1[i];
        i++;
        if(i==n)
        {
            i=0;
        }
    }

    for(i=0; i<b*n; i++)
    {

        for(j=i+1; j<b*n; j++)
        {

            if(a[i]>a[j])
            {
                k++;
            }
        }
    }

    cout << k;


}


Compiler output:
/tmp/ccCjvEOv.o: in function `main':
a.cc:(.text+0x59): relocation truncated to fit: R_X86_64_PC32 against symbol `b1' defined in .bss section in /tmp/ccCjvEOv.o
a.cc:(.text+0xa2): relocation truncated to fit: R_X86_64_PC32 against symbol `b1' defined in .bss section in /tmp/ccCjvEOv.o
collect2: error: ld returned 1 exit status
Language: C++

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll M = 1e9+7;
int main(){
	ll n,k;
	cin >> n >> k;
	ll m=(((k+1)*k)/2)%M;
	ll p =((k*(k-1))/2)%M;
	ll a[n];
	for(int i=0;i<n;i++)scanf("%lld",&a[i]);
	ll cnt = 0;
	for(int i=0;i<n;i++){
		ll sum=0;
		ll ans=0;
		for(int j=i+1;j<n;j++){
			if(a[i]>a[j])sum++;
		} 
		sum%=M;
		cnt+=(sum*(m%N))%M;
		for(int j=i-1;j>=0;j--){
			if(a[i]>a[j])ans++;
		}
		ans%=M;
		cnt+=(ans*(p%N))%M;
	}
	cout << cnt%M << endl;
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:20:30: error: 'N' was not declared in this scope
   20 |                 cnt+=(sum*(m%N))%M;
      |                              ^
Language: C

#include<stdio.h>

int main(void){

int n;
long int k;
long int i,j;
long int ans=0;

scanf("%d%ld",&n,&k);

static int a[n*k];

for(i=0;i<n;i++){
scanf("%d",&a[i]);
}

for(i=1;i<k;i++){
    for(j=0;j<n;j++){
        a[i*n+j]=a[j];
    }
}
for(i=0;i<k*n;i++){
    for(j=i+1;j<k*n;j++){
        if(a[i]>a[j]){
            ans++;
        }
    }
}
ans=ans%(1000000000+7);

printf("%d",ans);
return 0;

}


Compiler output:
main.c: In function 'main':
main.c:12:12: error: storage size of 'a' isn't constant
   12 | static int a[n*k];
      |            ^
Language: C++

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

int main(){
  int n,k,j;
  cin>>n>>k;
  int a[n];
  int i,inv=0;
  for(i=0;i<n;i++){
    cin>>a[i];
    
  }
  int total = 0;
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(a[i]>a[j]) total++;
      else if(a[i]<a[j]) inv++;
    }
  }
  int a = (k*(k+1)*total)/2 - k*inv;
  cout<<a<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: conflicting declaration 'int a'
   20 |   int a = (k*(k+1)*total)/2 - k*inv;
      |       ^
a.cc:7:7: note: previous declaration as 'int a [n]'
    7 |   int a[n];
      |       ^
Language: C++

#include<iostream>
using namespace std;

int main(){
int N;
int K;
int A[2100];
int B[1000000000];
cin >>N >>K;
for (int i=0; i<N; ++i)
{
  cin>>A[i];
}
for (i=0; i<K; ++i){
cin >> B[i]=A[i];
}
}


Compiler output:
a.cc: In function 'int main()':
a.cc:14:6: error: 'i' was not declared in this scope
   14 | for (i=0; i<K; ++i){
      |      ^
Language: C++

#include <bits/stdc++.h>

using namespace std;

int main(){
    int N;
    long long int K;
    long long int ans=0,anss=0,ansss=0,kk=0;
    cin >> N >> K;

    for(int i=1;i<K;i++){
            kk += i;
            kk = kk%1000000007
        }

    vector<int> A(N);
    for(int i=0;i<N;i++){
        cin >> A[i];
    }

    for(int i=0;i<N;i++){
        int a=A[i];
        anss=0;
        ansss=0;
        for(int j=0;j<N;j++){
            if(A[j]<a){
                if(i<j){
                    ansss++;
                    anss++;
                }else{
                    anss++;
                }
            }
        }
        ans += anss*kk;
        ans =  ans%1000000007;
        ans += ansss*K;
        ans = ans%1000000007;
    }

    ans =  ans%1000000007;

    cout << ans << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:13:31: error: expected ';' before '}' token
   13 |             kk = kk%1000000007
      |                               ^
      |                               ;
   14 |         }
      |         ~
Language: C++

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

int main(){
  int n,k,j;
  cin>>n>>k;
  int a[n];
  int i,inv=0;
  for(i=0;i<n;i++){
    cin>>a[i];
    
  }
  int total = 0;
  for(i=0;i<n-1;i++){
    for(j=i+1;j<n;j++){
      if(a[i]>a[j]) total++;
      else if(a[i]<a[j]) inv++;
    }
  }
  int a = (k*(k+1)*total)/2 - k*inv;
  cout<<a<<endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:7: error: conflicting declaration 'int a'
   20 |   int a = (k*(k+1)*total)/2 - k*inv;
      |       ^
a.cc:7:7: note: previous declaration as 'int a [n]'
    7 |   int a[n];
      |       ^
Language: C++

#include<bits/stdc++.h>
using namespace std;
const long long N=2000+7；

long long a[N],s1[N],s2[N];
int main()
{
	long long n,k,cnt=0;
	cin >> n >> k;
	for(int i=0;i<n-1;i++)
    {
      for(int j=i+1;j<n;j++)
        if(a[i]>a[j])
          s1[i]++;
    }
    for(int i=n-1;i>0;i--)
    {
      for(int j=i-1;j>=0;j--)
        if(a[i]>a[j])
          s2[i]++;
    }
    long long kk=0；
    kk=
	cout << cnt << endl;
	return 0;
}#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N = 1e9+7;
int main(){
	ll n,k;
	cin >> n >> k;
	ll m=(((k+1)*k)/2)%N;
	ll p =((k*(k-1))/2)%N;
	ll a[n];
	for(int i=0;i<n;i++)scanf("%lld",&a[i]);
	ll cnt = 0;
	for(int i=0;i<n;i++){
		ll sum=0;
		ll ans=0;
		for(int j=i+1;j<n;j++){
			if(a[i]>a[j])sum++;
		} 
		sum%=N;
		cnt+=(sum*(m%N))%N;
		for(int j=i-1;j>=0;j--){
			if(a[i]>a[j])ans++;
		}
		ans%=N;
		cnt+=(ans*(p%N))%N;
	}
	cout << cnt%N << endl;
	return 0;
}

Compiler output:
a.cc:26:2: error: stray '#' in program
   26 | }#include<bits/stdc++.h>
      |  ^
a.cc:3:24: error: unable to find numeric literal operator 'operator""\U0000ff1b'
    3 | const long long N=2000+7；
      |                        ^~~
a.cc: In function 'int main()':
a.cc:13:12: error: 'a' was not declared in this scope
   13 |         if(a[i]>a[j])
      |            ^
a.cc:14:11: error: 's1' was not declared in this scope; did you mean 'y1'?
   14 |           s1[i]++;
      |           ^~
      |           y1
a.cc:19:12: error: 'a' was not declared in this scope
   19 |         if(a[i]>a[j])
      |            ^
a.cc:20:11: error: 's2' was not declared in this scope
   20 |           s2[i]++;
      |           ^~
a.cc:22:18: error: unable to find numeric literal operator 'operator""\U0000ff1b'
   22 |     long long kk=0；
      |                  ^~~
a.cc: At global scope:
a.cc:26:3: error: 'include' does not name a type
   26 | }#include<bits/stdc++.h>
      |   ^~~~~~~
a.cc:29:10: error: redefinition of 'const ll N'
   29 | const ll N = 1e9+7;
      |          ^
a.cc:3:17: note: 'const long long int N' previously defined here
    3 | const long long N=2000+7；
      |                 ^
a.cc:30:5: error: redefinition of 'int main()'
   30 | int main(){
      |     ^~~~
a.cc:6:5: note: 'int main()' previously defined here
    6 | int main()
      |     ^~~~