2023-07-10 20:20:19 +02:00
|
|
|
|
#include <algorithm>
|
2023-07-29 15:27:25 +02:00
|
|
|
|
#include <array>
|
2023-07-23 11:39:05 +02:00
|
|
|
|
#include <bit>
|
2023-07-29 15:27:25 +02:00
|
|
|
|
#include <bitset>
|
2023-07-10 20:20:19 +02:00
|
|
|
|
#include <cassert>
|
|
|
|
|
#include <cctype>
|
2023-07-29 15:27:25 +02:00
|
|
|
|
#include <chrono>
|
|
|
|
|
#include <cmath>
|
2023-07-10 20:20:19 +02:00
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <functional>
|
2023-07-29 15:27:25 +02:00
|
|
|
|
#include <iomanip>
|
2023-05-14 14:39:42 +02:00
|
|
|
|
#include <iostream>
|
2023-07-23 11:39:05 +02:00
|
|
|
|
#include <map>
|
2023-07-29 15:27:25 +02:00
|
|
|
|
#include <numeric>
|
2023-07-10 20:20:19 +02:00
|
|
|
|
#include <optional>
|
2023-07-23 11:39:05 +02:00
|
|
|
|
#include <queue>
|
2023-07-29 15:27:25 +02:00
|
|
|
|
#include <random>
|
2023-07-23 11:39:05 +02:00
|
|
|
|
#include <set>
|
2023-07-10 20:20:19 +02:00
|
|
|
|
#include <sstream>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <vector>
|
2023-05-14 14:39:42 +02:00
|
|
|
|
|
2023-07-29 15:57:32 +02:00
|
|
|
|
#pragma region helpers
|
2023-07-23 11:39:05 +02:00
|
|
|
|
|
2023-07-29 15:57:32 +02:00
|
|
|
|
#pragma region math
|
2023-07-23 20:42:09 +02:00
|
|
|
|
static constexpr std::int32_t MODULO = 1000000007;
|
2023-07-23 11:39:05 +02:00
|
|
|
|
|
2023-07-10 11:39:30 +02:00
|
|
|
|
long pow(long base, long exp) {
|
2023-07-10 14:23:09 +02:00
|
|
|
|
if (exp == 0) return 1;
|
2023-07-10 11:39:30 +02:00
|
|
|
|
long half = pow(base, exp / 2);
|
2023-07-10 14:23:09 +02:00
|
|
|
|
if (exp % 2 == 0) return half * half;
|
2023-07-10 11:39:30 +02:00
|
|
|
|
return half * half * base;
|
|
|
|
|
}
|
2023-07-29 15:57:32 +02:00
|
|
|
|
#pragma endregion /* math */
|
2023-07-10 11:39:30 +02:00
|
|
|
|
|
2023-07-29 15:57:32 +02:00
|
|
|
|
#pragma region output
|
|
|
|
|
template <typename T, typename U>
|
|
|
|
|
std::ostream &operator<<(std::ostream &os, std::pair<T, U> const &p) {
|
|
|
|
|
return os << p.first << " " << p.second;
|
|
|
|
|
}
|
2023-07-23 11:39:05 +02:00
|
|
|
|
|
2023-07-29 16:00:10 +02:00
|
|
|
|
template <typename C, typename T = typename std::enable_if<
|
|
|
|
|
!std::is_same<C, std::string>::value,
|
|
|
|
|
typename C::value_type>::type>
|
|
|
|
|
std::ostream &operator<<(std::ostream &os, const C &v) {
|
|
|
|
|
std::string sep;
|
|
|
|
|
for (const T &x : v) {
|
|
|
|
|
os << sep << x, sep = " ";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return os;
|
|
|
|
|
}
|
2023-07-23 11:39:05 +02:00
|
|
|
|
|
2023-07-29 15:57:32 +02:00
|
|
|
|
template <typename T>
|
|
|
|
|
inline void answer(const T &ans) {
|
|
|
|
|
std::cout << ans << "\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
inline void yes() { std::cout << "YES\n"; }
|
|
|
|
|
inline void no() { std::cout << "NO\n"; }
|
|
|
|
|
inline void yesno(bool ans) { std::cout << (ans ? "YES" : "NO") << "\n"; }
|
2023-07-29 16:01:18 +02:00
|
|
|
|
#pragma endregion /* output */
|
|
|
|
|
|
|
|
|
|
#pragma region debug
|
|
|
|
|
void dbg_out() { std::cerr << std::endl; }
|
|
|
|
|
template <typename Head, typename... Tail>
|
|
|
|
|
void dbg_out(Head H, Tail... T) {
|
|
|
|
|
std::cerr << ' ' << H;
|
|
|
|
|
dbg_out(T...);
|
|
|
|
|
}
|
|
|
|
|
#ifdef LOCAL
|
|
|
|
|
#define dbg(...) \
|
|
|
|
|
std::cerr << '[' << __FILE__ << ':' << __LINE__ << "] (" << #__VA_ARGS__ \
|
|
|
|
|
<< "):", \
|
|
|
|
|
dbg_out(__VA_ARGS__)
|
|
|
|
|
#else
|
|
|
|
|
#define dbg(...)
|
|
|
|
|
#endif
|
|
|
|
|
#pragma endregion debug
|
2023-07-29 15:57:32 +02:00
|
|
|
|
|
|
|
|
|
#pragma region input
|
2023-07-23 11:39:05 +02:00
|
|
|
|
template <typename T>
|
|
|
|
|
std::vector<T> load_vector(std::size_t size) {
|
|
|
|
|
std::vector<T> result{};
|
|
|
|
|
|
|
|
|
|
for (auto i = 0u; i < size; ++i) {
|
|
|
|
|
T x;
|
|
|
|
|
std::cin >> x;
|
|
|
|
|
result.push_back(std::move(x));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
}
|
2023-07-29 15:57:32 +02:00
|
|
|
|
#pragma endregion /* input */
|
2023-07-23 11:39:05 +02:00
|
|
|
|
|
2023-07-29 16:01:32 +02:00
|
|
|
|
#pragma region functional
|
|
|
|
|
// http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/p0200r0.html
|
|
|
|
|
template <class Fun>
|
|
|
|
|
class y_combinator_result {
|
|
|
|
|
Fun fun_;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
template <class T>
|
|
|
|
|
explicit y_combinator_result(T &&fun) : fun_(std::forward<T>(fun)) {}
|
|
|
|
|
template <class... Args>
|
|
|
|
|
decltype(auto) operator()(Args &&...args) {
|
|
|
|
|
return fun_(std::ref(*this), std::forward<Args>(args)...);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
template <class Fun>
|
|
|
|
|
decltype(auto) y_combinator(Fun &&fun) {
|
|
|
|
|
return y_combinator_result<std::decay_t<Fun>>(std::forward<Fun>(fun));
|
|
|
|
|
}
|
|
|
|
|
#pragma endregion /* functional */
|
2023-07-23 11:39:05 +02:00
|
|
|
|
|
2023-07-23 20:42:09 +02:00
|
|
|
|
#define LOOP(var, n) for (auto var = 0; var < n; ++var)
|
2023-07-23 11:39:05 +02:00
|
|
|
|
|
2023-07-29 15:57:32 +02:00
|
|
|
|
#pragma endregion /* helpers */
|
2023-07-10 14:23:09 +02:00
|
|
|
|
|
2023-07-23 11:39:05 +02:00
|
|
|
|
// for ‹N› test cases, uncomment for single test case
|
|
|
|
|
// #define SINGLE
|
|
|
|
|
|
|
|
|
|
namespace solution {
|
2023-07-10 14:23:09 +02:00
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
2023-05-14 14:39:42 +02:00
|
|
|
|
void solve() {
|
|
|
|
|
// TODO
|
2023-07-29 15:59:06 +02:00
|
|
|
|
dbg("Hello from debug");
|
|
|
|
|
answer("Hello");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void tests() {
|
|
|
|
|
// TODO
|
2023-05-14 14:39:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-07-23 11:39:05 +02:00
|
|
|
|
} // namespace solution
|
2023-05-14 14:39:42 +02:00
|
|
|
|
|
2023-07-23 11:39:05 +02:00
|
|
|
|
using namespace solution;
|
2023-07-10 09:53:39 +02:00
|
|
|
|
|
2023-07-10 14:23:09 +02:00
|
|
|
|
#ifdef TEST
|
|
|
|
|
|
2023-07-29 15:59:06 +02:00
|
|
|
|
int main(void) {
|
|
|
|
|
tests();
|
|
|
|
|
return 0;
|
2023-07-10 14:23:09 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
2023-07-10 09:53:39 +02:00
|
|
|
|
|
2023-05-14 14:39:42 +02:00
|
|
|
|
int main(void) {
|
2023-07-29 15:59:06 +02:00
|
|
|
|
int N = 1;
|
2023-07-10 09:53:39 +02:00
|
|
|
|
|
2023-07-29 15:59:06 +02:00
|
|
|
|
#ifndef SINGLE
|
2023-07-10 09:53:39 +02:00
|
|
|
|
|
2023-07-29 15:59:06 +02:00
|
|
|
|
std::cin >> N;
|
2023-07-10 09:53:39 +02:00
|
|
|
|
|
2023-07-29 15:59:06 +02:00
|
|
|
|
#endif
|
2023-07-10 09:53:39 +02:00
|
|
|
|
|
2023-07-29 15:59:06 +02:00
|
|
|
|
while (N-- > 0) {
|
|
|
|
|
solve();
|
2023-07-10 09:53:39 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-05-14 14:39:42 +02:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2023-07-10 09:53:39 +02:00
|
|
|
|
|
2023-07-10 14:23:09 +02:00
|
|
|
|
#endif
|