Language: C++


#if 1
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <array>
#include <deque>
#include <algorithm>
#include <utility>
#include <cstdint>
#include <functional>
#include <iomanip>
#include <numeric>

#define in std::cin
#define out std::cout
template<typename Arithmetic, typename Integral>
std::enable_if_t< std::is_unsigned<Integral>::value, Arithmetic>
ipow(Arithmetic bace, Integral n)
{
	//繰り返し二条法
	auto res = (Arithmetic)(1);
	while (n > 0) {
		if (n & 1) res *= bace;
		bace *= bace;
		n >>= 1;
	}
	return res;
}
constexpr bool is_prime(uint64_t N)
{
	if (N <= 1) {
		return false;
	}
	for (uint64_t i = 2; i <= N/i+1; ++i)
	{
		if (N%i == 0) {
			return false;
		}
	}
	return true;
}
static_assert(is_prime(7365373222715531));
static_assert(false);

template <uint64_t MOD> class mint_base;
//mint_base_base型用の累乗関数
template <uint64_t MOD> constexpr mint_base<MOD> m_pow(mint_base<MOD> x, uint64_t n)noexcept;
//mod計算を自動で行う整数テンプレートクラス
template <uint64_t MOD_ = 1000000007>
class mint_base
{
public:
	static constexpr auto MOD = MOD_;
	static_assert(!(MOD <= 2), "MOD cannot be below 2.");
	static_assert(MOD <= (0xFFFFFFFFFFFFFFFF / 2), "MOD is too big");//加算してオーバーフローしない
	//static_assert(MOD <= 0xFFFFFFFF, "MOD is too big");//乗算してオーバーフローしない
	constexpr mint_base<MOD> operator+(const mint_base<MOD> &other)const noexcept
	{
		auto v = *this;
		return v += other;
	}
	constexpr mint_base<MOD> operator-(const mint_base<MOD> &other)const noexcept
	{
		auto v = *this;
		return v -= other;
	}
	constexpr mint_base<MOD> operator*(const mint_base<MOD> &other)const noexcept
	{
		auto v = *this;
		return v *= other;
	}
	constexpr auto operator/(const mint_base<MOD> &other)const noexcept
	{
		auto v = *this;
		return v /= other;
	}
	constexpr mint_base<MOD>& operator+=(const mint_base<MOD> &other) noexcept
	{
		a += other.a;
		if (MOD <= a) { a -= MOD; };
		return *this;
	}
	constexpr mint_base<MOD>& operator-=(const mint_base<MOD> &other) noexcept
	{
		if (a >= other.a) {
			a -= other.a;
		}
		else {
			a = (a + MOD) - other.a;
		}
		return *this;
	}
	constexpr mint_base<MOD>& operator*=(const mint_base<MOD> &other) noexcept
	{
#if 0
		a *= other.a;
		a %= MOD;
#else
		//MOD <= (MAXUINT64 / 2)条件下
		uint64_t b = other.a, v = 0;
		while (b > 0) {
			if (b & 1) {
				v += a;
				if (v >= MOD)v -= MOD;
			}
			*this+=*this;
			b >>= 1;
		}
		a = v;
#endif
		return *this;
	}
	constexpr std::enable_if_t<is_prime(MOD), mint_base<MOD>&>
		operator/=(const mint_base<MOD> &other) noexcept
	{
		return *this *= ipow(other, MOD - 2);
	}
	constexpr mint_base<MOD> operator+()const noexcept { return *this; }
	constexpr mint_base<MOD> operator-()const noexcept
	{
		return{ MOD - a, mod_value_tag{} };
	}
	constexpr mint_base<MOD>& operator++() noexcept
	{
		if (MOD <= ++a) { a = 0; };
		return *this;
	}
	constexpr mint_base<MOD>& operator--() noexcept
	{
		if (a <= 0) { a = MOD; };
		--a;
		return *this;
	}
	constexpr mint_base<MOD> operator++(int) noexcept
	{
		auto tmp = *this;
		++*this;
		return tmp;
	}
	constexpr mint_base<MOD> operator--(int) noexcept
	{
		auto tmp = *this;
		--*this;
		return tmp;
	}
	//constexpr mint_base<MOD> operator~()const noexcept
	//{
	//	return ipow(*this, e_phi - 1);
	//}
	constexpr mint_base<MOD>& operator=(const mint_base<MOD> &other) noexcept
	{
		a = other.a;
		return *this;
	}
	constexpr explicit operator uint64_t()const noexcept
	{
		return a;
	}
	constexpr explicit operator unsigned()const noexcept
	{
		return (unsigned)a;
	}
	static constexpr uint64_t getmod() noexcept
	{
		return MOD;
	}
	constexpr mint_base(uint64_t a_) noexcept :a(a_ % MOD) {}
	constexpr mint_base()noexcept : a(0) {}
	struct mod_value_tag {};
	constexpr mint_base(uint64_t a_, mod_value_tag) :a(a_) {}
private:
	//static constexpr uint64_t get_e_phi()noexcept {
	//	//オイラー値の導出
	//	uint64_t temp = MOD;
	//	uint64_t m_ = MOD;
	//	for (uint64_t i = 2; i <= m_/i+1; ++i)
	//	{
	//		if (m_ % i == 0)
	//		{
	//			temp = temp / i * (i - 1);
	//			for (; m_ % i == 0; m_ /= i);
	//		}
	//	}
	//	if (m_ == 1)temp = temp / m_ * (m_ - 1);
	//	return temp;
	//}
	//static constexpr uint64_t e_phi = get_e_phi();//オイラー値
	uint64_t a;
};
//mint_base型用の累乗関数
template<uint64_t MOD>constexpr mint_base<MOD> m_pow(mint_base<MOD> x, uint64_t n)noexcept
{
	mint_base<MOD> res = 1;
	while (n > 0)
	{
		if (n & 1)res *= x;
		x *= x;
		n >>= 1;
	}
	return res;
}
//mint_baseの階乗計算
//O(x)時間が必要のため、fact_set関数を推奨する。
template<uint64_t MOD>constexpr mint_base<MOD> fact(mint_base<MOD> x)noexcept
{
	mint_base<MOD> res(1);
	for (uint64_t i = 1; i <= (uint64_t)x; ++i)
	{
		res *= i;
	}
	return res;
}
//mint_baseの階乗計算
//0からxまでの階乗を返す
//O(x)時間が必要
template<uint64_t MOD>std::vector<mint_base<MOD>> fact_set(mint_base<MOD> x = mint_base<MOD>(-1))
{
	mint_base<MOD> res(1);
	std::vector<mint_base<MOD>> set((uint64_t)(x)+1);
	set[0] = 1;
	for (uint64_t i = 1; i <= (uint64_t)x; ++i)
	{
		res *= i;
		set[i] = res;
	}
	return res;
}
//mint_base型のstreamへの出力
template<uint64_t MOD> std::ostream& operator<<(std::ostream& os, mint_base<MOD> i)
{
	os << (uint64_t)i;
	return os;
}
//mint_base型のstreamからの入力
template<uint64_t MOD> std::istream& operator >> (std::istream& is, mint_base<MOD>& i)
{
	uint64_t tmp;
	is >> tmp;
	i = tmp;
	return is;
}
typedef mint_base<7365373222715531> mint;//最大の答えより大きいmod
namespace mint_literal {
	constexpr mint operator""_mi(unsigned long long x)noexcept {
		return mint(x);
	}
}
using namespace mint_literal;
//mint_baseの階乗計算
//0からxまでの階乗を返す
//O(N) //O(1)
template<uint64_t X, uint64_t MOD = mint::MOD>
/*constexpr*/ std::array<mint_base<MOD>, X + 1> fact_set_c()
{
	mint_base<MOD> res(1);
	std::array<mint_base<MOD>, X + 1> set;
	set[0] = 1;
	for (uint64_t i = 1; i <= X; ++i)
	{
		res *= i;
		set[i] = res;
	}
	return set;
}
auto fact_v = fact_set_c<51>();

