---
tags : codebook
---
# 測資生成
## Input
```cpp=
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define GET(i, x) get<i>(x)
#define ms(a, b) memset(a, b, sizeof(a))
#define ALL(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep2(i, a, b) for(int i = a; i <= b; ++i)
#define minn(a, b) a = min(a, b);
#define maxx(a, b) a = max(a, b);
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
constexpr ll MOD = 1e9 + 7;
unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
const string Problem_str = "a422"; // Problem_number
const int Test_num = 10; // Cases
const vector<tuple<int, int, ll>> _test_range = { // Case Range
{0, 1, (ll)1e1},
{2, 4, (ll)1e2},
{5, 9, (ll)3 * 1e3},
};
vector<ll> Test_Range;
void build_test_range() {
Test_Range = vector<ll>(Test_num);
for(auto& x : _test_range) {
for(int i = GET(0, x); i <= GET(1, x); ++i) {
Test_Range[i] = GET(2, x);
cout << Test_Range[i] << " ";
}
}
cout << '\n';
}
string itos(int a){
char c[] = {(char)(a / 10 + '0'), (char)(a % 10 + '0'), '\0'};
return string(c).data();
}
mt19937 gen(seed);
void create(int i) {
fstream fin(Problem_str + "_" + itos(i) + ".in", ios::out);
uniform_int_distribution<int> Range(Test_Range[i] - 5, Test_Range[i]);
uniform_int_distribution<int> Num_Range(-10, 10);
// Start Building Input Here
}
void create() {
cout << "START BUILDING" << '\n';
build_test_range();
for(int i = 0; i < Test_num; ++i) {
cout << "BUILDING ON CASE" << i << '\n';
create(i);
}
cout << "FINISHED\n";
system("pause");
}
int main() {
create();
}
```
## Output
```cpp=
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define eb emplace_back
#define GET(i, x) get<i>(x)
#define ms(a, b) memset(a, b, sizeof(a))
#define ALL(x) x.begin(), x.end()
#define rep(i, n) for(int i = 0; i < n; ++i)
#define rep2(i, a, b) for(int i = a; i <= b; ++i)
#define minn(a, b) a = min(a, b);
#define maxx(a, b) a = max(a, b);
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
constexpr ll MOD = 1e9 + 7;
fstream fin, fout;
const string Problem_str = "a422";
const int Test_num = 10;
inline void solve() {
// Solve your input here
// int a; fin >> a;
// fout << a << '\n';
}
string itos(int a){
char c[] = {(char)(a / 10 + '0'), (char)(a % 10 + '0'), '\0'};
return string(c).data();
}
int main() {
for(int i = 0; i < Test_num; ++i) {
cout << "BUILDING ON" << i << '\n';
clock_t time = clock();
fin = fstream(Problem_str + "_" + itos(i) + ".in", ios::in);
fout = fstream(Problem_str + "_" + itos(i) + ".out", ios::out);
solve();
cout << "Use " << static_cast<double>(clock() - time) / CLOCKS_PER_SEC << " seconds\n";
}
cout << "FINISHED\n";
system("pause");
}
```