Language: C++

		tmp=(tmp*x)%mod;
	return tmp;
}
long long cc(int nn,int mm)
{
	return jie[nn]*poww(jie[nn-mm],mod-2)%mod*poww(jie[mm],mod-2)%mod;
}
signed main()
{
	scanf("%lld%lld",&n,&k);
	if(k==1)
	{
		cout<<0;
		return 0;
	}
	for(int i=1;i<=n;i++)
		scanf("%lld",&a[i]);
	sort(a+1,a+n+1);
	jie[0]=1,jie[1]=1,k--;
	for(int i=2;i<=100000;i++)
		jie[i]=jie[i-1]*i;
	for(int i=1;i<=n;i++)
	{
		if(i-1>=k)
			ma+=cc(i-1,k)%mod*a[i]%mod,ma%=mod;
		if(n-i>=k)
			mi+=cc(n-i,k)%mod*a[i]%mod,mi%=mod;
	}
	cout<<(ma-mi+mod)%mod;
	return 0;
}


Compiler output:
a.cc:1:17: error: 'tmp' does not name a type
    1 |                 tmp=(tmp*x)%mod;
      |                 ^~~
a.cc:2:9: error: expected unqualified-id before 'return'
    2 |         return tmp;
      |         ^~~~~~
a.cc:3:1: error: expected declaration before '}' token
    3 | }
      | ^
a.cc: In function 'long long int cc(int, int)':
a.cc:6:16: error: 'jie' was not declared in this scope
    6 |         return jie[nn]*poww(jie[nn-mm],mod-2)%mod*poww(jie[mm],mod-2)%mod;
      |                ^~~
a.cc:6:40: error: 'mod' was not declared in this scope
    6 |         return jie[nn]*poww(jie[nn-mm],mod-2)%mod*poww(jie[mm],mod-2)%mod;
      |                                        ^~~
a.cc:6:24: error: 'poww' was not declared in this scope
    6 |         return jie[nn]*poww(jie[nn-mm],mod-2)%mod*poww(jie[mm],mod-2)%mod;
      |                        ^~~~
a.cc: In function 'int main()':
a.cc:10:27: error: 'n' was not declared in this scope
   10 |         scanf("%lld%lld",&n,&k);
      |                           ^
a.cc:10:30: error: 'k' was not declared in this scope
   10 |         scanf("%lld%lld",&n,&k);
      |                              ^
a.cc:10:9: error: 'scanf' was not declared in this scope
   10 |         scanf("%lld%lld",&n,&k);
      |         ^~~~~
a.cc:13:17: error: 'cout' was not declared in this scope
   13 |                 cout<<0;
      |                 ^~~~
a.cc:17:31: error: 'a' was not declared in this scope
   17 |                 scanf("%lld",&a[i]);
      |                               ^
a.cc:18:14: error: 'a' was not declared in this scope
   18 |         sort(a+1,a+n+1);
      |              ^
a.cc:18:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   18 |         sort(a+1,a+n+1);
      |         ^~~~
      |         short
a.cc:19:9: error: 'jie' was not declared in this scope
   19 |         jie[0]=1,jie[1]=1,k--;
      |         ^~~
a.cc:25:25: error: 'ma' was not declared in this scope
   25 |                         ma+=cc(i-1,k)%mod*a[i]%mod,ma%=mod;
      |                         ^~
a.cc:25:39: error: 'mod' was not declared in this scope
   25 |                         ma+=cc(i-1,k)%mod*a[i]%mod,ma%=mod;
      |                                       ^~~
a.cc:27:25: error: 'mi' was not declared in this scope; did you mean 'i'?
   27 |                         mi+=cc(n-i,k)%mod*a[i]%mod,mi%=mod;
      |                         ^~
      |                         i
a.cc:27:39: error: 'mod' was not declared in this scope
   27 |                         mi+=cc(n-i,k)%mod*a[i]%mod,mi%=mod;
      |                                       ^~~
a.cc:29:9: error: 'cout' was not declared in this scope
   29 |         cout<<(ma-mi+mod)%mod;
      |         ^~~~
a.cc:29:16: error: 'ma' was not declared in this scope; did you mean 'main'?
   29 |         cout<<(ma-mi+mod)%mod;
      |                ^~
      |                main
a.cc:29:19: error: 'mi' was not declared in this scope; did you mean 'main'?
   29 |         cout<<(ma-mi+mod)%mod;
      |                   ^~
      |                   main
a.cc:29:22: error: 'mod' was not declared in this scope
   29 |         cout<<(ma-mi+mod)%mod;
      |                      ^~~