int32_t N;
int32_t MIN, MAX;
int64_t A[100];

int main()
{
	using std::endl;
	in.sync_with_stdio(false);
	out.sync_with_stdio(false);

	in >> N;
	in >> MIN >> MAX;
	for (size_t i = 0; i < N; i++)
	{
		in >> A[i];
	}
	std::sort(A, A + N, std::greater<>{});

	double sum = 0;
	for (size_t i = 0; i < MIN; ++i)
	{
		sum += A[i];
	}
	out << std::fixed << std::setprecision(7) << sum / MIN << endl;

	auto range = std::equal_range(A, A + N, A[MIN - 1]);
	auto range_lrngth = range.second - range.first;
	auto not_free = range.first - A;
	mint count = 0;
	for (size_t i = MIN; i <= MAX; ++i)
	{
		auto free = (MIN - not_free) + (i-MIN);
		count += fact_v[free] / fact_v[(MIN - not_free)] / fact_v[free - (MIN - not_free)];
	}
	out << count << endl;

#if 0
	using BS_INT = double;
	BS_INT beg = 1, end = 10000000000000000 + 1;
	for (size_t loop = 0; loop < 10000; loop++)
	{
		BS_INT mid = (beg + end) / 2;
		bool ok = false;

		//平均をmidに出来るか
		BS_INT cap = 0;
		for (size_t i = 0; i < MIN; i++) {
			cap += (A[i] - mid);
		}
		if (cap >= 0) { ok = true; }
		else for (size_t i = MIN; i < MAX; i++) {
			cap += (A[i] - mid);
			if (cap >= 0) { ok = true; break; }
		}

		if (ok) {
			beg = mid;
		}
		else {
			end = mid;
		}
	}
	out << beg << endl;
#endif

	return 0;
}
#endif


