signedmain(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n, k; std::cin >> n >> k;
std::vector<std::string> s(n + 1); for (int i = 1; i <= n; i++) { int x; std::cin >> x >> s[i]; }
std::vector<std::vector<int>> G(110, std::vector<int>(110, inf)); for (int i = 1; i <= n; i++) { for (int j = i + 1; j <= n; j++) { auto LCS = [&](std::string a, std::string b) { std::vector<std::vector<int>> dp(a.size() + 1, std::vector<int>(b.size() + 1)); for (int i = 1; i <= a.size(); i++) { for (int j = 1; j <= b.size(); j++) { dp[i][j] = std::max(dp[i - 1][j], dp[i][j - 1]); if (a[i - 1] == b[j - 1]) { dp[i][j] = std::max(dp[i - 1][j - 1] + 1, dp[i][j]); } } } int li = a.size(), lj = b.size(); G[i][j] = G[j][i] = std::min(std::min({li, lj, k}) + li + lj - 2 * dp[a.size()][b.size()], G[i][j]); }; LCS(s[i], s[j]); } }
for (int i = 1; i <= n; i++) { G[n + 1][i] = s[i].size(); }
std::vector<int> dist(n + 2, inf), vis(n + 2); dist[n + 1] = 0; std::function<int()> prim = [&]() { int res = 0; for (int i = 1; i <= n + 1; i++) { int t = -1; for (int j = 1; j <= n + 1; j++) { if (!vis[j] && (t == -1 || dist[t] > dist[j])) { t = j; } } if (i && dist[t] == inf) return inf;
signedmain(){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n;
i64 sum = 0; for (int i = 0; i < n; i++) { int x; std::cin >> x; sum += x; }
i64 ans = 0; for (int i = 29; i >= 0; i--) { if (((1LL << i) - 1) * n < sum) { ans |= 1LL << i; int t = std::min(1LL * n, sum >> i); sum -= 1LL * t * (1 << i); } }