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

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
using namespace std;
using ll=long long;
using vec=vector<ll>;
using Graph = vector<vector<ll>>;
#define loop(i,n) for(ll i=0;i<n;i++)
#define Loop(i, m, n) for(ll i = m;i < n;i++)
#define pool(i,n) for(ll i=n;i>=0;i--)
#define Pool(i, m, n) for(ll i=n;i>=m;i--)
#define setbit bitset<8>
#define flagcount __builtin_popcount
#define flag(x) (1<<x)
#define flagadd(bit,x) bit|=flag(x)
#define flagpop(bit,x) bit&=~flag(x) 
#define flagon(bit,i) bit&flag(i)
#define flagoff(bit,i) !(bit & (1<<i))
#define all(v) v.begin(),v.end()
#define low2way(v,x) lower_bound(all(v),x)
#define high2way(v,x) upper_bound(all(v),x)
#define count2way(v,x) high2way(v,x)-low2way(v,x)
#define lower(v,x) low2way(v,x)-v.begin() //1番左が0、もし見つから無いならｎを出力
#define higher(v,x) high2way(v,x)-v.begin()-1 //1番左が0、もし見つからないならn-1を出力（注意）
#define putout(a) cout<<a<<endl
#define putout2(a,b) putout(a);putout(b)
#define putout3(a,b,c) putout(a);putout(b);putout(c)
#define putout4(a,b,c,d) putout(a);putout(b);putout(c);putout(d)
#define putout5(a,b,c,d,e) putout(a);putout(b);putout(c);putout(d);putout(e)
#define Gput(a,b) G[a].push_back(b)
#define cin1(a) cin>>a
#define cin2(a,b) cin>>a>>b
#define cin3(a,b,c) cin>>a>>b>>c
#define cin4(a,b,c,d) cin>>a>>b>>c>>d
#define cin5(a,b,c,d,e) cin>>a>>b>>c>>d>>e
#define sum(v) accumulate(all(v), 0ll)
#define gcd(x,y) __gcd(x,y)
/* 4 方向への隣接頂点への移動を表すベクトル */
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
ll ctoi(char c){
	if(c>='0'&&c<='9'){
		return c-'0';
	}
	return 0;
}
ll lcm(ll x,ll y){
  ll z=gcd(x,y);
  return x*y/z;
}
ll primejudge(ll n){
  if(n<2)return 0;
  else if(n==2)return 1;
  else if(n%2==0)return 0;
  double sqrtn=sqrt(n);
  Loop(i,3,sqrtn+1){
     if(n%i==0){
        return 0;
     }
     i++;
  }
  return 1;
}
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  COMinit();
  ll n,k;
  cin>>n>>k;
  vec a(n);
  ll ans=0;
  loop(i,n)cin>>a[i];
  if(k==1){
    putout(0);
  }
  else{
  ll ans=0;
  sort(all(a));
  loop(i,n-1){
    ans+=(a[i+1]-a[i])*(COM(n,k)-COM(i+1,k)-COM(n-i-1,k));
    ans%=1000000007;
  }
    putout(ans);
}


Compiler output:
a.cc: In function 'int main()':
a.cc:105:2: error: expected '}' at end of input
  105 | }
      |  ^
a.cc:87:12: note: to match this '{'
   87 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int64_t,int64_t> pll;
typedef vector<int64_t> vl;
int dx[]={1,-1,0,0,1,-1,1,-1};
int dy[]={0,0,1,-1,1,-1,-1,1};
const long double PI = acos(-1);
#define INF (2147483647)
#define mod (1000000007)
#define limit (7368791)
#define rep(i,a,b) for (int64_t i = (a); i < (b); i++)
#define REP(i,n) rep(i,0,n)
#define sz(s) (s).size()
#define ALL(a) begin(a),end(a)
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

int n,k;

const int MAX=1010000;
int64_t fact[MAX];
int64_t fact_inv[MAX];

void init(){
    fact[0]=1;
    for(int i=0;i<n;i++)fact[i+1]=fact[i]*(i+1)%mod;
    fact_inv[n]=power(fact[n],mod-2);
    for(int i=n-1;i>=0;i--)fact_inv[i]=fact_inv[i+1]*(i+1)%mod;
}
int64_t power(int64_t x,int64_t n)
{
    int64_t res=1;
    while(n>0){
        if(n&1)res=res*x%mod;
        x=x*x%mod;
        n>>=1;
    }
    return res;
}
int64_t comb(int64_t n,int64_t r)
{
    if(n<0||r<0||n<r)return 0;
    return (fact[n]*fact_inv[r])%mod*fact_inv[n-r]%mod;
}

void solve() 
{
    init();
    cin>>n>>k;
    int a[n];REP(i,n)cin>>a[i];
    sort(a,a+n);
    int ans=0;
    REP(i,n)ans=ans+a[i]*comb(i,k)%mod;
    REP(i,n)ans=ans-a[i]*comb(n-i-1,k)%mod;
    cout<<ans<<endl;
}
int main()
{
    cin.tie(0);
	ios::sync_with_stdio(false);
    solve();
    return 0;
}


Compiler output:
a.cc: In function 'void init()':
a.cc:32:17: error: 'power' was not declared in this scope
   32 |     fact_inv[n]=power(fact[n],mod-2);
      |                 ^~~~~
Language: Java


import java.util.Arrays;
import java.util.Scanner;

public class Main {
    final static long MOD = 1000000007;

    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int k = scanner.nextInt();
        final long[] array = new long[n];
        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextLong();
        }

        if (k == 1) {
            System.out.println(0);
            return;
        }

        Arrays.sort(array);

        final CombinationCalculator combinationCalculator = new CombinationCalculator(n + 1, (int) MOD).init();

        long maxSum = 0;
        long minSum = 0;
        for (int i = 0; i <= n - k; i++) {
            maxSum += array[n - 1 - i] * combinationCalculator.calc(n - 1 - i, k - 1) % MOD;
            maxSum %= MOD;
            minSum -= array[i] * combinationCalculator.calc(n - 1 - i, k - 1) % MOD;
            minSum %= MOD;
        }

        System.out.println((maxSum + minSum MOD) % MOD);
    }

    private static class CombinationCalculator {
        private final int size;
        private final int mod;
        private final long[] factorials;
        private final long[] invertedElements;
        private final long[] invertedFactorials;

        CombinationCalculator(final int size, final int mod) {
            this.size = size;
            this.mod = mod;
            this.factorials = new long[size];
            this.invertedElements = new long[size];
            this.invertedFactorials = new long[size];
        }

        CombinationCalculator init() {
            factorials[0] = 1;
            factorials[1] = 1;
            invertedFactorials[0] = 1;
            invertedFactorials[1] = 1;
            invertedElements[1] = 1;
            for (int i = 2; i < size; i++) {
                factorials[i] = factorials[i - 1] * i % mod;
                invertedElements[i] = mod - invertedElements[mod % i] * (mod / i) % mod;
                invertedFactorials[i] = invertedFactorials[i - 1] * invertedElements[i] % mod;
            }
            return this;
        }

        long calc(final int n, final int k) {
            return factorials[n] * (invertedFactorials[k] * invertedFactorials[n - k] % mod) % mod;
        }
    }
}