Compiler output:
a.cc:50:23: error: non-constant condition for static assertion
   50 | static_assert(is_prime(7365373222715531));
      |               ~~~~~~~~^~~~~~~~~~~~~~~~~~
a.cc:50:23:   in 'constexpr' expansion of 'is_prime(7365373222715531)'
a.cc:42:9: error: 'constexpr' loop iteration count exceeds limit of 262144 (use '-fconstexpr-loop-limit=' to increase the limit)
   42 |         for (uint64_t i = 2; i <= N/i+1; ++i)
      |         ^~~
a.cc:51:15: error: static assertion failed
   51 | static_assert(false);
      |               ^~~~~
a.cc: In instantiation of 'class mint_base<7365373222715531>':
a.cc:252:52:   required from here
  252 |         constexpr mint operator""_mi(unsigned long long x)noexcept {
      |                                                           ^~~~~~~~
a.cc:121:37:   in 'constexpr' expansion of 'is_prime(((long unsigned int)mint_base<7365373222715531>::MOD))'
a.cc:42:9: error: 'constexpr' loop iteration count exceeds limit of 262144 (use '-fconstexpr-loop-limit=' to increase the limit)
   42 |         for (uint64_t i = 2; i <= N/i+1; ++i)
      |         ^~~
a.cc:121:44: note: in template argument for type 'bool'
  121 |         constexpr std::enable_if_t<is_prime(MOD), mint_base<MOD>&>
      |                                    ~~~~~~~~^~~~~
a.cc: In instantiation of 'constexpr auto mint_base<MOD>::operator/(const mint_base<MOD>&) const [with long unsigned int MOD_ = 7365373222715531]':
a.cc:307:50:   required from here
  307 |                 count += fact_v[free] / fact_v[(MIN - not_free)] / fact_v[free - (MIN - not_free)];
      |                                                                ^
a.cc:83:26: error: no match for 'operator/=' (operand types are 'mint_base<7365373222715531>' and 'const mint_base<7365373222715531>')
   83 |                 return v /= other;
      |                        ~~^~~~~~~~