#ifndef H_COMMON
#define H_COMMON
#define NDEBUG
#include <assert.h>
#include <optional>
#include <vector>
#include <cstdint>
#include <string>
#include <tuple>
#include <string>
#include <iostream>
using namespace std;
typedef std::uint8_t u8;
typedef std::uint16_t u16;
typedef std::uint32_t u32;
typedef std::int32_t i32;
typedef std::uint64_t u64;
typedef std::int64_t i64;
typedef std::size_t usize;
template <class T>
using Option = std::optional<T>;
typedef const std::string str;
#define unimplemented(ERR) throw std::runtime_error(err_concat("Unimplemented, ", ERR));
#define unreachable(ERR) throw std::runtime_error(err_concat("Unreachable reached", ERR));
#define api_err(ERR) throw std::domain_error(ERR);
#define input_err(ERR) throw std::domain_error(err_concat("Invalid input parameters, ", ERR));
#define unknown_parameter_err(ERR) throw std::domain_error(err_concat("parameter has value out of bounds, ", ERR));
#define unexpected_zero_err(ERR) throw std::domain_error(err_concat("parameter expected to be non-zero, ", ERR));
#define UNUSED(x) (void)(x)
std::string err_concat(std::string const &a, std::string const &b);
std::string stringf(const char *format, ...);
template <class... Args>
void println(const char *format, Args &&... args)
{
#ifndef NDEBUG
std::cout << stringf(format, std::forward<Args>(args)...) << std::endl;
#endif
}
enum TwistType
{
D,
M
};
#endif