Compiler output:
Main.java:35: error: ')' expected
        System.out.println((maxSum + minSum MOD) % MOD);
                                           ^
Main.java:35: error: not a statement
        System.out.println((maxSum + minSum MOD) % MOD);
                                            ^
Main.java:35: error: ';' expected
        System.out.println((maxSum + minSum MOD) % MOD);
                                               ^
Main.java:35: error: not a statement
        System.out.println((maxSum + minSum MOD) % MOD);
                                                   ^
Main.java:35: error: ';' expected
        System.out.println((maxSum + minSum MOD) % MOD);
                                                      ^
5 errors
Language: Java

package ABC151.E;

import java.util.Arrays;
import java.util.Scanner;

public class Main {
    final static long MOD = 1000000007;

    public static void main(final String[] args) {
        final Scanner scanner = new Scanner(System.in);
        final int n = scanner.nextInt();
        final int k = scanner.nextInt();
        final long[] array = new long[n];
        for (int i = 0; i < n; i++) {
            array[i] = scanner.nextLong();
        }

        if (k == 1) {
            System.out.println(0);
            return;
        }

        Arrays.sort(array);

        final CombinationCalculator combinationCalculator = new CombinationCalculator(n + 1, (int) MOD).init();

        long maxSum = 0;
        long minSum = 0;
        for (int i = 0; i <= n - k; i++) {
            maxSum += array[n - 1 - i] * combinationCalculator.calc(n - 1 - i, k - 1) % MOD;
            maxSum %= MOD;
            minSum -= array[i] * combinationCalculator.calc(n - 1 - i, k - 1) % MOD;
            minSum %= MOD;
        }

        System.out.println((maxSum + minSum ＋MOD) % MOD);
    }

    private static class CombinationCalculator {
        private final int size;
        private final int mod;
        private final long[] factorials;
        private final long[] invertedElements;
        private final long[] invertedFactorials;

        CombinationCalculator(final int size, final int mod) {
            this.size = size;
            this.mod = mod;
            this.factorials = new long[size];
            this.invertedElements = new long[size];
            this.invertedFactorials = new long[size];
        }

        CombinationCalculator init() {
            factorials[0] = 1;
            factorials[1] = 1;
            invertedFactorials[0] = 1;
            invertedFactorials[1] = 1;
            invertedElements[1] = 1;
            for (int i = 2; i < size; i++) {
                factorials[i] = factorials[i - 1] * i % mod;
                invertedElements[i] = mod - invertedElements[mod % i] * (mod / i) % mod;
                invertedFactorials[i] = invertedFactorials[i - 1] * invertedElements[i] % mod;
            }
            return this;
        }

        long calc(final int n, final int k) {
            return factorials[n] * (invertedFactorials[k] * invertedFactorials[n - k] % mod) % mod;
        }
    }
}


Compiler output:
Main.java:36: error: illegal character: '\uff0b'
        System.out.println((maxSum + minSum ?MOD) % MOD);
                                            ^
Main.java:36: error: not a statement
        System.out.println((maxSum + minSum ?MOD) % MOD);
                                             ^
Main.java:36: error: ';' expected
        System.out.println((maxSum + minSum ?MOD) % MOD);
                                                ^
Main.java:36: error: not a statement
        System.out.println((maxSum + minSum ?MOD) % MOD);
                                                    ^
Main.java:36: error: ';' expected
        System.out.println((maxSum + minSum ?MOD) % MOD);
                                                       ^
5 errors
Language: C++

#include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define INF 1000000010
#define EPS 1e-9
#define fst first
#define scd second

#define debug(x) cout<<x<<endl;
#define repi(i,x,n) for(int i=x;i<n;i++)
#define rep(i,n) repi(i,0,n)
#define lp(i,n) repi(i,0,n)
#define repn(i,n) for(int i=n;i>=0;i--)
#define int long long
#define endl "\n"


int aa[200000],bb[200000],cc[2000000];
 
void t(){
  aa[0]=aa[1]=1;
  bb[0]=bb[1]=1;
  cc[1]=1;
  repi(i,2,200000){
    aa[i]=aa[i-1]*i%MOD;
    cc[i]=MOD-cc[MOD%i]*(MOD/i)%MOD;
    bb[i]=bb[i-1]*cc[i]%MOD;
  }
}
 
int calc(int n,int k){
  if(n<k) return 0;
  if(n<0 || k<0) return 0;
  return aa[n]*(bb[k]*bb[n-k]%MOD)%MOD;
}
 

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  t();
  int n,k;
  cin>>n>>k;
  int a[n];
  rep(i,n) cin>>a[i];
  sort(a,a+n);
 
  int ansa=0;
  int ansb=0;
  repi(i,k-1,n){
    int num;
    num=calc(max(i,(int)0),k-1);
    num=num*a[i]%MOD;
    ansa+=num;
    ansa%=MOD;
  }
  rep(i,n-k+1){
    int num;
    num=calc(max(n-i-1,(int)0),k-1);
    num=num*a[i]%MOD;
    num%=MOD;
    ansb+=num;
    ansb%=MOD;
  }
  if(ansa-ansb < 0){
    while();
  }
      
  cout<<(ansa-ansb)<<endl;
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:66:11: error: expected primary-expression before ')' token
   66 |     while();
      |           ^
Language: C++

N,K=gets.chomp.split(' ').map{|n| n.to_f}
A=gets.chomp.split(' ').map{|n| n.to_i}

puts A.combination(K).map{|a| a.max - a.min}.inject(:+)%((10**9) + 7)

Compiler output:
a.cc:1:1: error: 'N' does not name a type
    1 | N,K=gets.chomp.split(' ').map{|n| n.to_f}
      | ^
a.cc:2:1: error: 'A' does not name a type
    2 | A=gets.chomp.split(' ').map{|n| n.to_i}
      | ^
a.cc:4:1: error: 'puts' does not name a type
    4 | puts A.combination(K).map{|a| a.max - a.min}.inject(:+)%((10**9) + 7)
      | ^~~~
