Language: C++

Fadx#include <bits/stdc++.h>
 
const long long MODULO = 1000000007;
 
using namespace std;
 
vector<long long> fact(100001);
 
void precalc() {
  	fact[0] = 1;
  	for (int i = 1; i <= 100000; ++i) {
      fact[i] = fact[i - 1] * i;
  	  fact[i] %= MODULO;
	}
  	return;
}
 
long long binpow(long long a, long long b) {
	long long res = 1;
  	while (b) {
    	if (b & 1) {
        	res *= a;
          	res %= MODULO;
        }
      	a *= a;
      	a %= MODULO;
      	b >>= 1;
    }
  	return res;
}
 
long long C(long long n, long long k) {
	if (n < k) return 0;
  	return (((fact[n] * binpow(fact[n - k], MODULO - 2)) % MODULO) * binpow(fact[k], MODULO - 2)) % MODULO;
}
 
int main() {
  	precalc();
	int n, k;
  	cin >> n >> k;
  	vector<long long> a(n);
  	for (int i = 0; i < n; ++i)
    	cin >> a[i];
  	sort(a.begin(), a.end());
  	long long ans = 0;
  	for (int i = 0; i < n; ++i) {
    	ans += (a[i] * C(i, k - 1))	% MODULO;
     	ans %= MODULO;
      	ans += MODULO;
      	ans -= (a[i] * C(n - i - 1, k - 1)) % MODULO;
      	ans %= MODULO;
    }
  	cout << ans << '\n';
  	return 0;
}


Compiler output:
a.cc:1:5: error: stray '#' in program
    1 | Fadx#include <bits/stdc++.h>
      |     ^
a.cc:1:1: error: 'Fadx' does not name a type
    1 | Fadx#include <bits/stdc++.h>
      | ^~~~
a.cc:7:1: error: 'vector' does not name a type
    7 | vector<long long> fact(100001);
      | ^~~~~~
a.cc: In function 'void precalc()':
a.cc:10:9: error: 'fact' was not declared in this scope
   10 |         fact[0] = 1;
      |         ^~~~
a.cc:13:22: error: 'MODULO' was not declared in this scope
   13 |           fact[i] %= MODULO;
      |                      ^~~~~~
a.cc: In function 'long long int binpow(long long int, long long int)':
a.cc:23:24: error: 'MODULO' was not declared in this scope
   23 |                 res %= MODULO;
      |                        ^~~~~~
a.cc:26:14: error: 'MODULO' was not declared in this scope
   26 |         a %= MODULO;
      |              ^~~~~~
a.cc: In function 'long long int C(long long int, long long int)':
a.cc:34:19: error: 'fact' was not declared in this scope
   34 |         return (((fact[n] * binpow(fact[n - k], MODULO - 2)) % MODULO) * binpow(fact[k], MODULO - 2)) % MODULO;
      |                   ^~~~
a.cc:34:49: error: 'MODULO' was not declared in this scope
   34 |         return (((fact[n] * binpow(fact[n - k], MODULO - 2)) % MODULO) * binpow(fact[k], MODULO - 2)) % MODULO;
      |                                                 ^~~~~~
a.cc: In function 'int main()':
a.cc:40:9: error: 'cin' was not declared in this scope
   40 |         cin >> n >> k;
      |         ^~~
a.cc:1:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
  +++ |+#include <iostream>
    1 | Fadx#include <bits/stdc++.h>
a.cc:41:9: error: 'vector' was not declared in this scope
   41 |         vector<long long> a(n);
      |         ^~~~~~
a.cc:1:1: note: 'std::vector' is defined in header '<vector>'; this is probably fixable by adding '#include <vector>'
  +++ |+#include <vector>
    1 | Fadx#include <bits/stdc++.h>
a.cc:41:16: error: expected primary-expression before 'long'
   41 |         vector<long long> a(n);
      |                ^~~~
a.cc:43:16: error: 'a' was not declared in this scope
   43 |         cin >> a[i];
      |                ^
a.cc:44:14: error: 'a' was not declared in this scope
   44 |         sort(a.begin(), a.end());
      |              ^
a.cc:44:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   44 |         sort(a.begin(), a.end());
      |         ^~~~
      |         short
a.cc:47:43: error: 'MODULO' was not declared in this scope
   47 |         ans += (a[i] * C(i, k - 1))     % MODULO;
      |                                           ^~~~~~
a.cc:53:9: error: 'cout' was not declared in this scope
   53 |         cout << ans << '\n';
      |         ^~~~
a.cc:53:9: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'