1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "dzilib.h"
#include <bits/stdc++.h>

using namespace std;
using lint = long long;
using pi = array<lint, 2>;
#define sz(v) ((int)(v).size())
#define all(v) (v).begin(), (v).end()
#define cr(v, n) (v).clear(), (v).resize(n);

const int MAXN = 1100005;
#define div fuck
int div[MAXN];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	for (int i = 1; i < MAXN; i++) {
		for (int j = i; j < MAXN; j += i) {
			div[j] += 1;
		}
	}
	int t = GetT();
	lint n = GetN();
	lint q = GetQ();
	lint c = GetC();
	assert(n < MAXN - 69);
	for (int i = 0; i < t; i++) {
		vector<int> v;
		for (int j = 0; j < 20; j++) {
			v.push_back(Ask(j));
		}
		for (int i = 1; i <= n; i++) {
			bool ok = 1;
			for (int j = 0; j < 20; j++) {
				if (div[i + j] != v[j]) {
					ok = 0;
					break;
				}
			}
			if (ok) {
				Answer(i);
				break;
			}
		}
	}
}