a.cc:4:45: error: expected unqualified-id before '.' token
    4 | puts A.combination(K).map{|a| a.max - a.min}.inject(:+)%((10**9) + 7)
      |                                             ^
Language: C++

n,k=map(int,input().split())
a=sorted(list(map(int, input().split())))

s=0
cmb=1
MOD=10**9+7
for i in range(k-1,n):
	s+=(a[i]-a[n-i-1])*cmb
	s%=MOD
	cmb=cmb*(i+1)//(i-k+2)
    cmb%=MOD
print(s)


Compiler output:
a.cc:1:1: error: 'n' does not name a type
    1 | n,k=map(int,input().split())
      | ^
Language: C++

#include<bits/stdc++.h>
#define int long long int
#define ldouble long double
#define vin vector<int>
#define rep(a,n) for(int i=(a);i<(n);i++)
#define INF (int)1000000007

//setprecision()<<

const int MAX = 510000;
const int MOD = INF;

long long fac[MAX], finv[MAX], inv[MAX];

using namespace std;

void fin(int n,vin &a){
    rep(0,n){
        cin>>a.at(i);
    }
}

// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

signed main(){
    int N,K;
    cin>>N>>K;
    vin A(N);
    rep(0,N){
        cin>>A.at(i);
    }
    sort(A.begin(),A.end());
    int sum=0;
    COMinit();
    for(int i=N;i>=K;i--){
        sum+=(A.at(i-1)-A.at(N-i))*COM(i-1,K-1))%INF;
        sum%=INF;
    }
    cout<<sum<<endl;

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:53:48: error: expected ';' before ')' token
   53 |         sum+=(A.at(i-1)-A.at(N-i))*COM(i-1,K-1))%INF;
      |                                                ^
      |                                                ;
Language: C++

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

const long long INF = 1e9+7;
long long dp[100000][100000] = {-1};

long long combi(long long n, long long k) {
  if (n == k || k == 0)
    return dp[n][k] = 1;

  if(dp[n][k] != -1){
  	return dp[n][k];
  }else {
    return dp[n][k] = combi(n - 1, k - 1) + combi(n - 1, k);
  }
}

int main() {
	int n,k;
	cin >> n >> k;

	vector<int> a(n);
	for(int i=0; i<n; i++){
		cin >> a.at(i);
	}
	long long ans=0;
	sort(a.begin(), a.end());
	for(int i=0; i<n-k; n++){
		for(int j=k; j<n; j++){
			if(j-i+1<k){
				continue;
			}else{
				int tmp = combi(j-i-1, k-2)*(a.at(j)-a.at(i))%INF;
				ans += tmp;
				ans %= INF;
			}
		}
	}
	cout << ans << endl;
}

Compiler output:
g++: internal compiler error: File size limit exceeded signal terminated program as
Please submit a full bug report, with preprocessed source (by using -freport-bug).
See <file:///usr/share/doc/gcc-14/README.Bugs> for instructions.
Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

const int MOD = 1e9 + 7;

long long nCr(int n, int r) {
	long long ans = 1;
	for (int i = n; i > n - r; i--) {
		ans *= i;
	}
	for (int i = 1; i < r + 1; i++) {
		ans /= ans;
	}
	return ans;
}

int main() {
	int N, K;
	cin >> N >> K;
	vector<int> A(N);
	for (int i = 0; i < N; i++) {
		cin >> A.at(i);
	}
	sort(A.begin(), A.end(), greater<int>());
	if (K == 1) {
		int sum = 0;
		for (int i = 0; i < N; i++) {
			sum += A.at(i);
			sum %= MOD;
		}
		cout << sum << endl;
	}
	else {
		vector<long long int> com((N - 2) - (K - 2) + 1);
		for (int i = 0; i < (N - K + 1); i++) {
			com.at(i) = nCr(K - 2 + i, K - 2);
		}
		int sum = 0;
		for (int i = 0; i < N - K + 1; i++) {
			for (int j = i + K - 1; j < N; j++) {
				int tmp = j - i - 1;
		// cout << A.at(i) << A.at(j) << " " << com.at(tmp - 1) << endl;
				if (tmp == 0) sum += (A.at(i) - A.at(j))
				if (tmp != 0) sum += (A.at(i) - A.at(j)) * com.at(tmp - 1);
				sum %= MOD;
			}
		}
		cout << sum << endl;
	}
}

Compiler output:
a.cc: In function 'int main()':
a.cc:45:73: error: expected ';' before 'if'
   45 |                                 if (tmp == 0) sum += (A.at(i) - A.at(j))
      |                                                                         ^
      |                                                                         ;
   46 |                                 if (tmp != 0) sum += (A.at(i) - A.at(j)) * com.at(tmp - 1);
      |                                 ~~
Language: C++

#include<iostream>
#include<algorithm>
#define MDL 1000000007
using namespace std;
int nCr(int n, int r) 
{ 
    return fact(n) / (fact(r) * fact(n - r)); 
} 
  
// Returns factorial of n 
int fact(int n) 
{ 
    int res = 1; 
    for (int i = 2; i <= n; i++) 
        res = res * i; 
    return res; 
} 
inline long long takemod(long long a) {
	if (a < 0) {
		return MDL + (a % MDL);
	}
	return a % MDL;
}

long long modpow(long long n, long long i) {
	if (i == 0)
		return 1;
	if (i == 1)
		return n % 1000000007;
	if (i % 2 == 0) {
		long long m = i / 2;
		long long mp = modpow(n, m);
		return (mp * mp) % MDL;
	} else {
		long long m = i / 2;
		long long mp1 = modpow(n, m), mp2 = modpow(n, m + 1);
		return (mp1 * mp2) % MDL;
	}
}


inline long long modmul(long long a, long long b) {
	return (takemod(a) * takemod(b)) % MDL;
}

long long moddiv(long long a, long long b) {
	const long long p =  MDL;
	long long r1, cb1, r2, cb2;
	a = takemod(a);
	b = takemod(b);
	r1 = p; cb1 = 0;
	r2 = b; cb2 = 1;

	while(r2 != 1) {
		long long r, cb, d;
		d = r1 / r2;
		r = r1 - d * r2;
		cb = (cb1 - d * cb2) % MDL;
		r1 = r2; cb1 = cb2;
		r2 = r; cb2 = cb;
	}
	return takemod(modmul(cb2, a));
}
int main() {
	long long n, k, a[100000];
	long long sum[100000];
	cin >> n >> k;
	for(int i = 0; i < n; i++)
		cin >> a[i];

	sort(a, a+n);
	sum[0] = a[0];
	for(int i = 1; i < n; i++)
		sum[i] = sum[i-1]+a[i];
	long long res = 0;
	long long ick = 1;
	for(int i = k; i < n; i++) {
		long long c = sum[n-1] - sum[i-1] - sum[n-i];
		ick = nCr(i-2, k-2);
		res += moddiv(c, ick);
		res = takemod(res);
	}
	cout << res << endl;
}



Compiler output:
a.cc: In function 'int nCr(int, int)':
a.cc:7:12: error: 'fact' was not declared in this scope
    7 |     return fact(n) / (fact(r) * fact(n - r));
      |            ^~~~
Language: C++

#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
#define MOD 1000000007

long long fac[MOD], finv[MOD], inv[MOD];

// テーブルを作る前処理
void Cinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  int N, K;
  int A[100005];
  ll dp1[100005];
  ll dp2[100005];
  int i;
  cin >> N >> K;
  for (i = 0; i < N; i++) {
    cin >> A[i];
    dp1[i+1] = 0;
    dp2[i+1] = 0;
  }
  sort(A, A+N);
  dp1[K] = A[K-1];
  for (i = K+1; i <= N; i++) {
    dp1[i] = (dp1[i-1] + (COM(i-1, K-1)*A[i-1]) % MOD) % MOD;
  }
  sort(A, A+N, greater<int>());
  dp2[K] = A[K-1];
  for (i = K+1; i <= N; i++) {
    dp2[i] = (dp2[i-1] + (C0M(i-1, K-1)*A[i-1]) % MOD) % MOD;
  }
  cout << (dp1[N]+mod-dp2[N]) % MOD << endl;
  // for (i = K; i <= N; i++)
  //  cout << dp2[i] << ' ';
  // cout << dp2[N] << endl;
}


Compiler output:
a.cc: In function 'void Cinit()':
a.cc:14:25: error: 'MAX' was not declared in this scope
   14 |     for (int i = 2; i < MAX; i++){
      |                         ^~~
a.cc: In function 'int main()':
a.cc:48:27: error: 'C0M' was not declared in this scope; did you mean 'COM'?
   48 |     dp2[i] = (dp2[i-1] + (C0M(i-1, K-1)*A[i-1]) % MOD) % MOD;
      |                           ^~~
      |                           COM
a.cc:50:19: error: 'mod' was not declared in this scope
   50 |   cout << (dp1[N]+mod-dp2[N]) % MOD << endl;
      |                   ^~~
Language: C++


using namespace std;
#define int long long
#define mod(a) (a % MOD + MOD) % MOD
const int N = 1e6 + 10, MOD = 1e9 + 7;
int a[N], fac[N], inv[N];

int mul(int a, int b) {return mod(a * b);}

int Pow(int a, int b)
{
    int res = 1;
    for (; b; b>>=1, a = mul(a, a)) if (b & 1) res = mul(res, a);
    return res;
}

int C(int n, int k)
{
    if (k < 0 || n < 0 || k > n) return 0;
    return mul(fac[n], mul(inv[k], inv[n - k]));
}

int32_t main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int n, k; cin >> n >> k;

    fac[0] = 1;
    for (int i = 1; i <= n; i++) fac[i] = mul(fac[i - 1], i);
    inv[n] = Pow(fac[n], MOD - 2);
    for (int i = n - 1; i >= 0; i--) inv[i] = mul(inv[i + 1], i + 1);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n);
    int ans = 0;
    for (int i = 0; i < n; i++)
        ans = (ans - mul(a[i], C(n - i - 1, k - 1)) + MOD) % MOD;
    for (int i = n - 1; i >= 0; i--)
        ans = (ans + mul(a[i], C(i, k - 1)) + MOD) % MOD;
    cout << ans << "\n";
}


Compiler output:
a.cc:23:1: error: 'int32_t' does not name a type
   23 | int32_t main()
      | ^~~~~~~
a.cc:1:1: note: 'int32_t' is defined in header '<cstdint>'; this is probably fixable by adding '#include <cstdint>'
  +++ |+#include <cstdint>
    1 |
Language: C++

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

#define mod 1000000007

long long int combination(long long int n,long long int r)
{
    if (r == 0 || r == n)
        return (1);
    else if (r == 1)
        return (n);
    return ((combination(n - 1, r - 1) + combination(n - 1, r))%mod);
}

int main(){
 int N;
 int K;
 cin >> N >> K;
 if(K==1)cout << 0 << endl;
 else{
 int a[N];
 int i;
 for(i=0;i<M;++i){
   cin >> a[i];
   }
sort(a,a+N);
long long int count = 0;
 for(i=K-1;i<N;++i){
  count+=((a[i]*combination(i,K-1))%mod);
  count %= mod;
 }
 for(i=0;i<N-K+1;i++){
     count -= ((a[i]*combination(N-i-1,K-1))%mod);
     count %= mod;
 }
cout << count << endl;
 }
}

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

#include <iostream>

using namespace std;

typedef long long int uint64;

int main(int argc, char **argv)
{
    int N, K;
    uint64 A[100000];
    cin >> N >> K;
    for (int i = 0; i < N; ++i) cin >> A[i];

    // sort A
    sort(A, A + N);

    uint64 minSum = 0, maxSum = 0;
    for (int i = 0; i < N - K + 1; ++i) {
        uint64 count = 1;
        for (int j = N - 1 - i; j >= (N - 1 - i) - (K - 1) +1; --j) {
            count *= j;
        }
        minSum += A[i] * count;
    }
    for (int i = K - 1; i < N; ++i) {
        uint64 count = 1;
        for (int j = i; j >= (i) - (K - 1) + 1; --j) {
            count *= j;
        }
        maxSum += A[i] * count;
    }
    uint64 k1kaijo = 1;
    for (int i = 0; i < K - 1; ++i) k1kaijo *= (i + 1);

    cout << maxSum << ", " << minSum << endl;
    cout << (((maxSum - minSum) / k1kaijo) % (1000000000 + 7));

    return 0;
}


Compiler output:
a.cc: In function 'int main(int, char**)':
a.cc:15:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   15 |     sort(A, A + N);
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <vector>

using namespace std;

const int MOD = 1000000007;
const int MAX = 110000;

long long fac[MAX], finv[MAX], inv[MAX];

void comInit() {
	fac[0] = fac[1] = inv[1] = finv[0] = finv[1] = 1;
	for (int i = 2; i < MAX; ++i) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

long long nCr(int n, int r) {
	if (n < r || n < 0 || r < 0) return 0;
	return fac[n] * (finv[r] * finv[n - r] % MOD) % MOD;
}

int main() {
	comInit();
	int n, k; cin >> n >> k;
	vector<int> a(n);
	for (auto& e : a) cin >> e;
	sort(a.begin(), a.end());
	long long smax = 0, smin = 0;
	for (int i = 0; i < n; ++i) {
		(smax += nCr(i, k - 1) * a[i]) %= MOD;
		(smin += nCr(n - i - 1, k - 1) * a[i]) %= MOD;
	}
	cout << (MOD + smax - smin) % MOD << endl;

	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:30:9: error: 'sort' was not declared in this scope; did you mean 'short'?
   30 |         sort(a.begin(), a.end());
      |         ^~~~
      |         short
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
#define int long
#define ll long long
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) x.size()
#define fi first
#define se second
const int INF = 1e9;
const int MOD = 1e9+7;
using namespace std;

template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;

using pi=pair<int,int>;
using vi=vc<int>;

template<class T>
inline bool chmax(T &a,T b){if(a<b){a=b;return true;}return false;}
template<class T>
inline bool chmin(T &a,T b){if(a>b){a=b;return true;}return false;}

const int MX = 777777 + 5;
int fac[MX+5],inv[MX+5];
 
int power(int x,int y,int p){
	int res=1;
	x=x%p;
	while(y){
		if(y&1)res=(res*x)%p;
		y=y>>1;
		x=(x*x)%p;
	}
	return res;
}
void init(){
  int n=MX+4;
	fac[0] = 1;
  for(int i=0;i<n;++i)fac[i+1]=fac[i]*(i+1)%MOD;
  inv[n]=power(fac[n],MOD-2,MOD);
  for(int i=n-1;i>=0;--i)inv[i]=inv[i+1]*(i+1)%MOD;
}
// nPk = nCk * fac[k]
int comb(int n,int r){return (fac[n]*inv[r])%MOD*inv[n-r]%MOD;}

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);
    init();

    int N,K; cin >> N >> K;
    int A[N]; rep(i,N) cin >> A[i];
    int ans=0;
    sort(A,A+N);
    per(i,N){
        if(i<K-1) break;
        ans=(ans+(A[i]*comb(i,K-1))%MOD)%MOD;
    }
    rep(i,N){
        if(N-i-1<K-1) break;
        ans-=(A[i]*comb(N-i-1,K-1))%MOD;
        ans%=MOD
    }
    if(ans<0) ans+=MOD;
    cout << ans << endl;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:83:17: error: expected ';' before '}' token
   83 |         ans%=MOD
      |                 ^
      |                 ;
   84 |     }
      |     ~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll N=2e5+5;
const ll mod=1e9+7;
ll fct[N],inv[N],invfct[N];
void init(){
    fct[0]=fct[1]=1;
	inv[1]=1;
	invfct[0]=invfct[1]=1;
	for(ll i=2;i<N;i++){
		fct[i]=i*fct[i-1]%mod;
		inv[i]=ll(mod-inv[mod%i])*(mod/i)%mod;
		invfct[i]=ll(inv[i])*invfct[i-1]%mod;
	}
}
inline nck(ll n,ll k){
    if(k>n)return 0;
    ll val = fct[n]*invfct[k];
    val%=mod;
    val = val*invfct[n-k];
    val%=mod;
    return val;
}

int main(){
    ios_base:: sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    ll n,k;cin>>n>>k;
    init();
    map<ll,ll> mp;
    for(ll i=0,x;i<n;i++)cin>>x,mp[x]++;
    vector<ll> a;
    vector<ll> org;
    ll tot=0;
    for(auto &ele:mp)a.push_back(ele.second),tot+=ele.second,org.push_back(ele.first);
    ll mx=0,mn=0;
    ll prv=0;
    for(ll i=0;i<a.size();i++){
        ll cnt=a[i];
        ll big_equal = tot-prv;

        if(big_equal>=k){
            ll big=tot-prv-a[i];
            for(ll j=1;j<=cnt;j++){
                ll frombig = k - j;
                ll val = org[i];
                ll tot = nck(cnt,j)*nck(big,frombig);
                tot%=mod;
                mn = mn + (val*tot)%mod;
                mn%=mod;
            }
        }

        ll small_equal = prv+cnt;
        if(small_equal>=k){
            ll small = prv;
            for(ll j=1;j<=cnt;j++){
                ll fromsmall = k-j;
                ll val=org[i];
                ll tot= nck(cnt,j)*nck(small,fromsmall);
                tot%=mod;
                mx = mx + (val*tot)%mod;
                mx%=mod;
            }
        }

        prv+=a[i];
    }
    cout<<( mx - mn  + mod )%mod;
}


Compiler output:
a.cc:17:8: error: ISO C++ forbids declaration of 'nck' with no type [-fpermissive]
   17 | inline nck(ll n,ll k){
      |        ^~~
Language: C++

#include<bits/stdc++.h>
 
using namespace std;
 
typedef long long int ll;
#define pb push_back
#define mp make_pair


ll fac[100002]; 
ll power(ll x, ll y, ll p) 
{ 
    ll res = 1;      // Initialize result 
    x = x % p; 
    while (y > 0) 
    { 
        if (y & 1) 
            res = (res*x) % p; 
  
        y = y>>1; // y = y/2 
        x = (x*x) % p; 
    } 
    return res; 
} 
  
ll modInverse(ll n, ll p) 
{ 
    return power(n, p-2, p); 
} 
  
ll nCrModPFermat(ll n, ll r, ll p) 
{ 
   if (r==0) 
      return 1; 
    return (fac[n]* modInverse(fac[r], p) % p * 
            modInverse(fac[n-r], p) % p) % p; 
}
int  main()
{
    fac[0] = 1; 
    for (ll i=1 ; i<=100001; i++) 
        fac[i] = fac[i-1]*i%p; 
	ll n,k;
	ll i,m=1e9+7,a[100002];
	scanf("%lld%lld",&n,&k);	
	for(i=0;i<n;i++)
		scanf("%lld",&a[i]);
	sort(a,a+n);
	ll minsum=0;
	ll maxsum=0;
	for(i=0;i<=n-k;i++){
		minsum+= nCrModPFermat(n-i-1,k-1,m)*a[i];
		minsum%=m;
	}
	for(i=k-1;i<n;i++){
		maxsum+= nCrModPFermat(i,k-1,m)*a[i];
		maxsum%=m;
	}
	ll ans=maxsum-minsum;
	if(ans<0)
		ans+=m;
	ans%=m;
	printf("%lld\n",ans );
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:42:29: error: 'p' was not declared in this scope
   42 |         fac[i] = fac[i-1]*i%p;
      |                             ^
Language: C++


#include<bits/stdc++.h>
using namespace std;
const int MAX = 1000000;
const int MOD = 1000000007;
long long fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++){
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}
long long COM(int n, int k){
  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
int main() {
  COMinit();
  long N,K;cin>>N>>K;
  vector<long>A(N);for(int i=0;i<N;i++)cin>>A[i];
  
  //min
  sort(A.begin(),A.end());
  long long x=0;
  for(int i=0;i<=N-K;i++){
    x=(x+COM(N-i-1,K-1)*A[i]%MOD)%MOD;
  }
  
  //max
  reverse(A.begin(),A.end());
  long long y=0;
  for(int i=0;i<=N-K;i++){
    y=(y+COM(N-i-1,K-1)*A[i]%MOD)%MOD;
  }
  
  cout<<(y-x+2*MOD)%MOD;
  assert(y-x>=0);

Compiler output:
a.cc: In function 'int main()':
a.cc:42:18: error: expected '}' at end of input
   42 |   assert(y-x>=0);
      |                  ^
a.cc:22:12: note: to match this '{'
   22 | int main() {
      |            ^
Language: C++

#include <iostream>
#include <vector>
using namespace std;
typedef long long ll;

const ll MOD = 1000000007;

ll modpow(ll x, ll n){
    ll res = 1;
    ll mul = x;
    while(n){
        if(n % 2) res = res * mul % MOD;
        mul = mul * mul % MOD;
        n /= 2;
    }
    return res;
}

struct Combination
{
    int maxn;
    vector<ll> fmemo;
    vector<ll> imemo;
    vector<ll> ifmemo;
    
    Combination(int maxn) : maxn(maxn){
        fmemo.resize(maxn + 1);
        imemo.resize(maxn + 1);
        ifmemo.resize(maxn + 1);
        for(ll i = 1; i <= maxn; i++){
            imemo[i] = modpow(i, MOD - 2);
        }
    }

    ll fact(ll n){
        if(n == 0) return 1;
        if(fmemo[n]) return fmemo[n];
        return fmemo[n] = n * fact(n - 1) % MOD;
    }

    ll ifact(ll n){
        if(n == 0) return 1;
        if(ifmemo[n]) return ifmemo[n];
        return ifmemo[n] = imemo[n] * ifact(n - 1) % MOD;
    }

    ll com(ll n, ll k){
        if(k < 0) return 0;
        if(k > n) return 0;
        if(k == n || k == 0) return 1;
        return (fact(n) * ifact(k) % MOD) * ifact(n - k) % MOD;
    }
};

int main()
{
    ll n, k;
    cin >> n >> k;
    ll a[100002];
    for(int i = 0; i < n; i++) cin >> a[i];
    sort(a, a + n, greater<ll>());
    ll m = 0;
    Combination c(n + 1);
    for(int i = 0; i < n; i++){
        m = (m + (c.com(n - i, k) + MOD - c.com(n - i - 1, k)) % MOD * a[i] % MOD) % MOD;
        m = (m + MOD - (c.com(i + 1, k) + MOD - c.com(i, k)) % MOD * a[i] % MOD) % MOD;
    }
    cout << m << endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:61:5: error: 'sort' was not declared in this scope; did you mean 'short'?
   61 |     sort(a, a + n, greater<ll>());
      |     ^~~~
      |     short
Language: C++

#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <tuple>
#include <memory>
#include <cmath>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <numeric>
#include <climits>
#include <cfloat>
#include <cassert>
#include <random>
constexpr long long int MOD = 1000000007;
int main() {
	int n, k; std::cin >> n >> k;
	std::vector<int> numbers(n); for (auto& a : numbers) std::cin >> a;
	std::sort(numbers.begin(), numbers.end());
	std::vector<long long int> factorial(n + 1, 1), inv(n + 1, 1), inv_fact(n + 1, 1);
	for (auto i = 2; i <= n; ++i) {
		factorial[i] = i * factorial[i - 1] % MOD;
		inv[i] = (MOD - MOD / i) * inv[MOD % i] % MOD;
		inv_fact[i] = inv[i] * inv_fact[i - 1] % MOD;
	}
	long long int result = 0;
	int length = 1;
	for (auto i = 0; i < numbers.size(); ++i) {
		if (i == numbers.size() - 1 || numbers[i] != numbers[i + 1]) {
			const auto prev = (i + 1) - length;
			const auto next = n - i - 1;
			if (prev + length >= k) {
				const auto all = factorial[prev + length] * inv_fact[k] % MOD * inv_fact[prev + length - k] % MOD;
				const auto not = (prev >= k) ? (factorial[prev] * inv_fact[prev - k] % MOD * inv_fact[k] % MOD) : 0LL;
				result += (all - not) % MOD * numbers[i] % MOD;
				result %= MOD;
			}
			if (next + length >= k) {
				const auto all = factorial[next + length] * inv_fact[k] % MOD * inv_fact[next + length - k] % MOD;
				const auto not = (next >= k) ? (factorial[next] * inv_fact[next - k] % MOD * inv_fact[k] % MOD) : 0LL;
				result -= (all - not) % MOD * numbers[i] % MOD;
				result %= MOD;
			}
			length = 1;
		}
		else ++length;
	}
	std::cout << (result % MOD + MOD) % MOD << std::endl;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:41:44: error: expected unqualified-id before 'not' token
   41 |                                 const auto not = (prev >= k) ? (factorial[prev] * inv_fact[prev - k] % MOD * inv_fact[k] % MOD) : 0LL;
      |                                            ^~~
a.cc:42:53: error: expected primary-expression before ')' token
   42 |                                 result += (all - not) % MOD * numbers[i] % MOD;
      |                                                     ^
a.cc:47:44: error: expected unqualified-id before 'not' token
   47 |                                 const auto not = (next >= k) ? (factorial[next] * inv_fact[next - k] % MOD * inv_fact[k] % MOD) : 0LL;
      |                                            ^~~
a.cc:48:53: error: expected primary-expression before ')' token
   48 |                                 result -= (all - not) % MOD * numbers[i] % MOD;
      |                                                     ^
Language: C++

#include <bits/stdc++.h>
#include "../lib/math/comb.hpp"

using namespace std;

#define SZ(x) (int)(x.size())

using ll = long long;
using ld = long double;
using P = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
const double eps = 1e-10;
const ll MOD = 1000000007;
const int INF = 1000000000;
const ll LINF = 1ll<<50;

template<typename T>
void printv(const vector<T>& s) {
  for(int i=0;i<(int)(s.size());++i) {
    cout << s[i];
    if(i == (int)(s.size())-1) cout << endl;
    else cout << " ";
  }
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n, k; cin >> n >> k;
  vll a(n);
  for(int i=0;i<n;++i) {
    cin >> a[i];
  }
  sort(a.begin(), a.end());

  Combination<MOD> comb(1000000);

  ll g = 0, h = 0;
  for(int i=k-1;i<n;++i) {
    ll tmp = comb.C(i, k-1) * a[i] % MOD;
    g += tmp;
    g %= MOD;
  }

  reverse(a.begin(), a.end());
  for(int i=k-1;i<n;++i) {
    ll tmp = comb.C(i, k-1) * a[i] % MOD;
    h += tmp;
    h %= MOD;
  }
  //cout << g << endl;
  //cout << h << endl;

  cout << (g + MOD - h) % MOD << endl;

}


Compiler output:
a.cc:2:10: fatal error: ../lib/math/comb.hpp: No such file or directory
    2 | #include "../lib/math/comb.hpp"
      |          ^~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include<cstdio>
using namespace std;
int n,m,sum,k,a;
int read(){
    char cc = getchar(); int cn = 0 ,flus = 1;
    while(cc < '0' || cc > '9') {if(cc == '-') flus = - flus ; cc = getchar();}
    while(cc >= '0' && cc <= '9') cn = cn * 10 + cc - '0' ,cc = getchar();
    return cn * flus;
}
int main()
{
	n = read() ,k = read() ,m = read();
	for(int i = 1 ; i < n ; ++ i)
	{
		a = read();
		sum += a - m;
	}
	printf("%d",m - sum > k ? -1 : max(0 , m - sum));
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:18:40: error: 'max' was not declared in this scope
   18 |         printf("%d",m - sum > k ? -1 : max(0 , m - sum));
      |                                        ^~~
Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define ssort(a) sort(a.begin(), a.end())
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
	int n;
  cin >> n;
  vector<int> x(n);
  vector<int> y(n);
  rep(i, n){
    cin >> x[i] >> y[i];
  }
  if(n==2){
    cout << fixed << setprecision(10) << sqrt((x[0]-x[1])*(x[0]-x[1])+(y[0]-y[1])*(y[0]-y[1])) << endl;
    return 0
  }
	double x1,x2,x3,y1,y2,y3,ox,oy,r;
  double ans=10000;
	for(int i=0;i<n;i++){
    for(int j=i+1; j<n; j++){
      for(int k=j+1; k<n; k++){
        x1=(double)x[i];y1=(double)y[i];
        x2=(double)x[j];y2=(double)y[j];
        x3=(double)x[k];y3=(double)y[k];
        ox=((y2-y1)*((y3*y3-y1*y1)+(x3*x3-x1*x1))-(y3-y1)*((y2*y2-y1*y1)+(x2*x2-x1*x1)))/
    				(2*((x3-x1)*(y2-y1)-(x2-x1)*(y3-y1)));
    		if(y2 != y1){
    			oy=(2*(x1-x2)*ox+(y2*y2-y1*y1)+(x2*x2-x1*x1))/(2*(y2-y1));
    		}else{
    			oy=(2*(x1-x3)*ox+(y3*y3-y1*y1)+(x3*x3-x1*x1))/(2*(y3-y1));
    		}
        r = sqrt((ox-x1)*(ox-x1)+(oy-y1)*(oy-y1));
        bool ok=true;
        rep(i, n){
          double r2=sqrt((ox-x[i])*(ox-x[i])+(oy-y[i])*(oy-y[i]));
          if(r2-r>0.0000001){
            ok=false;
            break;
          }
        }
        if(ok){
          ans=min(ans, r);
        }
      }
    }



	}
  cout << fixed << setprecision(10) << ans << endl;
    return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:26:13: error: expected ';' before '}' token
   26 |     return 0
      |             ^
      |             ;
   27 |   }
      |   ~
Language: C++

//#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>
#include<tuple>

#define DIV 1000000007
#define TE 2e6+5
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
	ldb N; cin >> N;
	vector<pair<ldb, ldb>> po(N);
	ldb cx = 0, cy = 0;
	for (int i = 0; i < N; i++) {
		cin >> po[i].first >> po[i].second;
		cx += po[i].first, cy += po[i].second;
	}

	cx /= N, cy /= N;
	//cout << "cx=" << cx << " cy=" << cy << endl;
	ldb r = 0;
	for (int i = 0; i < N; i++) {
		r = max(r, (po[i].first - cx) * (po[i].first - cx)+(po[i].second - cy)* (po[i].second - cy));
		//cout << "r=" << r << endl;
	}
	printf("%.10lf\n", sqrt(r));
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:28: error: 'sqrt' was not declared in this scope
   34 |         printf("%.10lf\n", sqrt(r));
      |                            ^~~~
Language: C++

#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
#include <iomanip>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<long double> VD;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef vector<VD> VVD;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;

template<typename T> void chmin(T &a, T b) { if (a > b) a = b; }
template<typename T> void chmax(T &a, T b) { if (a < b) a = b; }

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }
#define INF 1LL<<60

int N;
vector< pair<double, double> > points;

double calc_max(double s, double t) {
    double r_max = 0;
    REP(i, N) {
        r_max = max(r_max, sqrt( pow(points[i].first - s, 2) + pow(points[i].second - t, 2) ));
    }
    return r_max;
}

int main() {
    cin >> N;
    points.resize(N);
    REP(i, N) {
        cin >> points[i].first >> points[i].second;
    }

    double slb = 0, sub = 1000, tlb = 0, tub = 1000;

    double score = calc_max(500, 500), d = 1e9, sM, tM, s1, s2, s3, s4;
    while(abs(d) > 1e-9) {
        double tmp = score;
        sM = (slb + sub) / 2.0, tM = (tlb + tub) / 2.0;
        s1 = calc_max((slb + sM) / 2, tM), s2 = calc_max((sM + sub)/2, tM);
        if(s1 < s2)
            sub = sM;
        else
            slb = sM;
        
        sM = (slb + sub) / 2.0;

        s3 = calc_max(sM, (tlb + tM) / 2), s4 = calc_max(sM, (tM + tub) / 2);
        if(s3 < s4)
            tub = tM;
        else
            tlb = tM;
        
        tM = (tlb + tub) / 2.0;

        s1 = calc_max((slb + sM) / 2, tM), s2 = calc_max((sM + sub)/2, tM);
        if(s1 < s2)
            sub = sM;
        else
            slb = sM;
        
        sM = (slb + sub) / 2.0;

        s3 = calc_max(sM, (tlb + tM) / 2), s4 = calc_max(sM, (tM + tub) / 2);
        if(s3 < s4)
            tub = tM;
        else
            tlb = tM;
        
        tM = (tlb + tub) / 2.0
        
        score = calc_max(sM, tM);
        d = tmp - score;
        // cerr << sM << " " << tM << " tmp = " << tmp << " score = " << score << endl;
    }

    double ans = calc_max(sM, tM);
    // cerr << sM << " " << tM << endl;
    printf("%.12f\n", ans);

    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:94:31: error: expected ';' before 'score'
   94 |         tM = (tlb + tub) / 2.0
      |                               ^
      |                               ;
   95 | 
   96 |         score = calc_max(sM, tM);
      |         ~~~~~
Language: C++

#include<bits/stdc++.h>
//using namespace std;
#define rep(i,j,n) for(ll i=(ll)(j);i<(ll)(n);i++)
#define REP(i,j,n) for(ll i=(ll)(j);i<=(ll)(n);i++)
#define per(i,j,n) for(ll i=(ll)(j);(ll)(n)<=i;i--)
#define ll double
#define int double
#define ALL(a) (a).begin(),(a).end()
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(ll)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(ll)(key)))
#define pb push_back
#define mp std::make_pair
#define endl "\n"
using std::cin;
using std::cout;
using std::vector;
using std::string;
using std::upper_bound;
using std::lower_bound;
using vi=vector<ll>;
using vii=vector<vi>;
using pii=std::pair<ll,ll>;
const ll MOD=1e9+7;
//const ll MOD=998244353;
const ll MAX=500000;
const ll INF=(1ll<<62)-1;
std::pair<double,double> func(int A,int B,int C,int D,int E,int F){
    ll G=C-A,H=D-B,I=E-A,J=F-B;
    if(G*J==H*I) return mp(INF,INF);
    double K=(C+A)/2.0*G*1.0+(D+B)/2.0*H*1.0,L=(E+A)/2.0*I*1.0+(F+B)/2.0*J*1.0;
    if(G==0||I==0){
        if(I==0) std::swap(G,I),std::swap(H,J),std::swap(K,L);
        double Y=K/H,X=(L-J*Y)/I;
        return mp(X,Y);
    }
    ll p=G*I/std::__gcd(G,I);
    G*=p/G,H*=p/G,K*=p/G,I*=p/I,J*=p/I,L*=p/I;
    double Y=(K-L)*1.0/(H-J),X=(K-H*Y)*1.0/G;
    return mp(X,Y);
}
signed main(){
    int N; cin>>N;
    vi A(N),B(N);
    rep(i,0,N) cin>>A[i]>>B[i];
    double ans=MOD;
    rep(i,0,N-1){
        rep(j,i+1,N){
            double X=(A[i]+A[j])/2.0,Y=(B[i]+B[j])/2.0;
            double max=0;
            rep(k,0,N){
                double P=A[k]-X,Q=B[k]-Y;
                max=std::max(max,P*P+Q*Q);
            }
            ans=std::min(ans,sqrt(max));
        }
    }
    rep(i,0,N-2){
        rep(j,i+1,N-1){
            rep(k,j+1,N){
                int C=A[j]-A[i],D=B[j]-B[i],E=A[k]-A[i],F=B[k]-B[i];
                int S=abs(C*F-D*E);
                if(S==0) continue;
                std::pair<double,double> p=func(A[i],B[i],A[j],B[j],A[k],B[k]);
                if(p.first>=MOD) continue;
                double X=p.first,Y=p.second;
                double max=0;
            	rep(k,0,N){
                	double P=A[k]-X,Q=B[k]-Y;
                	max=std::max(max,P*P+Q*Q);
            	}
            	ans=std::min(ans,sqrt(max));
            }
        }
    }
    printf("%.10lf\n",ans);
}


Compiler output:
In file included from /usr/include/c++/14/algorithm:61,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algo.h: In instantiation of '_EuclideanRingElement std::__gcd(_EuclideanRingElement, _EuclideanRingElement) [with _EuclideanRingElement = double]':
a.cc:36:24:   required from here
   36 |     ll p=G*I/std::__gcd(G,I);
      |              ~~~~~~~~~~^~~~~
/usr/include/c++/14/bits/stl_algo.h:1141:43: error: invalid operands of types 'double' and 'double' to binary 'operator%'
 1141 |           _EuclideanRingElement __t = __m % __n;
      |                                       ~~~~^~~~~
Language: C++

#include <stdio.h>
#include <math.h>

int n,x[55],y[55];
double gx,gy;

int main()
{
  scanf ("%d",&n);
  for (int i=0;i<n;i++) scanf ("%d %d",&x[i],&y[i]), gx +=x[i], gy += y[i];
  gx /= n, gy /= n;
  
double ans;
  for (double p=1;p>=1e-5;p*=0.99){
int idx = -1; double dist = -1;
    for (int i=0;i<n;i++){
		double d = hypot(x[i]-gx,y[i]-gy);
      if (dist < d) dist = d, idx = i;
    }
    gx += (x[i] - gx) * p;
    gy += (y[i] - gy) * p;
    ans = dist;
  }
  
  printf ("%.12lf\n",ans);
return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:14: error: 'i' was not declared in this scope
   20 |     gx += (x[i] - gx) * p;
      |              ^
Language: C++

#include <stdio.h>
#include <math.h>

int n,x[55],y[55];
double gx,gy;

int main()
{
  scanf ("%d",&n);
  for (int i=0;i<n;i++) scanf ("%d %d",&x[i],&y[i]), gx +=x[i], gy += y[i];
  gx /= n, gy /= n;
  
double ans;
  for (double p=1;p>=1e-5;p*=0.99){
int idx = -1; double dist = -1;
    for (int i=0;i<n;i++){
		double d = hypoy(x[i]-gx,y[i]-gy);
      if (dist < d) dist = d, idx = i;
    }
    gx += (x[i] - gx) * p;
    gy += (y[i] - gy) * p;
    ans = dist;
  }
  
  printf ("%.12lf\n",ans);
return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:17:28: error: 'hypoy' was not declared in this scope; did you mean 'hypot'?
   17 |                 double d = hypoy(x[i]-gx,y[i]-gy);
      |                            ^~~~~
      |                            hypot
a.cc:20:14: error: 'i' was not declared in this scope
   20 |     gx += (x[i] - gx) * p;
      |              ^