QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#335221#837. Giant Penguinsinsop90AC ✓390ms109844kbC++143.8kb2024-02-22 22:37:382024-02-22 22:37:40

Judging History

你现在查看的是最新测评结果

  • [2024-02-22 22:37:40]
  • 评测
  • 测评结果:AC
  • 用时:390ms
  • 内存:109844kb
  • [2024-02-22 22:37:38]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5, INF = 1e9;
int vis[maxn], n, SZ, rt, F[maxn], sz[maxn], head[maxn], tot, dis[maxn], visn[maxn], vism[maxn], m, K, QQ, visq[maxn];
vector<int> vec[maxn], imp;
vector<pair<int, int>> tag[maxn];
queue<int> Q;
struct edge {
	int v, pre;
}e[maxn << 1];
void add(int u, int v) {
	e[++ tot].v = v;
	e[tot].pre = head[u];
	head[u] = tot;
}
void make_tree(int now) {
//	cout << now << '\n';
	vis[now] = 1;
	for(int i = head[now];i;i = e[i].pre) {
		int v = e[i].v;
		if(vis[v]) continue;
		vec[now].push_back(v), vec[v].push_back(now);
		make_tree(v);
	}
}
void getSZ(int now, int f) {
//	cout << now << " " << f << " !!\n";
	SZ ++;
	visq[now] = 1;
	F[now] = sz[now] = 0;
	for(int v : vec[now]) {
		if(v == f || vis[v]) continue;
		getSZ(v, now);
	}
}
void getrt(int now, int f) {
	sz[now] = 1;
	for(int v : vec[now]) {
		if(vis[v] || v == f) continue;
		getrt(v, now);
		sz[now] += sz[v];
		F[now] = max(F[now], sz[v]);
	}
	
	F[now] = max(F[now], SZ - F[now]);
	if(!rt || F[now] < F[rt]) rt = now;
}
void check(int now, int f, int id) {
	visn[now] = id;
	for(int v : vec[now]) {
		if(v == f || vis[v]) continue;
		check(v, now, id);
	}
}
void getim(int now, int f) {
	for(int i = head[now];i;i = e[i].pre) {
		int v = e[i].v;
		if(v == f || !visq[v]) continue;
		if(visn[v] > visn[now] || v == rt) imp.push_back(now);  
	}
	for(int v : vec[now]) {
		if(v == f || vis[v]) continue;
		getim(v, now);
	}
}
void getdis(int now) {
//	cout << now << " \n";
	Q.push(now);
	vism[now] = 1;
	tag[now].push_back(make_pair(now, 0));
	while(!Q.empty()) {
		int t = Q.front();
		Q.pop();
		for(int i = head[t];i;i = e[i].pre) {
			int v = e[i].v;
//			cout << t << " " << v << " " << vism[v] << " " << visq[v] << "\n";
			if(!visq[v] || vism[v]) continue;
			vism[v] = vism[t] + 1;
			tag[v].push_back(make_pair(now, vism[v] - 1));
			Q.push(v);
		}
	}
}
void cleartag(int now, int f, int OP) {
//	cout << now << '\n';
	vism[now] = 0;
	if(OP) visq[now] = 0;
	for(int v : vec[now]) {
		if(v == f || vis[v]) continue;
		cleartag(v, now, OP);
	}
}
void dfs(int now, int f) {
	SZ = rt = 0;
	getSZ(now, f);
	getrt(now, f);
	
//	cout << rt << " " << F[rt] << " !!!" << '\n';
	for(int v : vec[rt]) {
		if(vis[v]) continue;
		check(v, rt, v);
	}
	imp.clear();
	for(int v : vec[rt]) {
		if(vis[v]) continue;
		getim(v, rt);
	}
	sort(imp.begin(), imp.end()), imp.resize(unique(imp.begin(), imp.end()) - imp.begin());
	for(int x : imp) getdis(x), cleartag(rt, rt, 0);
	getdis(rt), cleartag(rt, rt, 1);
	vis[rt] = 1;
	for(int v : vec[rt]) {
		if(vis[v]) continue;
		dfs(v, rt);
	}
}
/*
6 5 0
1 2
2 3
3 4
4 5
5 6
10
1 1
2 6
2 5
2 4
2 3
1 6
2 3
2 4
2 5
2 6

6 5 0
1 2
2 3
3 4
4 5
5 6
3
1 1
1 6
2 5

5 7 0
1 2
2 3
3 4
4 5
1 4
1 5
1 3
2
1 5
2 4

5 7 0
1 2
2 3
3 4
4 5
2 4
1 5
1 4
4
1 5
1 3
1 2
2 4

5 7 0
1 2
2 3
3 4
4 5
1 4
3 5
2 5
2
1 1
2 4
*/
int main() {
//	freopen("1.in", "r", stdin);
//	freopen("my.out", "w", stdout);
	ios::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	cin >> n >> m >> K;
	for(int i = 1, u, v;i <= m;i++) {
		cin >> u >> v;
		add(u, v), add(v, u);
	}
	make_tree(1);
	for(int i = 1;i <= n;i++) vis[i] = 0, dis[i] = INF;
	dfs(1, 0);
	cin >> QQ;
	for(int i = 1, op, x;i <= QQ;i++) {
		cin >> op >> x;
		if(op == 1) {
			for(pair<int, int> t : tag[x]) {
//				cout << t.first << " " << t.second << '\n';
				dis[t.first] = min(dis[t.first], t.second);
			}
		}
		else {
			int ans = INF;
			for(pair<int, int> t : tag[x]) {
//				cout << t.first << " " << dis[t.first] << " " << t.second << '\n';
				ans = min(ans, t.second + dis[t.first]);
			}
			cout << ans << '\n';
		}
	}
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 12964kb

input:

5 4 0
1 2
2 3
3 4
4 5
7
1 1
1 5
2 1
2 2
2 3
2 4
2 5

output:

0
1
2
1
0

result:

ok 5 number(s): "0 1 2 1 0"

Test #2:

score: 0
Accepted
time: 5ms
memory: 12968kb

input:

5 6 2
1 2
2 3
1 3
3 4
4 5
3 5
3
1 1
2 4
2 5

output:

2
2

result:

ok 2 number(s): "2 2"

Test #3:

score: 0
Accepted
time: 26ms
memory: 13288kb

input:

100 99 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
52...

output:

99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
99
98
97
9...

result:

ok 199968 numbers

Test #4:

score: 0
Accepted
time: 23ms
memory: 13216kb

input:

100 99 0
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61...

output:

1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
0
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 199966 numbers

Test #5:

score: 0
Accepted
time: 18ms
memory: 13004kb

input:

100 99 0
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
2 25
1 26
1 27
1 28
2 29
1 30
1 31
1 32
1 33
2 34
1 35
1 36
2 37
1 38
4 39
1 40
1 41
2 42
2 43
1 44
1 45
2 46
1 47
1 48
1 49
2 50
2 51
1 52
1 53
1 54
2 55
3 56
2 57
1 58
2 59
2 60
3 61...

output:

2
3
3
1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
4
3
3
3
3
4
3
3
4
3
2
3
3
4
4
3
3
4
3
3
3
4
4
3
3
3
4
4
4
3
4
4
4
3
3
4
3
3
3
4
4
4
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
4
4
3
0
3
3
4
3
4
3
3
4
3
4
2
3
3
1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
4
3
3
3
3
4
3
3
4
3
2
3
3
4
4
3
3
4
3
3
3
4
...

result:

ok 199964 numbers

Test #6:

score: 0
Accepted
time: 18ms
memory: 13268kb

input:

100 99 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
28 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
39 41
41 42
41 43
41 44
44 45
44 46
46 47
44 48
48 49
48 50
50 51
50 52
51...

output:

68
67
66
65
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
42
40
39
38
37
36
35
34
33
32
31
32
30
31
31
29
30
30
31
28
29
27
28
26
29
25
24
23
24
22
25
26
21
22
23
20
19
20
18
17
18
16
15
14
16
13
14
15
12
16
11
10
9
10
8
16
7
6
5
6
7
4
7
8
9
10
11
3
10
2
1
0
68
67
66
65
64
...

result:

ok 199966 numbers

Test #7:

score: 0
Accepted
time: 22ms
memory: 12940kb

input:

100 102 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
...

output:

24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
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
37
36
35
34
33
32
31
30
29
28
27
26
25
26
27
28
29
30
31
32
33
34
35
36
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
1...

result:

ok 199973 numbers

Test #8:

score: 0
Accepted
time: 22ms
memory: 13072kb

input:

75 102 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 1
1 19
13 25
1 26
26 27
27 1
2 28
28 29
29 2
3 30
30 31
31 3
4 32
32 33
33 4
5 34
34 35
35 5
6 36
36 37
37 6
7 38
38 39
39 7
8 40
40 41
41 8
9 42
42 43
43 9
10 ...

output:

6
5
4
3
2
1
2
3
4
5
6
7
8
9
10
10
9
8
7
8
9
10
9
8
7
7
7
6
6
5
5
4
4
3
3
1
0
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
11
11
10
10
9
9
8
8
9
9
10
10
11
11
10
10
9
9
8
8
6
5
4
3
2
1
2
3
4
5
6
7
8
9
10
10
9
8
7
8
9
10
9
8
7
7
7
6
6
5
5
4
4
3
3
1
0
3
3
4
4
5
5
6
6
7
7
8
8
9
9
10
10
11
11
11
11
10
10
9
9
...

result:

ok 199971 numbers

Test #9:

score: 0
Accepted
time: 19ms
memory: 13048kb

input:

100 174 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
34 36...

output:

1
1
0
1
3
2
3
3
5
5
5
4
7
7
6
7
9
9
9
8
10
11
11
11
13
13
12
13
13
14
14
14
15
16
16
16
18
18
17
18
19
20
20
20
19
18
19
19
20
21
21
21
20
19
20
20
22
21
22
22
22
22
21
22
22
22
22
21
24
24
23
24
24
24
23
24
25
26
26
26
25
24
25
25
26
25
26
26
26
26
26
25
27
27
27
26
27
27
27
26
1
1
0
1
3
2
3
3
5
5
...

result:

ok 199981 numbers

Test #10:

score: 0
Accepted
time: 27ms
memory: 13280kb

input:

100 118 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
2 9
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
22 25
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 4...

output:

31
30
31
32
33
34
33
32
31
32
26
27
28
29
30
31
30
29
28
27
32
31
30
31
32
33
34
35
34
33
26
27
26
25
24
23
22
23
24
25
20
21
21
20
21
21
20
19
18
19
12
13
14
15
16
17
16
15
14
13
10
11
10
9
8
7
6
7
8
9
24
24
23
24
23
22
21
22
23
24
1
0
1
2
3
4
5
4
3
2
26
27
28
27
26
27
26
25
24
25
31
30
31
32
33
34...

result:

ok 199963 numbers

Test #11:

score: 0
Accepted
time: 26ms
memory: 12992kb

input:

100 119 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
2 5
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
26 30
22 24
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 5...

output:

1
2
3
4
3
4
3
2
1
0
9
8
7
6
5
6
7
8
9
10
8
9
10
10
9
8
8
7
6
7
13
12
11
10
11
12
13
14
15
14
13
14
15
16
15
16
17
16
15
14
17
16
15
16
15
14
13
14
15
16
20
19
18
17
18
19
19
18
19
20
17
17
18
18
17
16
15
14
15
16
18
19
20
19
18
17
18
17
16
17
21
22
23
24
25
24
23
22
21
20
1
2
3
4
3
4
3
2
1
0
9
8
7
6...

result:

ok 199976 numbers

Test #12:

score: 0
Accepted
time: 22ms
memory: 13008kb

input:

100 119 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
13 19
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
24 26
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
35 38
31 33
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48...

output:

3
2
1
0
1
2
3
4
5
4
10
10
9
9
8
7
6
7
8
9
11
12
12
11
11
10
9
8
9
10
15
16
15
14
13
12
11
12
13
14
17
16
15
14
13
12
13
14
15
16
21
21
20
20
19
18
17
18
19
20
21
22
23
22
21
20
19
18
19
20
23
22
21
22
23
24
23
22
23
24
27
26
25
24
23
24
25
26
27
27
28
29
30
31
32
33
32
31
30
29
3
2
1
0
1
2
3
4
5
4
1...

result:

ok 199969 numbers

Test #13:

score: 0
Accepted
time: 22ms
memory: 13068kb

input:

84 123 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 38
22...

output:

9
10
10
10
10
10
10
8
9
10
10
10
10
10
10
10
10
10
10
10
10
6
7
7
7
7
6
5
7
7
7
7
7
7
7
7
7
7
7
7
7
7
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
3
4
5
5
5
5
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
0
2
2
9
10
10
10
10
10
10
8
9
10
10
10
10
10
10
10
10
10
10
10
10
6
7
7
7
7
6
5
7
7
7
7
7
7
7
7
7
7
7
7
7
7
4
5
5
5
5
5
...

result:

ok 199952 numbers

Test #14:

score: 0
Accepted
time: 14ms
memory: 13064kb

input:

100 132 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 40
4...

output:

66
66
65
64
64
63
62
62
61
60
60
59
58
58
57
56
56
55
54
54
53
52
52
51
50
50
49
48
48
47
46
46
45
44
44
43
42
42
41
40
40
39
38
38
37
36
36
35
34
34
33
32
32
31
30
30
29
28
28
27
26
26
25
24
24
23
22
22
21
20
20
19
18
18
17
16
16
15
14
14
13
12
12
11
10
10
9
8
8
7
6
6
5
4
4
3
2
2
1
0
66
66
65
64
64...

result:

ok 199967 numbers

Test #15:

score: 0
Accepted
time: 23ms
memory: 13016kb

input:

99 177 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
30 31...

output:

39
39
39
38
38
37
37
37
36
36
35
35
35
34
34
33
33
33
32
32
31
31
31
30
30
29
29
29
28
28
27
27
27
26
26
25
25
25
24
24
23
23
23
22
22
21
21
21
20
20
19
19
19
18
18
17
17
17
16
16
15
15
15
14
14
13
13
13
12
12
11
11
11
10
10
9
9
9
8
8
7
7
7
6
6
5
5
5
4
4
3
3
3
2
2
1
1
1
0
39
39
39
38
38
37
37
37
36
...

result:

ok 199961 numbers

Test #16:

score: 0
Accepted
time: 23ms
memory: 13408kb

input:

500 499 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
5...

output:

0
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
10...

result:

ok 199829 numbers

Test #17:

score: 0
Accepted
time: 21ms
memory: 13036kb

input:

500 499 0
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 6...

output:

1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 199831 numbers

Test #18:

score: 0
Accepted
time: 22ms
memory: 13108kb

input:

500 499 0
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 6...

output:

2
3
3
3
3
3
3
3
1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
4
3
3
3
3
3
4
3
3
3
3
3
3
3
4
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
3
3
4
3
3
4
3
3
3
3
...

result:

ok 199828 numbers

Test #19:

score: 0
Accepted
time: 24ms
memory: 13116kb

input:

500 499 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
5...

output:

0
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
49
50
51
52
53
54
55
56
57
58
59
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
100...

result:

ok 199848 numbers

Test #20:

score: 0
Accepted
time: 23ms
memory: 13364kb

input:

500 502 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
...

output:

62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
14...

result:

ok 199808 numbers

Test #21:

score: 0
Accepted
time: 28ms
memory: 13108kb

input:

375 502 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
...

output:

32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
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
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
34
35
36
37
38
39
40
41
42
43
44
45...

result:

ok 199813 numbers

Test #22:

score: 0
Accepted
time: 25ms
memory: 13436kb

input:

500 874 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
34 36...

output:

1
1
1
0
3
2
3
3
5
5
5
4
6
7
7
7
8
7
8
8
10
10
9
10
11
12
12
12
14
14
13
14
15
16
16
16
17
17
17
16
17
18
18
18
18
19
19
19
21
20
21
21
23
23
22
23
25
25
25
24
27
27
27
26
28
29
29
29
30
30
29
30
32
32
32
31
34
34
33
34
36
36
36
35
37
38
38
38
38
39
39
39
40
41
41
41
41
42
42
42
44
44
43
44
46
45
46
...

result:

ok 199834 numbers

Test #23:

score: 0
Accepted
time: 21ms
memory: 13380kb

input:

484 530 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 1
13 17
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 23
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

6
5
4
3
2
1
0
1
2
3
4
5
6
7
8
8
7
8
9
9
8
7
20
19
18
17
16
15
14
13
12
11
10
11
12
13
14
15
16
17
18
19
20
21
25
26
27
28
29
29
28
27
26
25
24
23
22
23
24
25
26
27
27
26
25
24
30
29
28
29
30
31
32
33
34
35
36
37
38
38
37
36
35
34
33
33
32
31
33
32
31
32
32
31
30
29
30
31
32
33
34
35
36
37
38
38
37
3...

result:

ok 199829 numbers

Test #24:

score: 0
Accepted
time: 25ms
memory: 13104kb

input:

500 594 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
5 7
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
33 40
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 4...

output:

43
42
43
44
45
46
46
46
45
44
40
39
38
39
40
41
42
43
42
41
40
41
40
39
38
37
36
37
38
39
45
46
45
44
43
42
41
42
43
44
32
33
34
35
36
35
34
33
32
31
38
37
36
35
36
37
38
39
40
39
37
36
35
34
33
32
33
34
35
36
38
39
40
39
38
37
36
35
36
37
32
33
33
34
35
36
36
35
34
33
45
45
44
43
42
41
42
43
44
45
...

result:

ok 199840 numbers

Test #25:

score: 0
Accepted
time: 28ms
memory: 13184kb

input:

500 518 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 1
21 23
15...

output:

23
24
23
22
21
20
19
18
17
16
15
14
13
12
11
11
10
9
8
7
6
6
5
4
3
2
1
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
41
42
43
44
45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
47
46
45
44
43
42
43...

result:

ok 199833 numbers

Test #26:

score: 0
Accepted
time: 22ms
memory: 13256kb

input:

483 712 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 38
2...

output:

1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
0
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
4
3
7
8
8
8
8
8
8
8
8
6
7
8
8
8
8
8
8
8
8
8
8
10
11
11
11
11
10
9
11
11
11
11
11
11
11
11
11
11
11
11
11
11
13
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
12
13
16
17
17
17
17
17
17
17
17
17
17
17
17
17
17
15
1...

result:

ok 199847 numbers

Test #27:

score: 0
Accepted
time: 25ms
memory: 13200kb

input:

500 665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 40
4...

output:

333
333
332
331
331
330
329
329
328
327
327
326
325
325
324
323
323
322
321
321
320
319
319
318
317
317
316
315
315
314
313
313
312
311
311
310
309
309
308
307
307
306
305
305
304
303
303
302
301
301
300
299
299
298
297
297
296
295
295
294
293
293
292
291
291
290
289
289
288
287
287
286
285
285
284
...

result:

ok 199840 numbers

Test #28:

score: 0
Accepted
time: 29ms
memory: 13224kb

input:

499 897 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
30 3...

output:

1
1
0
1
2
2
3
3
3
4
4
5
5
5
6
6
7
7
7
8
8
9
9
9
10
10
11
11
11
12
12
13
13
13
14
14
15
15
15
16
16
17
17
17
18
18
19
19
19
20
20
21
21
21
22
22
23
23
23
24
24
25
25
25
26
26
27
27
27
28
28
29
29
29
30
30
31
31
31
32
32
33
33
33
34
34
35
35
35
36
36
37
37
37
38
38
39
39
39
40
40
41
41
41
42
42
43
43
...

result:

ok 199840 numbers

Test #29:

score: 0
Accepted
time: 21ms
memory: 13320kb

input:

1000 999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
...

output:

999
998
997
996
995
994
993
992
991
990
989
988
987
986
985
984
983
982
981
980
979
978
977
976
975
974
973
972
971
970
969
968
967
966
965
964
963
962
961
960
959
958
957
956
955
954
953
952
951
950
949
948
947
946
945
944
943
942
941
940
939
938
937
936
935
934
933
932
931
930
929
928
927
926
925
...

result:

ok 199656 numbers

Test #30:

score: 0
Accepted
time: 16ms
memory: 13176kb

input:

1000 999 0
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 ...

output:

1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 199657 numbers

Test #31:

score: 0
Accepted
time: 26ms
memory: 13192kb

input:

1000 999 0
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 ...

output:

2
3
3
3
3
3
3
3
3
1
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
3
...

result:

ok 199657 numbers

Test #32:

score: 0
Accepted
time: 21ms
memory: 13560kb

input:

1000 999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
...

output:

676
675
674
673
672
671
670
669
668
667
666
665
664
663
662
661
660
659
658
657
656
655
654
653
652
651
650
649
648
647
646
645
644
643
642
641
640
639
638
637
636
635
634
633
632
631
630
629
628
627
626
625
624
623
622
621
620
619
618
617
616
615
614
613
612
611
610
609
608
607
606
605
604
603
602
...

result:

ok 199658 numbers

Test #33:

score: 0
Accepted
time: 28ms
memory: 13604kb

input:

1000 1002 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 5...

output:

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
...

result:

ok 199669 numbers

Test #34:

score: 0
Accepted
time: 29ms
memory: 13340kb

input:

750 1002 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52...

output:

33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
75
74
73
72
71
70
69
68
67
66
65
64
63
62
61
60
...

result:

ok 199665 numbers

Test #35:

score: 0
Accepted
time: 28ms
memory: 13488kb

input:

1000 1749 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
34 ...

output:

316
316
316
315
314
314
313
314
312
312
312
311
311
310
311
311
309
309
309
308
307
306
307
307
306
306
306
305
305
304
305
305
303
302
303
303
301
301
301
300
298
299
299
299
297
297
297
296
295
295
295
294
293
292
293
293
290
291
291
291
289
288
289
289
287
286
287
287
285
285
284
285
283
283
282
...

result:

ok 199658 numbers

Test #36:

score: 0
Accepted
time: 26ms
memory: 13332kb

input:

961 1017 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 1
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52
5...

output:

4
3
2
1
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
15
14
13
12
11
10
9
8
7
6
5
19
18
17
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
31
30
29
28
27
26
25
24
23
22
21
20
23
22
23
24
25
26
27
28
29
30
31
32
33
32
31
30
29
28
27
26
25
24
25
26
27
28
28
27
26
25
24
40
39
38
37
36
37
38
39
40
39
38
37
36
3...

result:

ok 199675 numbers

Test #37:

score: 0
Accepted
time: 22ms
memory: 13336kb

input:

1000 1207 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
6 10
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
32 37
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
5...

output:

86
85
84
85
86
87
88
89
88
87
82
83
84
85
86
87
86
85
84
83
78
79
80
81
82
83
82
81
80
79
84
83
84
83
82
81
82
83
84
85
78
77
78
79
80
80
79
80
79
79
73
74
75
76
75
74
73
74
73
72
70
71
72
73
72
71
70
69
68
69
68
69
68
67
66
66
65
66
67
67
68
68
67
66
65
64
65
66
66
67
65
64
63
64
65
66
67
66
65
66
...

result:

ok 199680 numbers

Test #38:

score: 0
Accepted
time: 21ms
memory: 13344kb

input:

1000 1021 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 52...

output:

27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
46
45
44
43
42
43
44
45
45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
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
70
71
72
73
74
75
7...

result:

ok 199661 numbers

Test #39:

score: 0
Accepted
time: 27ms
memory: 13552kb

input:

987 1456 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 38
...

output:

1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
1
0
4
5
5
5
5
5
5
5
5
3
4
5
5
5
5
5
5
5
5
5
5
7
6
7
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
10
11
11
11
11
11
11
11
11
11
11
11
11
10
9
11
11
11
11
11
11
13
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
13
12
14
14
16
17
17
17
17
17
17
17
17
17
17
17
17
17
17
15
1...

result:

ok 199657 numbers

Test #40:

score: 0
Accepted
time: 22ms
memory: 13404kb

input:

1000 1332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 40...

output:

0
1
1
2
3
3
4
5
5
6
7
7
8
9
9
10
11
11
12
13
13
14
15
15
16
17
17
18
19
19
20
21
21
22
23
23
24
25
25
26
27
27
28
29
29
30
31
31
32
33
33
34
35
35
36
37
37
38
39
39
40
41
41
42
43
43
44
45
45
46
47
47
48
49
49
50
51
51
52
53
53
54
55
55
56
57
57
58
59
59
60
61
61
62
63
63
64
65
65
66
67
67
68
69
69
...

result:

ok 199654 numbers

Test #41:

score: 0
Accepted
time: 23ms
memory: 13752kb

input:

999 1797 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
30 ...

output:

1
1
0
1
2
2
3
3
3
4
4
5
5
5
6
6
7
7
7
8
8
9
9
9
10
10
11
11
11
12
12
13
13
13
14
14
15
15
15
16
16
17
17
17
18
18
19
19
19
20
20
21
21
21
22
22
23
23
23
24
24
25
25
25
26
26
27
27
27
28
28
29
29
29
30
30
31
31
31
32
32
33
33
33
34
34
35
35
35
36
36
37
37
37
38
38
39
39
39
40
40
41
41
41
42
42
43
43
...

result:

ok 199648 numbers

Test #42:

score: 0
Accepted
time: 129ms
memory: 48652kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

99999
99998
99997
99996
99995
99994
99993
99992
99991
99990
99989
99988
99987
99986
99985
99984
99983
99982
99981
99980
99979
99978
99977
99976
99975
99972
99971
99970
99969
99968
99967
99966
99965
99964
99963
99962
99960
99959
99958
99957
99956
99955
99954
99953
99952
99951
99950
99949
99948
99947
...

result:

ok 166390 numbers

Test #43:

score: 0
Accepted
time: 128ms
memory: 48572kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

77976
77975
77973
77972
77971
77970
77969
77967
77966
77964
77963
77962
77961
77960
77959
77958
77957
77956
77955
77954
77952
77951
77950
77949
77948
77947
77946
77945
77944
77943
77941
77940
77938
77937
77935
77934
77933
77932
77931
77930
77929
77928
77927
77926
77925
77924
77923
77922
77921
77920
...

result:

ok 166848 numbers

Test #44:

score: 0
Accepted
time: 184ms
memory: 44720kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

67349
67348
67347
67346
67345
67344
67343
67342
67341
67340
67339
67338
67337
67336
67335
67334
67333
67332
67331
67330
67329
67328
67327
67325
67324
67323
67322
67321
67320
67319
67318
67317
67315
67314
67313
67312
67311
67310
67309
67308
67307
67305
67304
67303
67302
67301
67300
67299
67298
67297
...

result:

ok 166688 numbers

Test #45:

score: 0
Accepted
time: 184ms
memory: 44808kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

19118
19117
19116
19115
19114
19113
19112
19111
19110
19109
19108
19107
19106
19105
19104
19103
19101
19099
19098
19097
19096
19095
19094
19092
19091
19090
19089
19088
19087
19086
19085
19084
19083
19082
19081
19080
19079
19078
19077
19076
19075
19074
19073
19072
19071
19070
19069
19068
19067
19066
...

result:

ok 166619 numbers

Test #46:

score: 0
Accepted
time: 316ms
memory: 79032kb

input:

100000 174999 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35...

output:

29592
29593
29593
29593
29590
29591
29591
29591
29589
29589
29588
29589
29587
29587
29587
29586
29585
29586
29586
29585
29582
29582
29582
29582
29579
29580
29580
29580
29577
29578
29578
29578
29577
29577
29576
29577
29575
29574
29575
29575
29573
29573
29572
29573
29571
29570
29571
29571
29569
29567
...

result:

ok 166575 numbers

Test #47:

score: 0
Accepted
time: 319ms
memory: 79244kb

input:

100000 174999 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35...

output:

21667
21667
21666
21667
21664
21665
21665
21665
21663
21662
21663
21662
21661
21661
21660
21661
21659
21659
21659
21658
21658
21658
21658
21657
21655
21656
21655
21655
21653
21653
21653
21652
21652
21652
21652
21651
21651
21651
21651
21650
21649
21649
21648
21649
21647
21646
21647
21647
21646
21646
...

result:

ok 166947 numbers

Test #48:

score: 0
Accepted
time: 116ms
memory: 48564kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

99999
99998
99996
99995
99994
99993
99992
99991
99990
99989
99988
99986
99983
99982
99980
99979
99978
99977
99976
99975
99974
99973
99972
99971
99970
99969
99968
99966
99964
99959
99958
99956
99955
99954
99953
99952
99951
99950
99949
99948
99947
99945
99943
99942
99941
99939
99938
99937
99936
99935
...

result:

ok 150164 numbers

Test #49:

score: 0
Accepted
time: 142ms
memory: 48572kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

42631
42630
42629
42627
42626
42625
42624
42623
42621
42620
42619
42618
42617
42616
42615
42614
42613
42611
42610
42609
42607
42606
42605
42604
42603
42601
42600
42599
42598
42597
42596
42595
42594
42592
42591
42590
42588
42587
42586
42585
42583
42582
42580
42579
42578
42577
42576
42575
42574
42571
...

result:

ok 149881 numbers

Test #50:

score: 0
Accepted
time: 298ms
memory: 79248kb

input:

100000 174999 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35...

output:

1
1
1
0
2
3
3
3
5
5
5
4
7
7
6
7
8
9
9
9
11
9
10
10
12
10
11
11
12
11
12
12
13
12
12
11
12
12
12
12
14
13
12
13
15
15
15
14
16
16
15
15
17
16
17
16
18
18
17
18
20
20
19
20
22
22
20
21
22
22
21
22
24
24
24
23
25
25
25
24
26
27
27
27
29
28
29
29
31
31
30
30
31
32
32
32
34
34
34
33
35
36
36
36
37
36
37
...

result:

ok 149733 numbers

Test #51:

score: 0
Accepted
time: 303ms
memory: 79128kb

input:

100000 174999 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35...

output:

5363
5364
5364
5364
5361
5362
5362
5362
5359
5360
5360
5360
5358
5357
5358
5358
5355
5356
5356
5356
5354
5353
5354
5354
5352
5352
5351
5352
5349
5350
5350
5349
5346
5347
5347
5347
5346
5345
5346
5346
5345
5345
5344
5345
5343
5342
5342
5341
5340
5340
5338
5339
5337
5337
5336
5337
5335
5334
5335
5335
...

result:

ok 150393 numbers

Test #52:

score: 0
Accepted
time: 153ms
memory: 52220kb

input:

100000 100002 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
...

output:

24999
24998
24997
24995
24994
24993
24992
24991
24990
24988
24987
24986
24985
24984
24983
24982
24981
24979
24978
24977
24976
24975
24974
24973
24971
24970
24969
24968
24965
24964
24963
24959
24958
24957
24956
24954
24953
24952
24951
24950
24949
24948
24947
24946
24945
24944
24943
24942
24941
24940
...

result:

ok 149856 numbers

Test #53:

score: 0
Accepted
time: 149ms
memory: 52244kb

input:

100000 100002 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
...

output:

1478
1476
1475
1474
1473
1472
1471
1470
1469
1468
1466
1465
1464
1463
1462
1461
1460
1459
1457
1456
1455
1454
1453
1452
1451
1450
1448
1446
1445
1444
1443
1442
1440
1439
1438
1437
1436
1435
1433
1432
1431
1430
1429
1427
1426
1425
1424
1423
1422
1421
1419
1418
1417
1416
1415
1414
1413
1412
1410
1409
...

result:

ok 150383 numbers

Test #54:

score: 0
Accepted
time: 134ms
memory: 45128kb

input:

75000 100002 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

6252
6251
6250
6249
6248
6247
6246
6245
6244
6243
6242
6241
6240
6239
6238
6237
6236
6235
6234
6233
6232
6231
6230
6229
6228
6227
6226
6225
6224
6223
6222
6221
6220
6219
6217
6216
6215
6214
6213
6212
6211
6210
6209
6208
6207
6206
6205
6204
6202
6201
6200
6199
6198
6197
6196
6194
6193
6192
6191
6190
...

result:

ok 150337 numbers

Test #55:

score: 0
Accepted
time: 125ms
memory: 45040kb

input:

75000 100002 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1879
1880
1881
1882
1883
1884
1885
...

result:

ok 149671 numbers

Test #56:

score: 0
Accepted
time: 132ms
memory: 48480kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

0
0
1
1
2
3
4
5
6
5
6
7
8
9
10
11
12
13
13
14
15
16
17
18
18
14
15
15
14
15
16
17
18
19
20
21
20
20
20
21
22
21
22
23
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
37
36
37
38
39
40
40
40
41
42
42
43
43
44
45
46
47
45
46
47
48
48
48
47
48
47
48
49
50
51
52
53
53
52
53
54
54
55
56
56
57
57
57
58
59...

result:

ok 133065 numbers

Test #57:

score: 0
Accepted
time: 134ms
memory: 48576kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

80351
80350
80347
80346
80345
80344
80343
80342
80341
80340
80338
80337
80336
80335
80333
80332
80331
80330
80328
80327
80326
80325
80324
80323
80322
80321
80320
80318
80317
80315
80314
80313
80312
80311
80309
80307
80305
80304
80303
80302
80301
80300
80299
80297
80295
80294
80292
80291
80290
80289
...

result:

ok 133625 numbers

Test #58:

score: 0
Accepted
time: 186ms
memory: 44788kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

67457
67456
67455
67454
67453
67452
67451
67450
67446
67445
67444
67443
67440
67438
67437
67436
67435
67433
67432
67431
67430
67429
67427
67426
67425
67424
67423
67422
67421
67420
67419
67418
67417
67416
67415
67414
67413
67412
67411
67410
67409
67408
67407
67405
67404
67403
67402
67401
67400
67399
...

result:

ok 133480 numbers

Test #59:

score: 0
Accepted
time: 191ms
memory: 44856kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

46717
46715
46714
46713
46712
46711
46709
46708
46706
46704
46703
46701
46700
46699
46698
46697
46696
46695
46694
46693
46692
46691
46690
46689
46688
46686
46685
46684
46683
46682
46681
46680
46679
46678
46677
46676
46675
46674
46673
46671
46670
46668
46667
46666
46664
46663
46662
46661
46660
46659
...

result:

ok 133251 numbers

Test #60:

score: 0
Accepted
time: 319ms
memory: 78984kb

input:

100000 174999 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35...

output:

1
1
0
0
2
2
1
2
2
3
3
3
5
4
5
5
7
7
6
5
7
7
7
6
6
6
6
5
7
7
6
7
7
8
8
6
7
7
5
6
7
8
8
8
10
10
9
9
11
11
11
10
12
12
12
11
13
13
13
13
14
14
13
14
16
15
14
15
15
16
16
15
17
16
16
15
18
16
15
16
17
18
18
16
16
17
17
17
17
17
17
16
19
19
19
18
21
20
19
19
21
21
20
19
21
22
22
22
22
22
21
21
21
22
22
2...

result:

ok 133910 numbers

Test #61:

score: 0
Accepted
time: 316ms
memory: 79168kb

input:

100000 174999 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35...

output:

4439
4438
4439
4439
4437
4437
4437
4436
4436
4436
4435
4436
4434
4434
4434
4433
4432
4431
4432
4432
4430
4430
4430
4429
4427
4428
4427
4427
4425
4424
4425
4425
4424
4422
4423
4423
4421
4421
4421
4420
4419
4419
4418
4419
4417
4416
4416
4416
4413
4414
4414
4414
4412
4412
4411
4410
4408
4409
4408
4407
...

result:

ok 133266 numbers

Test #62:

score: 0
Accepted
time: 139ms
memory: 48512kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

0
1
1
2
1
2
3
3
4
4
4
5
5
5
5
6
4
5
6
7
6
5
6
6
6
6
7
6
7
8
9
10
11
11
12
10
11
12
13
11
11
10
9
6
5
3
4
4
5
6
5
5
6
6
7
8
8
9
9
8
9
10
10
10
10
11
11
12
13
14
11
11
12
8
6
3
4
5
5
5
3
3
4
3
3
4
4
4
4
5
6
4
5
6
7
8
7
8
8
9
10
11
11
12
13
13
12
10
8
8
9
9
6
7
7
8
6
6
0
0
0
0
0
1
1
1
0
0
1
1
2
3
3
4
4...

result:

ok 109879 numbers

Test #63:

score: 0
Accepted
time: 138ms
memory: 48568kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

79051
79050
79049
79048
79047
79046
79045
79043
79042
79041
79040
79038
79037
79035
79034
79033
79032
79031
79029
79028
79025
79024
79022
79018
79016
79015
79014
79012
79011
79010
79008
79007
79006
79003
79002
79000
78999
78998
78997
78996
78995
78994
78992
78989
78988
78987
78986
78984
78983
78982
...

result:

ok 110144 numbers

Test #64:

score: 0
Accepted
time: 171ms
memory: 44760kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

0
1
1
2
3
3
4
2
3
3
4
5
5
6
7
7
6
7
8
7
7
8
6
7
8
9
10
10
10
11
12
13
13
14
15
15
16
17
18
19
19
20
21
22
22
20
21
22
23
23
22
23
24
25
26
26
26
26
27
28
25
26
24
24
25
26
27
25
26
27
28
28
24
25
26
27
26
25
26
27
28
29
28
29
30
31
31
32
33
34
32
32
33
34
35
33
34
35
36
37
37
38
37
38
39
39
40
41
42...

result:

ok 110143 numbers

Test #65:

score: 0
Accepted
time: 195ms
memory: 44836kb

input:

100000 99999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

29386
29385
29384
29382
29381
29379
29378
29377
29376
29375
29374
29372
29371
29370
29369
29368
29365
29364
29363
29362
29361
29358
29356
29355
29354
29353
29352
29351
29349
29348
29347
29346
29345
29343
29340
29339
29337
29336
29335
29334
29332
29331
29330
29329
29328
29327
29326
29325
29324
29323
...

result:

ok 109582 numbers

Test #66:

score: 0
Accepted
time: 298ms
memory: 78960kb

input:

100000 174999 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35...

output:

1
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
...

result:

ok 109847 numbers

Test #67:

score: 0
Accepted
time: 315ms
memory: 78980kb

input:

100000 174999 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35...

output:

4849
4849
4849
4848
4847
4846
4845
4845
4842
4843
4842
4842
4841
4839
4840
4840
4839
4838
4838
4837
4836
4835
4836
4834
4832
4831
4832
4832
4830
4829
4828
4828
4826
4826
4825
4826
4824
4824
4823
4824
4823
4822
4822
4821
4820
4820
4818
4818
4816
4816
4816
4815
4812
4813
4813
4813
4810
4811
4811
4811
...

result:

ok 109417 numbers

Test #68:

score: 0
Accepted
time: 182ms
memory: 51456kb

input:

99856 100485 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

150
151
151
152
153
154
155
155
156
155
153
152
150
149
148
147
146
145
144
143
142
141
139
138
137
136
135
134
132
131
130
129
128
127
126
125
123
121
120
119
117
116
113
112
111
110
109
106
105
104
103
101
100
99
98
97
95
94
93
92
91
90
89
88
86
85
84
83
82
81
80
79
78
77
75
73
72
71
70
69
67
66
6...

result:

ok 150048 numbers

Test #69:

score: 0
Accepted
time: 188ms
memory: 50988kb

input:

99856 100467 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

2955
2954
2953
2952
2951
2949
2948
2946
2945
2944
2943
2942
2943
2943
2944
2945
2946
2946
2947
2948
2948
2949
2948
2949
2950
2951
2952
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2980
2981
2982
...

result:

ok 150230 numbers

Test #70:

score: 0
Accepted
time: 191ms
memory: 51400kb

input:

99856 100506 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

14918
14917
14916
14915
14913
14912
14911
14910
14909
14908
14907
14905
14904
14903
14902
14901
14900
14899
14898
14895
14894
14893
14892
14891
14889
14888
14887
14885
14884
14882
14881
14880
14879
14878
14877
14875
14874
14873
14872
14871
14870
14871
14872
14873
14874
14875
14875
14876
14877
14878
...

result:

ok 133903 numbers

Test #71:

score: 0
Accepted
time: 184ms
memory: 51744kb

input:

99856 100491 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

14698
14699
14698
14699
14700
14701
14700
14701
14702
14701
14700
14699
14698
14697
14696
14694
14693
14689
14688
14687
14686
14685
14684
14684
14685
14686
14687
14686
14687
14687
14688
14689
14690
14691
14692
14693
14694
14695
14696
14697
14698
14699
14700
14701
14702
14702
14703
14704
14705
14706
...

result:

ok 110161 numbers

Test #72:

score: 0
Accepted
time: 304ms
memory: 50380kb

input:

100000 119877 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
3 6
3 8
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
35 38
32 38
41 42
42 43
43 44
44 45
45 46
46 47
47 48
...

output:

174
173
172
171
170
171
172
173
174
175
170
171
172
173
172
171
170
169
168
169
167
168
169
168
167
166
165
164
165
166
166
165
165
164
163
164
165
164
165
166
165
166
167
166
165
164
163
162
163
164
166
167
167
166
166
165
166
165
164
165
171
170
169
170
170
169
168
169
170
171
172
173
174
174
173
...

result:

ok 199999 numbers

Test #73:

score: 0
Accepted
time: 285ms
memory: 50996kb

input:

100000 119822 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
37 40
37 39
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49...

output:

77
78
79
80
81
80
79
78
77
76
78
79
78
77
76
75
74
75
76
77
71
72
73
72
71
70
69
68
69
70
70
71
70
69
68
67
68
69
69
69
64
65
65
66
67
68
68
67
66
65
62
61
62
63
64
65
65
64
63
63
67
68
67
66
65
64
63
64
65
66
61
60
59
58
57
56
57
58
59
60
63
62
63
64
65
66
67
66
65
64
55
55
54
55
55
54
53
52
53
54
...

result:

ok 199999 numbers

Test #74:

score: 0
Accepted
time: 306ms
memory: 51808kb

input:

100000 119819 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
4 10
1 8
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
11 13
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
28 30
22 29
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
35 39
32 38
41 42
42 43
43 44
44 45...

output:

166
167
166
165
164
163
164
165
166
166
159
160
160
161
162
163
163
162
161
160
159
158
159
160
161
160
159
158
157
158
156
156
157
156
155
156
156
155
154
155
158
159
160
161
162
161
160
159
158
157
151
152
153
152
151
150
149
148
149
150
146
145
146
147
148
149
150
149
148
147
144
145
144
145
144
...

result:

ok 199999 numbers

Test #75:

score: 0
Accepted
time: 166ms
memory: 50316kb

input:

100000 100019 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

21348
21347
21346
21345
21344
21343
21342
21341
21340
21339
21338
21337
21336
21335
21334
21333
21332
21331
21330
21329
21328
21327
21326
21325
21324
21323
21322
21321
21320
21319
21318
21317
21316
21315
21314
21313
21312
21311
21310
21309
21308
21307
21306
21305
21304
21303
21302
21301
21300
21299
...

result:

ok 199999 numbers

Test #76:

score: 0
Accepted
time: 161ms
memory: 51936kb

input:

100000 100016 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

13732
13731
13730
13729
13728
13727
13726
13725
13724
13723
13722
13721
13720
13719
13718
13719
13720
13721
13722
13723
13724
13725
13726
13727
13728
13729
13730
13731
13732
13733
13734
13735
13736
13737
13738
13739
13740
13741
13742
13743
13744
13745
13746
13747
13748
13749
13750
13751
13752
13753
...

result:

ok 199999 numbers

Test #77:

score: 0
Accepted
time: 167ms
memory: 49816kb

input:

100000 100018 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

7432
7433
7434
7435
7436
7437
7438
7439
7440
7441
7442
7443
7444
7445
7446
7447
7448
7449
7450
7451
7452
7453
7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
7466
7467
7468
7469
7470
7471
7472
7473
7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
7486
7487
7488
7489
7490
7491
...

result:

ok 199999 numbers

Test #78:

score: 0
Accepted
time: 297ms
memory: 55336kb

input:

100000 119861 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
22 30
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50...

output:

208
207
205
203
202
201
202
203
204
205
203
202
201
200
201
202
203
204
205
204
199
199
200
201
201
199
198
197
196
197
196
195
194
193
192
193
194
195
195
196
190
189
190
189
188
187
188
188
189
190
184
185
186
187
186
185
184
183
182
183
178
179
180
181
181
180
179
178
177
176
189
188
187
186
185
...

result:

ok 150167 numbers

Test #79:

score: 0
Accepted
time: 304ms
memory: 52900kb

input:

100000 119924 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
7 9
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
12 18
14 19
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
32 35
41 42
42 43
43 44
44 45
45 46
46 47
47 4...

output:

73
74
75
76
77
77
76
76
75
74
73
71
71
70
69
68
69
69
70
71
67
68
67
66
65
64
63
63
64
65
64
65
66
65
64
63
62
61
62
63
58
59
60
61
60
59
58
56
57
58
53
54
55
56
57
56
55
54
53
52
51
52
53
54
53
52
51
50
49
50
44
45
45
46
47
46
45
46
46
45
50
50
49
48
47
48
49
50
49
50
52
53
53
52
53
52
51
50
51
52
...

result:

ok 150204 numbers

Test #80:

score: 0
Accepted
time: 294ms
memory: 50896kb

input:

100000 119952 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
1 3
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
13 19
16 20
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
23 28
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
36 40
36 39
41 42
42 43
43 44
44 45
45 4...

output:

155
156
156
157
138
137
136
135
134
135
131
130
131
132
133
133
134
133
132
130
127
126
125
126
125
124
123
124
125
126
131
130
131
132
133
133
134
134
133
132
125
126
125
124
123
122
121
122
123
124
120
71
72
73
74
73
52
51
50
49
46
45
44
43
42
43
44
45
46
47
48
49
50
51
50
49
50
49
48
47
37
36
35
...

result:

ok 149593 numbers

Test #81:

score: 0
Accepted
time: 168ms
memory: 50868kb

input:

100000 100020 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

28168
28167
28166
28165
28163
28162
28161
28160
28159
28158
28157
28156
28155
28154
28152
28151
28150
28147
28145
28144
28143
28142
28140
28138
28137
28134
28133
28132
28131
28130
28128
28127
28125
28124
28123
28122
28121
28119
28118
28117
28116
28115
28114
28113
28112
28111
28110
28108
28107
28106
...

result:

ok 150138 numbers

Test #82:

score: 0
Accepted
time: 169ms
memory: 51168kb

input:

100000 100022 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

11091
11090
11088
11087
11086
11085
11084
11083
11082
11081
11080
11079
11078
11077
11076
11075
11074
11072
11071
11070
11069
11068
11067
11066
11065
11064
11063
11062
11061
11060
11059
11058
11057
11055
11054
11053
11052
11051
11050
11049
11048
11047
11045
11044
11043
11042
11041
11040
11038
11037
...

result:

ok 150381 numbers

Test #83:

score: 0
Accepted
time: 177ms
memory: 52216kb

input:

100000 100017 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

3850
3849
3848
3847
3846
3845
3844
3843
3842
3841
3840
3839
3838
3837
3836
3835
3834
3833
3832
3831
3830
3829
3828
3827
3826
3825
3824
3823
3822
3821
3820
3819
3818
3817
3816
3815
3814
3813
3812
3811
3810
3809
3808
2149
2148
2147
2146
2145
2144
2143
1372
1371
1370
1369
1368
1367
1366
1365
1364
1363
...

result:

ok 149855 numbers

Test #84:

score: 0
Accepted
time: 313ms
memory: 52100kb

input:

100000 119893 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
13 17
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
22 26
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49...

output:

166
165
166
166
167
168
169
168
167
166
162
163
164
165
165
165
164
164
163
162
160
159
160
161
161
160
161
162
162
161
161
162
163
162
161
160
159
158
159
160
163
164
165
166
167
167
166
165
164
163
156
157
156
155
154
153
152
153
154
155
165
166
167
168
169
170
169
168
167
166
148
147
148
149
150
...

result:

ok 133306 numbers

Test #85:

score: 0
Accepted
time: 294ms
memory: 50824kb

input:

100000 119765 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
5 7
1 9
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
14 16
16 20
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
22 28
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
36 38
38 40
41 42
42 43
43 44
44 45
...

output:

150
151
151
150
149
149
148
147
148
149
146
147
148
149
149
148
149
149
148
146
150
149
150
151
151
150
149
147
148
149
140
141
142
143
144
143
142
141
141
140
139
140
140
139
138
137
136
134
135
135
129
129
130
131
132
133
132
131
130
129
134
135
136
137
138
136
135
134
132
130
124
123
124
124
125
...

result:

ok 133366 numbers

Test #86:

score: 0
Accepted
time: 305ms
memory: 50992kb

input:

100000 119891 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
2 9
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
11 14
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
34 40
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 4...

output:

88
87
86
87
88
89
90
89
88
89
84
85
86
85
86
83
84
83
82
81
83
82
83
84
85
86
87
86
85
84
81
81
80
79
78
79
80
81
81
80
76
77
77
76
76
75
73
72
73
74
73
72
71
70
71
72
73
74
75
74
83
81
82
83
82
83
82
81
80
81
87
88
87
88
87
86
85
84
85
86
68
68
67
66
67
68
69
69
68
67
65
66
66
65
65
64
63
42
43
44
...

result:

ok 133332 numbers

Test #87:

score: 0
Accepted
time: 172ms
memory: 52920kb

input:

100000 100019 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

3470
3471
3472
3473
3474
3474
3475
3476
3476
3477
3477
3478
3478
3479
3480
3481
3482
3482
3483
3482
3483
3484
3484
3485
3486
3486
3487
3487
3488
3489
3490
3491
3492
3493
3493
3494
3495
3496
3496
3496
3497
3498
3498
3499
3499
3500
3501
3501
3502
3502
3503
3504
3504
3504
3505
3506
3507
3507
3508
3509
...

result:

ok 133439 numbers

Test #88:

score: 0
Accepted
time: 179ms
memory: 52132kb

input:

100000 100020 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

4297
4296
4295
4294
4293
4291
4290
4289
4288
4287
4285
4284
4283
4282
4280
4279
4278
4277
4276
4274
4273
4272
4271
4269
4267
4266
4263
4262
4261
4260
4258
4256
4255
4254
4253
4252
4251
4250
4249
4248
4247
4246
4245
4243
4242
4241
4240
4239
4237
4236
4235
4234
4233
4232
4230
4229
4227
4226
4225
4224
...

result:

ok 133856 numbers

Test #89:

score: 0
Accepted
time: 180ms
memory: 52436kb

input:

100000 100017 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

26978
26979
26980
26981
26982
1487
1486
1485
1484
1483
1482
1481
1480
1479
1478
1477
1476
1475
1474
1473
1472
284
283
282
281
280
279
278
277
276
275
274
273
272
271
270
269
268
267
266
265
264
263
262
261
260
259
258
257
256
255
254
253
252
251
250
249
248
247
246
245
244
243
242
241
240
239
238
23...

result:

ok 133066 numbers

Test #90:

score: 0
Accepted
time: 302ms
memory: 50456kb

input:

100000 119935 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
1 6
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
14 20
11 14
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
21 24
23 26
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
36 38
41 42
42 43
43 44
44 45
45 4...

output:

207
205
204
203
204
205
206
207
208
207
197
198
198
197
197
198
199
197
196
194
189
190
191
190
191
192
192
189
188
187
190
188
187
188
189
190
191
191
191
190
181
180
181
182
168
169
170
169
168
167
163
164
165
164
163
162
161
160
161
162
160
159
158
159
160
161
162
162
161
161
164
163
162
161
162
...

result:

ok 110175 numbers

Test #91:

score: 0
Accepted
time: 314ms
memory: 51684kb

input:

100000 119991 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
8 10
3 5
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
23 28
28 30
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
41 42
42 43
43 44
44 45
45 46
46 47
47 48...

output:

121
120
121
122
122
122
123
122
122
121
116
117
118
118
119
120
119
117
116
115
114
113
112
111
110
111
111
112
113
113
111
110
109
108
106
107
108
109
110
111
102
101
102
103
103
104
105
105
104
103
102
102
101
100
99
98
97
97
98
99
104
105
106
105
104
102
101
100
100
101
99
98
99
100
100
101
102
1...

result:

ok 110082 numbers

Test #92:

score: 0
Accepted
time: 317ms
memory: 53720kb

input:

100000 119982 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
14 20
15 19
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
27 30
25 30
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
41 42
42 43
43 44
44 45
45 46
46 47
47...

output:

188
189
166
135
136
137
136
135
134
133
128
127
121
122
110
111
112
111
110
109
106
105
106
107
108
109
108
109
108
107
103
104
105
106
107
108
93
92
91
90
89
88
87
86
85
86
87
86
87
88
89
90
91
92
93
92
91
90
89
88
85
84
85
86
85
84
83
82
67
68
62
63
64
65
66
65
64
63
62
61
69
68
67
66
65
64
65
66
...

result:

ok 110054 numbers

Test #93:

score: 0
Accepted
time: 172ms
memory: 49760kb

input:

100000 100014 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

20933
20934
20935
20936
20937
20938
20938
20939
20940
20941
20940
20941
20942
20943
20944
20945
20946
20947
20948
20948
20948
20949
20949
20950
20950
20950
20951
20952
20953
20953
20954
20954
20955
20956
20957
20957
20957
20958
20959
20960
20960
20961
20961
20962
20962
20963
20963
20964
20965
20966
...

result:

ok 110164 numbers

Test #94:

score: 0
Accepted
time: 160ms
memory: 51068kb

input:

100000 100022 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

2161
2160
2159
2158
2157
2156
2154
2153
2152
2151
2149
2148
2147
2145
2143
2141
2139
2138
2136
2135
2134
2133
2131
2130
2129
2128
2127
2125
2124
2122
2121
2120
2118
2117
2116
2115
2114
2113
2112
2111
2110
2108
2107
2106
2105
2103
2102
2100
2099
2098
2097
2095
2094
2093
2092
2090
2089
2088
2087
2085
...

result:

ok 109368 numbers

Test #95:

score: 0
Accepted
time: 172ms
memory: 53024kb

input:

100000 100020 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
5...

output:

4846
2072
429
428
427
426
425
424
423
422
421
420
419
418
417
416
415
414
413
412
411
410
409
408
407
406
405
404
403
402
401
400
399
398
397
396
395
394
393
392
391
390
389
388
387
386
385
384
383
382
381
380
379
378
377
376
375
374
373
372
371
370
369
368
367
366
365
364
363
362
361
360
359
358
35...

result:

ok 109866 numbers

Test #96:

score: 0
Accepted
time: 311ms
memory: 96092kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

230
231
231
231
231
231
231
229
230
231
231
231
231
231
231
231
231
231
231
231
231
227
228
228
228
228
228
228
228
228
228
228
228
228
228
228
228
228
228
228
228
228
225
226
226
226
226
226
226
226
226
226
226
226
226
226
226
226
226
225
224
226
226
222
223
223
223
223
223
223
223
223
223
223
223
...

result:

ok 199999 numbers

Test #97:

score: 0
Accepted
time: 366ms
memory: 109844kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

153
153
152
154
154
154
154
154
154
154
154
154
154
154
154
154
154
154
154
154
154
150
151
151
151
151
151
151
151
151
151
151
151
151
151
151
151
151
149
150
151
151
147
148
148
148
148
147
146
148
148
148
148
148
148
148
148
148
148
148
148
148
148
144
145
145
145
145
145
145
145
145
143
144
145
...

result:

ok 199999 numbers

Test #98:

score: 0
Accepted
time: 291ms
memory: 88180kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

73
73
72
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
74
70
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
71
68
69
69
69
69
69
69
69
69
69
69
68
67
69
69
69
69
69
69
69
69
65
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
66
65
64
62
63
63
63
63
63
63
63
63
63
63
63
63
63
63
63
...

result:

ok 199999 numbers

Test #99:

score: 0
Accepted
time: 338ms
memory: 108840kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

207
208
208
208
208
208
208
208
208
208
208
208
208
208
208
208
208
206
207
208
208
204
203
204
205
205
205
205
205
205
205
205
205
205
205
205
205
205
205
205
205
205
201
202
202
202
202
200
201
202
202
202
202
202
202
202
202
202
202
202
202
202
202
199
200
200
200
200
200
200
200
200
200
200
200
...

result:

ok 166663 numbers

Test #100:

score: 0
Accepted
time: 315ms
memory: 100828kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

117
118
118
118
118
118
117
117
117
115
116
117
117
117
117
117
117
117
117
117
117
113
114
114
114
114
114
114
114
114
114
114
114
114
114
114
114
114
114
114
112
113
110
111
111
111
111
111
111
110
110
109
108
110
110
110
110
110
110
110
110
110
110
106
107
107
107
107
107
107
107
107
106
105
107
...

result:

ok 166504 numbers

Test #101:

score: 0
Accepted
time: 351ms
memory: 108144kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

110
111
111
111
111
111
111
111
111
111
111
110
109
111
111
111
111
111
111
111
111
107
107
106
108
108
108
108
108
108
108
108
108
108
108
108
108
108
108
108
108
108
104
105
105
105
105
105
105
105
105
105
105
105
105
105
105
104
103
105
105
105
105
101
102
102
102
102
102
102
102
102
102
102
102
...

result:

ok 166592 numbers

Test #102:

score: 0
Accepted
time: 338ms
memory: 108404kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

218
219
219
217
218
219
219
219
219
219
219
219
219
219
219
219
219
219
219
219
219
215
216
216
214
215
216
216
216
216
216
216
216
216
216
216
216
216
216
216
216
216
212
211
212
213
213
213
213
213
213
213
213
213
213
213
213
213
213
213
213
213
213
208
209
209
208
208
208
208
208
208
208
208
208
...

result:

ok 150262 numbers

Test #103:

score: 0
Accepted
time: 283ms
memory: 89312kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

181
181
181
181
181
181
181
181
181
181
181
181
181
181
181
181
181
181
181
179
180
179
180
180
180
180
180
180
179
179
179
179
179
179
179
179
179
179
179
179
178
177
175
176
176
176
176
176
176
176
176
176
175
172
173
174
174
174
174
174
174
174
174
170
171
171
171
171
170
170
170
170
170
170
169
...

result:

ok 150133 numbers

Test #104:

score: 0
Accepted
time: 390ms
memory: 107656kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

148
87
86
88
88
88
88
88
88
88
88
88
88
88
88
88
88
88
83
83
83
79
80
80
78
79
80
80
79
79
79
79
79
79
79
79
79
79
79
79
79
79
77
78
78
76
77
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
74
75
75
75
75
74
73
75
75
75
75
75
75
75
75
75
75
75
75
75
75
71
70
71
72
72
72
72
72
72
72
72
72
72
72
72
72...

result:

ok 149870 numbers

Test #105:

score: 0
Accepted
time: 318ms
memory: 102740kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

258
259
259
259
259
259
259
259
259
259
259
259
259
257
258
259
259
259
259
259
259
255
256
256
256
256
254
255
256
256
256
256
256
256
256
256
256
256
256
256
256
256
253
254
253
253
253
253
253
253
253
251
252
253
253
253
253
253
253
253
253
253
253
249
250
250
250
250
250
250
250
250
250
250
250
...

result:

ok 133562 numbers

Test #106:

score: 0
Accepted
time: 278ms
memory: 85448kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

140
141
141
141
141
141
141
141
141
139
140
141
141
141
141
141
141
140
140
140
140
136
135
136
137
137
137
137
137
137
137
137
137
137
137
137
137
137
137
137
136
136
132
133
133
133
133
133
132
132
132
132
132
132
132
132
132
130
131
132
132
132
132
128
129
129
129
129
129
129
129
129
129
129
129
...

result:

ok 133711 numbers

Test #107:

score: 0
Accepted
time: 348ms
memory: 92912kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

181
182
182
181
180
182
182
182
157
157
157
135
135
135
135
135
132
132
132
132
132
129
130
130
130
130
130
130
130
130
128
129
130
130
130
130
130
130
130
130
130
130
126
127
127
123
123
118
118
118
61
61
61
61
61
61
61
61
61
61
61
60
59
57
58
58
58
58
58
58
58
58
57
56
58
58
58
58
58
58
58
58
58
5...

result:

ok 133297 numbers

Test #108:

score: 0
Accepted
time: 289ms
memory: 100932kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

274
275
275
275
275
275
275
275
275
275
275
275
275
275
275
275
275
275
275
273
274
271
272
272
272
272
271
270
272
271
271
271
269
269
269
269
269
269
269
269
269
269
265
266
266
266
266
266
266
266
266
266
266
266
266
265
264
266
266
266
266
266
266
262
263
263
263
263
263
263
263
263
263
263
263
...

result:

ok 109774 numbers

Test #109:

score: 0
Accepted
time: 334ms
memory: 98808kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

198
198
198
198
198
198
198
198
198
198
198
196
197
198
198
198
198
198
198
198
198
193
194
194
194
194
193
192
194
193
192
192
192
192
191
191
191
191
191
191
191
191
189
190
190
190
190
190
190
190
190
190
190
190
190
190
190
190
190
190
190
187
187
184
185
185
185
185
185
185
185
185
185
185
183
...

result:

ok 109813 numbers

Test #110:

score: 0
Accepted
time: 388ms
memory: 106352kb

input:

99981 147590 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37...

output:

207
208
208
208
208
208
208
208
171
153
153
153
143
143
143
141
69
70
70
70
70
66
67
67
67
67
66
65
67
67
67
67
67
62
62
62
62
62
62
62
62
62
58
59
59
59
59
59
59
57
58
59
59
59
59
59
59
59
59
59
59
59
59
55
56
56
56
56
56
56
56
56
54
55
56
56
56
56
56
56
56
56
56
56
52
51
52
53
53
53
53
53
53
53
53...

result:

ok 110436 numbers

Test #111:

score: 0
Accepted
time: 188ms
memory: 56180kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

66666
66666
66665
66664
66664
66663
66662
66662
66661
66660
66660
66659
66658
66658
66657
66656
66656
66655
66654
66654
66653
66652
66652
66651
66650
66650
66649
66648
66648
66647
66646
66646
66645
66644
66644
66643
66642
66642
66641
66640
66640
66639
66638
66638
66637
66636
66636
66635
66634
66634
...

result:

ok 199999 numbers

Test #112:

score: 0
Accepted
time: 173ms
memory: 56364kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

33958
33958
33957
33956
33956
33955
33954
33954
33953
33952
33952
33951
33950
33950
33949
33948
33948
33947
33946
33946
33945
33944
33944
33943
33942
33942
33941
33940
33940
33939
33938
33938
33937
33936
33936
33935
33934
33934
33933
33932
33932
33931
33930
33930
33929
33928
33928
33927
33926
33926
...

result:

ok 199999 numbers

Test #113:

score: 0
Accepted
time: 188ms
memory: 56164kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

54737
54737
54736
54735
54735
54734
54733
54733
54732
54731
54731
54730
54729
54729
54728
54727
54727
54726
54725
54725
54724
54723
54723
54722
54721
54721
54720
54719
54719
54718
54717
54717
54716
54715
54715
54714
54713
54713
54712
54711
54711
54710
54709
54709
54708
54707
54707
54706
54705
54705
...

result:

ok 199999 numbers

Test #114:

score: 0
Accepted
time: 185ms
memory: 56308kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

0
1
1
2
3
3
4
5
5
6
7
7
8
9
9
10
11
11
12
13
12
13
14
14
15
16
16
17
18
18
19
20
20
21
21
21
22
23
23
24
25
25
26
27
26
27
27
27
28
29
29
30
31
31
32
33
33
34
35
35
36
35
35
36
37
37
38
39
39
40
41
41
42
43
43
44
44
44
45
46
46
47
48
48
49
50
49
50
51
51
50
51
51
50
51
50
51
52
52
53
53
53
54
55
55
...

result:

ok 166776 numbers

Test #115:

score: 0
Accepted
time: 182ms
memory: 56180kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

4493
4493
4492
4491
4491
4490
4489
4489
4488
4487
4487
4486
4485
4485
4484
4483
4483
4482
4481
4481
4480
4479
4479
4477
4476
4476
4474
4473
4473
4472
4471
4471
4470
4469
4469
4468
4467
4467
4465
4464
4464
4463
4462
4461
4460
4459
4459
4458
4457
4457
4456
4455
4455
4454
4453
4453
4452
4450
4450
4449
...

result:

ok 166568 numbers

Test #116:

score: 0
Accepted
time: 208ms
memory: 56096kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

37355
37355
37354
37353
37353
37352
37351
37351
37350
37349
37349
37348
1154
1154
1153
1152
1152
1151
1150
1150
1149
1148
1148
1147
1146
1146
1145
1144
1144
1143
1142
1142
1141
1140
1140
1139
1138
1138
1137
1136
1136
1135
1134
1134
1133
1132
1132
1131
1130
1130
1129
1128
1128
1127
1126
1126
1125
112...

result:

ok 166108 numbers

Test #117:

score: 0
Accepted
time: 174ms
memory: 56112kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

66666
66666
66665
66664
66664
66663
66661
66661
66660
66659
66659
66658
66657
66657
66656
66655
66655
66654
66653
66651
66650
66649
66649
66648
66647
66647
66646
66645
66645
66644
66642
66641
66640
66639
66639
66638
66637
66637
66636
66634
66634
66630
66629
66629
66628
66627
66626
66625
66623
66623
...

result:

ok 150071 numbers

Test #118:

score: 0
Accepted
time: 177ms
memory: 56164kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

13517
13517
13516
13515
13514
13513
13511
13511
13510
13509
13509
13508
13507
13507
13506
13505
13505
13504
13503
13503
13502
13501
13501
13500
13499
13499
13498
13496
13496
13495
13494
13494
13492
13491
13491
13490
13489
13489
13488
13487
13486
13485
13484
13484
13483
13482
13482
13481
13480
13480
...

result:

ok 150191 numbers

Test #119:

score: 0
Accepted
time: 201ms
memory: 56052kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

42290
42290
42289
42288
42288
42287
42286
42286
17708
17707
17707
17706
17705
17705
17704
17703
17703
17702
17701
17701
17700
17699
17699
17698
17697
17697
17696
17695
17695
17694
17693
17693
12265
12264
12264
12263
12262
12262
12261
12260
12260
12259
12258
12258
12257
12256
12256
12255
12254
12254
...

result:

ok 149811 numbers

Test #120:

score: 0
Accepted
time: 179ms
memory: 56308kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

0
1
1
2
3
3
4
5
5
6
6
6
5
5
5
6
7
7
8
8
8
9
10
10
10
11
11
12
12
11
11
11
11
12
12
12
13
13
13
14
15
15
16
16
16
16
17
17
18
19
19
20
21
21
22
23
23
24
25
25
26
26
26
26
27
27
26
27
26
26
26
26
26
27
27
28
28
28
29
30
30
30
31
31
32
33
33
34
35
35
36
36
36
37
37
37
37
38
37
38
37
36
37
38
38
39
39
3...

result:

ok 133104 numbers

Test #121:

score: 0
Accepted
time: 177ms
memory: 56204kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

18696
18696
18695
18693
18693
18692
18691
18691
18690
18687
18687
18686
18685
18685
18684
18683
18683
18682
18681
18680
18679
18677
18677
18676
18675
18675
18673
18672
18672
18671
18669
18669
18668
18667
18666
18664
18663
18663
18662
18661
18661
18660
18659
18659
18658
18657
18657
18656
18655
18655
...

result:

ok 133283 numbers

Test #122:

score: 0
Accepted
time: 209ms
memory: 56116kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

60245
60245
60244
60243
60243
60242
60241
60241
60240
60239
60239
60238
28546
28546
28545
28544
28544
28543
28542
28542
28541
13783
13427
13426
13425
13425
13424
13423
13423
13422
13421
13421
13420
13419
13419
13418
13417
13417
6900
6899
6899
6898
6897
6897
6896
6895
6895
6894
6893
6893
6892
6891
68...

result:

ok 133401 numbers

Test #123:

score: 0
Accepted
time: 179ms
memory: 56168kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

66666
66664
66663
66662
66659
66658
66657
66657
66655
66653
66653
66652
66651
66651
66650
66647
66647
66646
66645
66645
66644
66643
66641
66640
66639
66639
66638
66637
66637
66634
66633
66633
66632
66630
66629
66628
66622
66622
66620
66619
66618
66617
66615
66614
66613
66611
66611
66609
66608
66605
...

result:

ok 110517 numbers

Test #124:

score: 0
Accepted
time: 155ms
memory: 56304kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

41543
41543
41542
41540
41540
41538
41536
41535
41534
41533
41533
41532
41529
41529
41528
41526
41526
41525
41524
41524
41523
41522
41522
41520
41519
41519
41518
41517
41517
41514
41512
41512
41510
41509
41509
41508
41506
41505
41504
41502
41502
41498
41497
41497
41496
41494
41494
41493
41491
41491
...

result:

ok 110264 numbers

Test #125:

score: 0
Accepted
time: 213ms
memory: 56156kb

input:

100000 133332 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
3...

output:

215
215
214
213
213
212
211
211
210
209
209
208
207
207
206
205
205
204
203
203
202
201
201
200
199
199
198
197
197
196
195
195
194
193
193
192
191
191
190
189
189
188
187
187
186
185
185
184
183
183
182
181
181
180
179
179
178
177
177
176
175
175
174
173
173
172
171
171
170
169
169
168
167
167
166
...

result:

ok 110009 numbers

Test #126:

score: 0
Accepted
time: 242ms
memory: 80152kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

39999
39999
39999
39998
39998
39997
39997
39997
39996
39996
39995
39995
39995
39994
39994
39993
39993
39993
39992
39992
39991
39991
39991
39990
39990
39989
39989
39989
39988
39988
39987
39987
39987
39986
39986
39985
39985
39985
39984
39984
39983
39983
39983
39982
39982
39981
39981
39981
39980
39980
...

result:

ok 199999 numbers

Test #127:

score: 0
Accepted
time: 266ms
memory: 80160kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

33966
33966
33966
33965
33965
33964
33964
33964
33963
33963
33962
33962
33962
33961
33961
33960
33960
33960
33959
33959
33958
33958
33958
33957
33957
33956
33956
33956
33955
33955
33954
33954
33954
33953
33953
33952
33952
33952
33951
33951
33950
33950
33950
33949
33949
33948
33948
33948
33947
33947
...

result:

ok 199999 numbers

Test #128:

score: 0
Accepted
time: 262ms
memory: 80188kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

23547
23547
23547
23546
23546
23545
23545
23545
23544
23544
23543
23543
23543
23542
23542
23541
23541
23541
23540
23540
23539
23539
23539
23538
23538
23537
23537
23537
23536
23536
23535
23535
23535
23534
23534
23533
23533
23533
23532
23532
23531
23531
23531
23530
23530
23529
23529
23529
23528
23528
...

result:

ok 199999 numbers

Test #129:

score: 0
Accepted
time: 270ms
memory: 80220kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

39999
39999
39999
39998
39998
39997
39997
39997
39996
39996
39995
39995
39995
39994
39994
39993
39993
39993
39992
39992
39991
39991
39991
39990
39990
39989
39989
39989
39988
39988
39987
39987
39987
39985
39985
39984
39984
39984
39983
39983
39982
39982
39982
39981
39981
39980
39980
39980
39979
39979
...

result:

ok 166805 numbers

Test #130:

score: 0
Accepted
time: 267ms
memory: 80440kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

5370
5370
5370
5369
5369
5368
5368
5368
5367
5367
5365
5365
5365
5364
5364
5363
5363
5363
5362
5361
5360
5360
5360
5359
5359
5358
5358
5358
5357
5357
5356
5356
5356
5355
5355
5354
5354
5354
5353
5353
5352
5352
5352
5350
5350
5349
5349
5349
5348
5348
5347
5347
5347
5346
5345
5344
5344
5344
5343
5343
...

result:

ok 166408 numbers

Test #131:

score: 0
Accepted
time: 265ms
memory: 80140kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

15374
15374
15374
15373
15373
15372
15372
15372
15371
15371
13589
2741
2741
2740
2740
6
7
7
7
8
8
9
9
9
10
10
11
11
11
12
12
13
13
13
14
14
15
15
15
16
16
17
17
17
18
18
19
19
19
20
20
21
21
21
22
22
23
23
23
24
24
25
25
25
26
26
27
27
27
28
28
29
29
29
30
30
31
31
31
32
32
33
33
33
34
34
35
35
35
3...

result:

ok 166909 numbers

Test #132:

score: 0
Accepted
time: 251ms
memory: 80212kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

1
1
0
1
2
2
2
2
2
3
3
4
4
4
5
5
6
6
6
7
7
8
8
8
9
9
10
10
10
11
10
11
11
11
12
12
13
13
13
14
14
15
14
13
14
14
15
15
15
16
16
17
16
16
17
17
17
17
17
18
18
19
19
19
20
20
21
20
20
21
20
21
21
21
22
22
23
23
23
24
23
24
24
24
25
24
25
25
25
26
25
26
26
26
27
26
27
27
27
28
28
29
29
29
30
30
31
31
31...

result:

ok 150273 numbers

Test #133:

score: 0
Accepted
time: 254ms
memory: 80112kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

3642
3642
3642
3641
3641
3640
3640
3640
3639
3639
3638
3638
3638
3637
3637
3636
3636
3636
3634
3634
3633
3633
3633
3631
3631
3630
3630
3630
3629
3629
3628
3628
3628
3627
3627
3626
3626
3626
3625
3625
3624
3624
3624
3623
3623
3622
3621
3621
3620
3620
3619
3619
3619
3618
3618
3617
3617
3617
3616
3616
...

result:

ok 150080 numbers

Test #134:

score: 0
Accepted
time: 280ms
memory: 80176kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

27283
27283
27283
7174
7174
7173
7173
7173
7172
7172
7171
7171
7171
7170
7170
7169
7169
7169
7168
5434
5433
5433
1131
1130
1130
1129
1129
1129
1128
1128
1127
1127
1127
1126
1126
1125
1125
1125
1124
1124
1123
1123
1123
1122
1122
1121
1121
1121
1120
1120
1119
1119
1119
1118
1118
1117
1117
1117
1116
11...

result:

ok 149805 numbers

Test #135:

score: 0
Accepted
time: 263ms
memory: 80208kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

39999
39999
39998
39997
39997
39996
39996
39996
39994
39994
39993
39993
39993
39992
39992
39991
39991
39991
39990
39990
39989
39989
39989
39988
39988
39986
39986
39986
39985
39985
39983
39983
39983
39982
39982
39981
39980
39980
39979
39979
39978
39978
39977
39976
39976
39975
39975
39974
39973
39973
...

result:

ok 133308 numbers

Test #136:

score: 0
Accepted
time: 237ms
memory: 80212kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

24489
24488
24488
24487
24487
24486
24486
24486
24485
24485
24484
24484
24484
24483
24483
24482
24482
24482
24481
24481
24480
24480
24480
24478
24478
24477
24477
24477
24476
24476
24475
24475
24474
24473
24473
24472
24472
24471
24470
24470
24469
24469
24469
24467
24467
24466
24466
24466
24465
24465
...

result:

ok 133201 numbers

Test #137:

score: 0
Accepted
time: 281ms
memory: 80172kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

28111
28111
28111
28110
28110
28109
13965
801
800
800
799
799
799
798
798
797
797
797
796
796
795
795
795
794
794
793
793
793
792
792
791
791
791
790
790
789
789
789
788
788
787
787
787
786
786
785
785
785
784
784
783
783
783
782
782
781
781
781
780
690
689
689
689
688
688
687
687
687
686
686
685
68...

result:

ok 133259 numbers

Test #138:

score: 0
Accepted
time: 283ms
memory: 80160kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

39999
39999
39999
39998
39998
39997
39996
39995
39994
39994
39992
39992
39992
39990
39990
39988
39987
39987
39986
39986
39985
39985
39984
39982
39982
39981
39980
39980
39979
39979
39978
39978
39978
39977
39976
39975
39974
39973
39972
39970
39969
39968
39968
39967
39967
39966
39966
39965
39964
39964
...

result:

ok 109924 numbers

Test #139:

score: 0
Accepted
time: 265ms
memory: 80436kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

17741
17741
17740
17739
17739
17738
17738
17738
17736
17736
17735
17735
17735
17734
17734
17733
17732
17732
17731
17731
17729
17728
17728
17727
17727
17726
17726
17726
17725
17725
17723
17723
17723
17721
17721
17720
17720
17720
17719
17719
17718
17718
17718
17717
17716
17714
17714
17714
17712
17711
...

result:

ok 109976 numbers

Test #140:

score: 0
Accepted
time: 309ms
memory: 80240kb

input:

99999 179997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31...

output:

37390
37390
37390
37389
37389
4804
4804
921
920
920
919
919
919
918
918
917
917
917
916
916
915
915
915
914
914
913
913
913
912
912
911
911
911
910
910
341
341
341
340
340
339
339
339
338
338
337
337
337
336
336
335
335
335
334
334
333
333
333
332
332
331
331
331
330
330
329
329
329
328
328
327
327
...

result:

ok 110120 numbers

Test #141:

score: 0
Accepted
time: 65ms
memory: 28472kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

0
1
2
3
4
5
6
7
8
9
10
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
49
50
51
52
53
54
55
56
57
58
59
60
61
61
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
1...

result:

ok 183429 numbers

Test #142:

score: 0
Accepted
time: 78ms
memory: 28428kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

39654
39653
39652
39651
39650
39649
39648
39647
39646
39645
39644
39643
39642
39641
39640
39639
39638
39637
39636
39635
39634
39633
39632
39631
39630
39629
39628
39627
39626
39624
39623
39622
39621
39620
39619
39618
39617
39616
39615
39614
39613
39612
39611
39610
39608
39607
39606
39605
39604
39603
...

result:

ok 183289 numbers

Test #143:

score: 0
Accepted
time: 102ms
memory: 27764kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

0
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
40
41
42
43
42
43
44
45
46
47
48
48
49
50
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
71
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
85
86
87
88
89
90
91
92
93
94
9...

result:

ok 183195 numbers

Test #144:

score: 0
Accepted
time: 93ms
memory: 27576kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

18230
18229
18228
18227
18226
18225
18224
18223
18222
18221
18219
18218
18217
18216
18215
18213
18212
18211
18210
18209
18208
18207
18206
18205
18204
18203
18202
18201
18200
18199
18198
18197
18196
18195
18194
18193
18192
18191
18189
18188
18187
18186
18185
18183
18182
18181
18180
18179
18178
18177
...

result:

ok 183295 numbers

Test #145:

score: 0
Accepted
time: 170ms
memory: 45708kb

input:

50000 87499 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
3...

output:

14874
14875
14875
14875
14873
14873
14872
14873
14870
14871
14871
14871
14869
14868
14869
14869
14867
14866
14867
14866
14864
14865
14865
14865
14862
14862
14862
14862
14861
14861
14860
14861
14858
14857
14858
14858
14856
14856
14856
14855
14854
14854
14853
14854
14852
14852
14851
14852
14851
14851
...

result:

ok 183452 numbers

Test #146:

score: 0
Accepted
time: 177ms
memory: 45732kb

input:

50000 87499 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
3...

output:

2018
2017
2018
2018
2016
2016
2016
2015
2014
2014
2014
2013
2012
2013
2013
2013
2010
2011
2011
2011
2010
2009
2008
2009
2006
2007
2007
2007
2005
2004
2005
2005
2003
2002
2001
2002
2000
1999
2000
2000
1998
1998
1997
1998
1996
1996
1995
1996
1995
1995
1995
1994
1993
1993
1993
1992
1990
1991
1991
1991
...

result:

ok 183363 numbers

Test #147:

score: 0
Accepted
time: 77ms
memory: 28424kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

49999
49998
49996
49995
49994
49993
49992
49991
49990
49989
49988
49987
49986
49985
49984
49983
49982
49981
49980
49978
49977
49976
49975
49974
49973
49972
49971
49970
49969
49968
49967
49966
49965
49964
49963
49962
49961
49960
49959
49958
49957
49956
49955
49954
49953
49952
49951
49950
49949
49948
...

result:

ok 174837 numbers

Test #148:

score: 0
Accepted
time: 66ms
memory: 28376kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

15179
15178
15177
15176
15175
15174
15172
15171
15170
15169
15168
15167
15166
15165
15164
15163
15162
15161
15160
15159
15158
15157
15156
15154
15153
15152
15151
15150
15148
15147
15146
15145
15144
15143
15142
15141
15140
15139
15138
15137
15135
15134
15133
15132
15131
15130
15129
15128
15127
15126
...

result:

ok 174949 numbers

Test #149:

score: 0
Accepted
time: 174ms
memory: 46012kb

input:

50000 87499 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
3...

output:

1
1
1
0
3
3
3
2
5
5
5
4
7
7
7
6
8
8
8
7
10
10
10
9
11
12
12
12
14
14
14
13
15
15
15
14
17
17
17
16
18
18
17
18
20
20
20
19
22
22
21
22
24
24
23
24
24
23
24
24
26
26
25
26
28
28
27
28
30
29
30
30
32
32
31
32
34
34
33
34
36
36
35
36
37
37
36
37
38
38
37
38
38
39
39
39
41
41
40
41
43
43
42
43
44
44
43
...

result:

ok 174842 numbers

Test #150:

score: 0
Accepted
time: 168ms
memory: 45556kb

input:

50000 87499 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
3...

output:

1087
1087
1087
1086
1085
1084
1083
1084
1082
1082
1081
1082
1081
1080
1080
1079
1078
1077
1078
1078
1075
1076
1076
1076
1074
1074
1073
1074
1072
1072
1071
1072
1070
1070
1070
1069
1068
1068
1068
1067
1067
1067
1066
1067
1064
1065
1065
1065
1063
1063
1062
1063
1060
1061
1061
1061
1058
1059
1058
1058
...

result:

ok 175151 numbers

Test #151:

score: 0
Accepted
time: 74ms
memory: 30844kb

input:

50000 50002 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

12500
12499
12498
12497
12496
12495
12494
12492
12491
12490
12489
12488
12487
12486
12485
12484
12483
12482
12481
12480
12479
12478
12477
12475
12474
12473
12472
12471
12470
12469
12468
12467
12466
12465
12464
12463
12462
12460
12459
12458
12457
12455
12454
12453
12452
12451
12450
12449
12448
12447
...

result:

ok 174919 numbers

Test #152:

score: 0
Accepted
time: 83ms
memory: 31340kb

input:

50000 50002 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

2333
2332
2331
2330
2329
2328
2327
2326
2325
2323
2322
2321
2320
2319
2318
2317
2316
2315
2314
2313
2312
2311
2310
2309
2308
2307
2305
2304
2303
2302
2301
2300
2299
2298
2297
2296
2295
2294
2293
2292
2291
2290
2289
2288
2287
2286
2285
2284
2283
2282
2281
2280
2279
2278
2277
2276
2275
2274
2273
2271
...

result:

ok 175047 numbers

Test #153:

score: 0
Accepted
time: 76ms
memory: 27632kb

input:

37500 50002 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

3125
3124
3123
3122
3121
3120
3119
3118
3117
3116
3115
3114
3113
3112
3111
3110
3109
3108
3107
3106
3105
3104
3103
3102
3101
3100
3099
3098
3097
3096
3095
3093
3092
3091
3090
3089
3088
3087
3086
3085
3084
3083
3082
3081
3080
3079
3078
3077
3076
3075
3074
3073
3072
3071
3070
3069
3067
3066
3065
3064
...

result:

ok 174709 numbers

Test #154:

score: 0
Accepted
time: 71ms
memory: 27616kb

input:

37500 50002 10
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51...

output:

480
479
478
477
476
475
474
473
472
471
470
469
468
467
466
465
464
463
461
460
459
458
457
456
455
454
453
451
450
449
448
447
446
445
443
442
441
440
439
438
437
436
435
434
433
432
431
430
429
428
427
426
425
424
423
422
421
420
419
418
417
416
415
414
413
412
411
410
409
408
407
406
405
404
403
...

result:

ok 174820 numbers

Test #155:

score: 0
Accepted
time: 70ms
memory: 28408kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

0
1
2
3
4
5
5
6
7
8
9
8
8
9
10
9
10
11
12
13
14
15
16
17
18
18
19
19
20
21
22
23
24
25
26
25
26
23
23
24
25
26
27
28
28
29
30
30
31
32
33
34
34
35
36
37
36
37
37
38
39
40
40
41
42
43
44
45
46
47
48
48
49
50
49
50
51
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
72
73
74
75
76
...

result:

ok 166832 numbers

Test #156:

score: 0
Accepted
time: 82ms
memory: 28428kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

43555
43554
43553
43552
43550
43549
43548
43547
43546
43545
43544
43543
43542
43541
43540
43539
43538
43537
43536
43535
43534
43533
43532
43530
43529
43528
43527
43526
43524
43523
43521
43520
43519
43518
43517
43516
43515
43514
43513
43512
43511
43510
43508
43507
43506
43505
43504
43503
43502
43501
...

result:

ok 166496 numbers

Test #157:

score: 0
Accepted
time: 102ms
memory: 27548kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

0
1
2
2
3
4
5
4
5
6
7
8
9
9
10
11
12
13
13
14
15
16
17
18
19
20
21
22
21
22
23
23
24
25
25
26
27
27
27
27
28
29
30
30
31
32
32
32
33
34
35
36
37
37
38
39
40
41
42
42
43
44
45
46
46
47
48
47
48
49
50
51
52
53
53
54
55
56
57
58
58
59
60
60
61
60
61
62
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
76
77...

result:

ok 166687 numbers

Test #158:

score: 0
Accepted
time: 94ms
memory: 27680kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

6155
6154
6153
6152
6151
6150
6149
6148
6147
6146
6145
6144
6143
6142
6141
6140
6138
6137
6136
6134
6133
6132
6131
6130
6129
6128
6126
6125
6124
6123
6122
6121
6120
6119
6118
6116
6114
6113
6112
6111
6110
6109
6108
6107
6106
6105
6104
6102
6101
6100
6099
6098
6097
6096
6095
6092
6091
6090
6089
6088
...

result:

ok 166196 numbers

Test #159:

score: 0
Accepted
time: 159ms
memory: 45704kb

input:

50000 87499 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
3...

output:

14745
14745
14745
14744
14744
14743
14744
14744
14742
14743
14742
14742
14739
14738
14739
14739
14738
14738
14738
14737
14735
14736
14736
14736
14735
14735
14735
14734
14732
14733
14733
14733
14731
14731
14731
14730
14729
14729
14729
14728
14727
14727
14727
14726
14725
14724
14725
14725
14723
14723
...

result:

ok 166548 numbers

Test #160:

score: 0
Accepted
time: 172ms
memory: 45772kb

input:

50000 87499 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
3...

output:

10087
10086
10087
10087
10085
10085
10084
10085
10082
10083
10083
10083
10081
10079
10080
10079
10077
10077
10076
10077
10075
10075
10075
10074
10072
10073
10073
10073
10071
10071
10071
10070
10069
10070
10070
10070
10069
10068
10069
10069
10067
10067
10066
10067
10065
10064
10065
10065
10062
10063
...

result:

ok 166694 numbers

Test #161:

score: 0
Accepted
time: 72ms
memory: 28600kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

0
1
2
3
4
5
6
7
8
9
10
11
12
12
13
13
14
14
14
14
15
16
17
17
16
17
18
19
18
19
20
20
21
22
22
23
24
25
26
27
28
27
27
28
29
30
31
32
33
34
35
36
37
37
38
39
40
40
39
40
41
42
43
44
44
45
46
46
47
48
48
49
50
50
51
52
53
54
55
56
55
56
57
58
59
60
61
61
60
61
62
63
64
65
66
67
68
68
68
69
69
70
71
7...

result:

ok 154931 numbers

Test #162:

score: 0
Accepted
time: 69ms
memory: 28600kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

44869
44868
44867
44866
44865
44864
44863
44862
44860
44859
44858
44857
44856
44855
44853
44852
44851
44850
44849
44848
44847
44846
44845
44844
44843
44841
44840
44839
44838
44837
44836
44835
44834
44833
44832
44831
44830
44829
44828
44827
44825
44824
44823
44822
44821
44819
44818
44817
44816
44815
...

result:

ok 155052 numbers

Test #163:

score: 0
Accepted
time: 102ms
memory: 27520kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

33555
33554
33553
33552
33551
33550
33549
33548
33547
33546
33545
33544
33543
33542
33541
33540
33539
33538
33537
33535
33534
33532
33531
33530
33529
33528
33527
33526
33525
33524
33523
33522
33521
33520
33519
33518
33517
33516
33515
33514
33513
33512
33511
33510
33509
33508
33507
33505
33504
33503
...

result:

ok 154714 numbers

Test #164:

score: 0
Accepted
time: 99ms
memory: 27768kb

input:

50000 49999 0
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

33463
33462
33461
33460
33459
33458
33457
33456
33455
33454
33453
33452
33450
33448
33447
33446
33445
33444
33443
33442
33441
33440
33439
33438
33437
33436
33435
33434
33433
33431
33430
33429
33428
33427
33425
33424
33423
33422
33421
33420
33419
33418
33417
33416
33415
33414
33413
33412
33411
33410
...

result:

ok 154777 numbers

Test #165:

score: 0
Accepted
time: 167ms
memory: 45980kb

input:

50000 87499 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
3...

output:

14744
14743
14744
14744
14741
14742
14742
14742
14740
14740
14740
14739
14737
14738
14738
14738
14735
14736
14736
14736
14734
14734
14733
14734
14733
14732
14732
14732
14730
14729
14729
14729
14726
14727
14727
14727
14725
14724
14725
14725
14724
14724
14724
14723
14722
14722
14722
14720
14720
14720
...

result:

ok 154617 numbers

Test #166:

score: 0
Accepted
time: 167ms
memory: 45724kb

input:

50000 87499 6
1 2
1 3
1 4
2 3
2 4
3 4
5 6
5 7
5 8
6 7
6 8
7 8
9 10
9 11
9 12
10 11
10 12
11 12
13 14
13 15
13 16
14 15
14 16
15 16
17 18
17 19
17 20
18 19
18 20
19 20
21 22
21 23
21 24
22 23
22 24
23 24
25 26
25 27
25 28
26 27
26 28
27 28
29 30
29 31
29 32
30 31
30 32
31 32
33 34
33 35
33 36
34 35
3...

output:

4534
4534
4533
4533
4530
4529
4530
4530
4528
4528
4527
4528
4526
4526
4526
4525
4524
4524
4524
4523
4522
4521
4522
4521
4519
4518
4519
4519
4516
4517
4517
4517
4515
4514
4515
4515
4512
4512
4512
4512
4511
4511
4511
4510
4509
4509
4509
4508
4508
4507
4507
4506
4505
4505
4504
4505
4504
4504
4504
4503
...

result:

ok 155152 numbers

Test #167:

score: 0
Accepted
time: 106ms
memory: 31836kb

input:

49729 50170 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

7193
7192
7191
7190
7188
7187
7186
7185
7184
7183
7182
7181
7180
7179
7178
7177
7176
7175
7174
7173
7172
7171
7170
7169
7168
7167
7166
7165
7164
7163
7162
7161
7160
7159
7158
7157
7156
7155
7154
7152
7150
7149
7148
7147
7146
7145
7144
7143
7142
7141
7140
7139
7138
7137
7136
7135
7134
7133
7132
7131
...

result:

ok 174976 numbers

Test #168:

score: 0
Accepted
time: 105ms
memory: 32080kb

input:

49729 50182 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

4181
4182
4183
4184
4185
4186
4187
4188
4189
4190
4191
4192
4193
4194
4195
4196
4197
4198
4199
4200
4201
4202
4203
4204
4205
4206
4207
4208
4209
4209
4210
4211
4212
4213
4214
4215
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228
4228
4229
4230
4231
4232
4233
4234
4235
4236
4237
4238
...

result:

ok 175125 numbers

Test #169:

score: 0
Accepted
time: 96ms
memory: 31956kb

input:

49729 50170 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

7276
7277
7278
7279
7280
7281
7282
7283
7284
7285
7286
7287
7288
7289
7289
7289
7290
7291
7292
7292
7293
7294
7295
7296
7297
7297
7298
7299
7300
7301
7302
7303
7304
7305
7306
7307
7308
7309
7310
7311
7312
7312
7313
7314
7315
7316
7317
7318
7319
7320
7321
7322
7322
7323
7324
7324
7323
7322
7321
7320
...

result:

ok 166551 numbers

Test #170:

score: 0
Accepted
time: 108ms
memory: 32104kb

input:

49729 50151 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

8184
8185
8186
8187
8188
8189
8190
8191
8192
8193
8194
8195
8196
8197
8198
8199
8200
8201
8202
8203
8204
8205
8206
8207
8208
8209
8210
8211
8212
8213
8214
8214
8215
8216
8217
8217
8218
8219
8220
8221
8222
8223
8224
8225
8225
8226
8227
8227
8228
8229
8229
8229
8230
8231
8232
8233
8234
8235
8236
8237
...

result:

ok 154970 numbers

Test #171:

score: 0
Accepted
time: 152ms
memory: 30704kb

input:

50000 60005 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
2 8
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
12 15
13 15
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
...

output:

202
201
202
202
201
200
199
200
201
202
195
196
197
198
197
196
195
194
193
194
192
191
190
189
188
187
188
189
190
191
185
186
187
188
187
186
185
184
183
184
184
185
186
185
184
183
184
183
182
183
188
189
190
189
188
187
186
185
186
187
183
184
183
182
181
180
179
180
181
182
178
179
180
179
178
...

result:

ok 199999 numbers

Test #172:

score: 0
Accepted
time: 171ms
memory: 30828kb

input:

50000 60008 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
3 10
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 41...

output:

77
76
77
78
79
80
81
80
79
78
73
72
73
74
75
76
77
76
75
74
72
73
74
73
72
71
70
69
70
71
76
75
74
73
72
73
74
75
76
77
65
66
67
68
68
67
66
66
65
64
70
69
68
67
68
69
70
71
70
69
63
63
64
63
63
62
61
60
61
62
59
58
57
56
57
58
59
59
60
60
59
58
57
56
55
54
55
56
57
58
62
61
62
63
62
61
60
61
62
63
...

result:

ok 199999 numbers

Test #173:

score: 0
Accepted
time: 146ms
memory: 30876kb

input:

50000 59922 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
1 7
3 7
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
22 28
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
31 38
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48...

output:

130
129
128
127
128
129
129
130
131
131
129
128
127
126
127
128
129
130
131
130
131
132
133
134
135
134
133
132
131
130
132
133
134
135
136
135
134
133
134
133
125
126
125
124
123
122
121
122
123
124
129
130
131
132
131
130
129
128
127
128
119
120
121
120
121
120
119
118
117
118
119
120
121
122
123
...

result:

ok 199999 numbers

Test #174:

score: 0
Accepted
time: 90ms
memory: 31460kb

input:

50000 50022 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

11935
11936
11937
11938
11939
11938
11937
11936
11935
11934
11933
11932
11931
11930
11929
11928
11927
11926
11925
11924
11923
11922
11921
11920
11919
11918
11917
11916
11915
11914
11913
11912
11911
11910
11909
11908
11907
11906
11905
11904
11903
11902
11901
11900
11899
11898
11897
11896
11895
11894
...

result:

ok 199999 numbers

Test #175:

score: 0
Accepted
time: 92ms
memory: 32456kb

input:

50000 50015 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

5256
5255
5254
5253
5252
5251
5250
5249
5248
5247
5246
5245
5244
5243
5242
5241
5240
5239
5238
5237
5236
5235
5234
5233
5232
5231
5230
5229
5228
5227
5226
5225
5224
5223
5222
5221
5220
5219
5218
5217
5216
5215
5214
5213
5212
5211
5210
5209
5208
5207
5206
5205
5204
5203
5202
5201
5200
5199
5198
5197
...

result:

ok 199999 numbers

Test #176:

score: 0
Accepted
time: 87ms
memory: 31860kb

input:

50000 50021 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

8185
8184
8183
8182
8181
8180
8179
8178
8177
8176
8175
8174
8173
8172
8171
8170
8169
8168
8167
8166
8165
8164
8163
8162
8161
8160
8159
8158
8157
8156
8155
8154
8153
8152
8151
8150
8149
8148
8147
8146
8145
8144
8143
8142
8141
8140
8139
8138
8137
8136
8135
8134
8133
8132
8131
8130
8129
8128
8127
8126
...

result:

ok 199999 numbers

Test #177:

score: 0
Accepted
time: 139ms
memory: 31528kb

input:

50000 60033 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
1 9
2 8
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
11 17
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
28 30
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
31 37
31 33
41 42
42 43
43 44
44 45
45 46
46...

output:

194
193
193
192
191
190
191
192
193
194
187
188
189
190
190
189
188
189
189
187
185
185
184
183
182
181
182
183
184
184
181
182
182
183
183
182
181
180
179
180
178
179
179
178
177
176
176
175
176
177
183
183
182
181
180
181
182
183
183
181
174
173
172
173
173
174
175
176
175
174
175
176
177
178
179
...

result:

ok 175065 numbers

Test #178:

score: 0
Accepted
time: 159ms
memory: 31832kb

input:

50000 59957 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
12 16
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
25 28
23 29
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
36 40
38 40
41 42
42 43
43 44
44 45
45 46
46 4...

output:

127
128
129
130
129
128
127
126
125
126
122
121
120
121
122
122
122
123
123
122
118
118
117
118
118
119
118
117
116
117
114
113
112
113
114
115
116
116
116
115
109
108
109
110
111
112
113
112
111
110
106
105
106
106
107
107
106
107
108
107
103
102
103
103
104
105
105
104
104
103
103
102
103
104
105
...

result:

ok 174987 numbers

Test #179:

score: 0
Accepted
time: 174ms
memory: 31752kb

input:

50000 59824 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
14 18
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
33 38
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 5...

output:

112
111
110
109
108
109
110
111
112
113
103
104
105
106
107
108
107
106
105
104
108
76
77
78
79
78
77
76
75
74
71
70
69
68
67
66
67
68
69
70
68
67
66
65
64
63
64
65
66
67
63
62
61
60
59
60
61
62
63
64
57
57
56
55
56
57
58
59
59
58
55
54
53
52
53
54
55
56
57
56
54
54
53
52
51
52
53
54
55
55
59
58
59
...

result:

ok 174603 numbers

Test #180:

score: 0
Accepted
time: 95ms
memory: 32076kb

input:

50000 50019 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

12910
12909
12908
12907
12906
12905
12904
12903
12902
12901
12900
12899
12898
12897
12896
12895
12894
12893
12891
12890
12889
12888
12887
12886
12885
12884
12883
12881
12880
12879
12878
12877
12876
12875
12874
12873
12872
12871
12870
12869
12868
12867
12866
12865
12864
12862
12861
12860
12859
12858
...

result:

ok 174970 numbers

Test #181:

score: 0
Accepted
time: 78ms
memory: 32240kb

input:

50000 50019 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

8111
8110
8109
8108
8107
8106
8105
8104
8103
8102
8101
8100
8099
8098
8097
8096
8095
8094
8093
8092
8090
8089
8088
8087
8086
8085
8083
8082
8081
8080
8078
8077
8076
8075
8074
8073
8072
8071
8070
8069
8068
8067
8066
8065
8064
8063
8062
8061
8060
8059
8058
8057
8056
8055
8054
8053
8052
8051
8050
8049
...

result:

ok 174926 numbers

Test #182:

score: 0
Accepted
time: 100ms
memory: 31760kb

input:

50000 50019 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

10910
10911
10912
10913
10914
10915
10916
10917
10918
10919
10920
10921
10922
10923
10924
10925
10926
10927
10928
10929
10930
10931
10932
10933
10934
10935
10936
10937
10938
10939
10940
10941
10942
10943
10944
10945
10946
10947
10948
10949
10950
10951
10952
10953
10954
10955
10956
10957
10958
10959
...

result:

ok 174848 numbers

Test #183:

score: 0
Accepted
time: 163ms
memory: 32320kb

input:

50000 59935 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
11 19
18 20
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
26 30
22 24
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
35 40
41 42
42 43
43 44
44 45
45 46
46 4...

output:

204
205
206
207
206
205
204
203
202
202
200
201
202
203
204
204
203
202
201
201
201
200
200
199
198
199
200
201
201
200
198
199
198
197
195
194
195
196
197
196
198
197
198
199
200
201
200
200
199
199
201
200
201
202
203
202
203
204
203
202
193
192
191
190
191
192
193
194
195
194
186
185
186
187
188
...

result:

ok 166779 numbers

Test #184:

score: 0
Accepted
time: 166ms
memory: 32032kb

input:

50000 59963 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
3 6
2 10
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
15 18
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
23 30
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
33 37
37 39
41 42
42 43
43 44
44 45
45 46
4...

output:

136
135
134
133
132
133
134
135
136
136
135
134
133
132
130
129
130
131
132
133
129
128
127
126
127
128
129
130
129
128
122
121
122
123
124
124
123
124
124
123
119
118
117
116
117
118
118
119
120
120
117
116
116
116
115
114
113
114
115
116
115
114
113
112
113
114
115
116
115
116
115
116
117
118
119
...

result:

ok 166670 numbers

Test #185:

score: 0
Accepted
time: 155ms
memory: 32348kb

input:

50000 59800 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 41
41 4...

output:

121
122
123
115
114
113
112
111
110
111
113
112
111
110
109
108
109
110
111
112
107
106
107
108
109
110
111
110
109
76
74
73
72
73
74
75
76
77
76
75
72
73
74
74
73
73
72
71
70
71
60
61
62
63
64
63
62
61
60
59
65
66
67
67
68
68
67
66
65
64
69
70
71
72
73
72
71
70
69
68
69
70
71
70
69
68
67
68
69
68
7...

result:

ok 166569 numbers

Test #186:

score: 0
Accepted
time: 101ms
memory: 31964kb

input:

50000 50020 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

1987
1986
1985
1984
1983
1982
1981
1980
1979
1978
1977
1976
1975
1974
1973
1972
1971
1969
1968
1967
1965
1964
1963
1962
1961
1960
1959
1958
1956
1954
1953
1952
1951
1950
1949
1948
1947
1946
1945
1944
1943
1942
1941
1940
1939
1938
1937
1935
1934
1933
1932
1931
1930
1929
1927
1926
1925
1924
1923
1921
...

result:

ok 166845 numbers

Test #187:

score: 0
Accepted
time: 98ms
memory: 31968kb

input:

50000 50017 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

5366
5365
5364
5363
5362
5361
5360
5359
5358
5357
5356
5355
5354
5352
5351
5350
5349
5348
5347
5345
5344
5343
5341
5340
5339
5338
5337
5336
5335
5334
5333
5332
5331
5330
5329
5328
5327
5326
5325
5323
5322
5321
5320
5319
5318
5317
5316
5315
5313
5312
5311
5310
5309
5308
5307
5306
5305
5304
5303
5302
...

result:

ok 166576 numbers

Test #188:

score: 0
Accepted
time: 96ms
memory: 31692kb

input:

50000 50016 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

2149
2148
2147
2146
2145
2144
2143
2142
2141
2140
2139
2138
2137
2136
2135
2134
2133
2132
2131
2130
2129
2128
2127
2126
2125
2124
2123
2122
2121
2120
2119
2118
2117
2116
2115
2114
2113
2112
2111
2110
2109
2108
2107
2106
2105
2104
2103
2102
2101
2100
2099
2098
2097
2096
2095
2094
2093
2092
2091
2090
...

result:

ok 166578 numbers

Test #189:

score: 0
Accepted
time: 174ms
memory: 32108kb

input:

50000 59986 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
18 20
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
21 24
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
32 37
33 37
41 42
42 43
43 44
44 45
45 46
46 47
47 4...

output:

216
217
216
215
214
213
212
213
214
215
210
209
208
209
210
211
212
212
212
211
208
209
208
207
206
205
206
207
208
209
205
204
203
202
201
202
203
204
205
206
209
210
211
211
209
209
208
169
168
169
163
164
163
162
161
160
159
160
160
161
174
173
172
171
172
173
174
174
173
174
166
167
166
165
164
...

result:

ok 155242 numbers

Test #190:

score: 0
Accepted
time: 178ms
memory: 31228kb

input:

50000 59989 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
4 9
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
13 15
16 20
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
27 29
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
41 42
42 43
43 44
44 45
45 46
46 47
47 48
...

output:

154
155
154
153
154
155
154
153
152
153
150
149
148
149
149
150
151
152
152
151
146
145
146
146
147
148
148
148
146
145
142
143
144
145
144
143
142
141
140
141
139
138
137
138
139
140
141
142
141
140
133
134
135
136
136
135
134
134
133
132
132
132
132
130
129
128
127
128
129
130
133
132
133
134
135
...

result:

ok 154915 numbers

Test #191:

score: 0
Accepted
time: 176ms
memory: 31384kb

input:

50000 60033 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 1
7 9
1 9
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 11
12 17
14 16
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 21
21 24
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 31
32 40
35 39
41 42
42 43
43 44
44 45
45...

output:

118
119
120
119
118
117
116
117
117
118
115
96
97
87
78
77
76
77
78
79
77
78
79
78
79
78
77
76
75
76
77
77
77
76
75
74
73
74
75
76
81
80
79
73
74
75
76
75
74
75
65
66
67
68
69
68
67
66
65
64
62
61
60
61
62
63
64
65
64
63
61
60
59
58
57
58
59
60
61
62
56
57
57
58
59
59
58
57
56
55
53
54
55
56
57
57
5...

result:

ok 155112 numbers

Test #192:

score: 0
Accepted
time: 100ms
memory: 31000kb

input:

50000 50013 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

656
655
654
653
652
651
650
649
648
647
646
644
643
642
641
640
638
637
636
635
634
633
632
631
630
629
628
627
626
625
624
623
622
621
619
616
615
613
611
610
609
608
607
606
605
603
602
601
600
599
598
597
596
595
593
592
591
590
589
586
585
584
583
582
581
580
578
577
576
575
574
573
572
570
569
...

result:

ok 155175 numbers

Test #193:

score: 0
Accepted
time: 99ms
memory: 32228kb

input:

50000 50019 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

10765
10766
10767
10768
10769
10770
10771
10772
10773
10774
10775
10776
10777
10778
10779
10780
10781
10782
10783
10783
10784
10785
10786
10787
10788
10789
10790
10791
10791
10792
10793
10794
10795
10796
10797
10798
10799
10800
10801
10802
10802
10803
10804
10804
10805
10806
10807
10808
10807
10807
...

result:

ok 154853 numbers

Test #194:

score: 0
Accepted
time: 98ms
memory: 30452kb

input:

50000 50019 6
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
49 50
50 51
51 ...

output:

1607
1606
1605
1604
1603
1602
1601
1600
1599
1598
1597
1596
1595
1594
1593
1592
1591
1590
1589
1588
1587
1586
1585
1584
1583
1582
1581
1580
1579
1578
1577
1576
1575
1574
1573
1572
1571
1570
1569
1568
1567
1566
1565
1564
1563
1562
1561
1560
1559
1558
1557
1556
1555
1554
1553
1552
1551
1550
1549
1548
...

result:

ok 155024 numbers

Test #195:

score: 0
Accepted
time: 204ms
memory: 57324kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

221
222
222
222
222
222
222
222
222
222
222
222
222
222
222
222
222
222
222
220
221
218
219
219
217
218
219
219
219
219
219
219
219
219
219
219
219
219
219
219
219
219
215
216
216
216
216
216
216
215
214
216
216
216
216
216
216
216
216
216
216
216
216
212
213
213
213
213
213
213
211
212
213
213
213
...

result:

ok 199999 numbers

Test #196:

score: 0
Accepted
time: 182ms
memory: 61108kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

129
130
130
130
130
130
130
130
130
130
130
128
129
130
130
130
130
130
130
130
130
126
127
127
127
127
127
127
125
126
127
127
127
127
127
127
127
127
127
127
127
127
123
124
124
124
124
124
124
124
124
124
124
124
124
123
122
124
124
124
124
124
124
120
121
121
121
121
121
121
121
121
121
121
121
...

result:

ok 199999 numbers

Test #197:

score: 0
Accepted
time: 167ms
memory: 56808kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

167
168
168
168
168
168
168
168
168
168
168
166
167
168
168
168
168
168
168
168
168
164
165
165
163
164
165
165
165
165
165
165
165
165
165
165
165
165
165
165
165
165
161
162
162
162
162
162
162
162
162
162
162
162
162
162
162
160
161
162
162
162
162
158
159
159
159
159
159
159
158
157
159
159
159
...

result:

ok 199999 numbers

Test #198:

score: 0
Accepted
time: 151ms
memory: 47108kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

163
164
164
164
164
162
163
164
164
164
164
164
164
164
164
164
164
164
164
164
164
160
161
161
161
161
159
160
161
161
161
161
161
161
161
161
161
161
161
161
161
161
157
158
158
158
158
158
158
158
158
158
158
157
156
158
158
158
158
158
158
158
158
154
155
155
155
155
155
155
154
153
155
155
155
...

result:

ok 183434 numbers

Test #199:

score: 0
Accepted
time: 155ms
memory: 49500kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

195
196
196
196
196
196
196
196
196
196
196
196
196
196
196
196
196
194
195
196
196
192
193
193
193
193
193
192
192
192
190
191
192
192
192
192
192
192
192
192
192
192
189
190
190
190
190
190
190
190
190
190
190
190
190
189
188
190
190
190
190
190
190
186
187
187
187
187
187
187
187
187
187
187
187
...

result:

ok 183316 numbers

Test #200:

score: 0
Accepted
time: 166ms
memory: 55652kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

42
43
43
43
43
43
43
43
43
43
43
43
43
43
43
43
43
43
43
43
43
40
41
41
41
41
39
40
41
41
41
41
41
41
41
41
41
41
41
41
41
41
37
37
36
38
38
38
38
38
38
38
38
38
38
38
38
38
38
38
38
38
38
34
35
35
35
35
35
35
35
35
35
35
33
34
35
35
35
35
35
35
35
35
37
38
38
38
38
38
38
38
38
38
38
38
38
36
37
38
...

result:

ok 183188 numbers

Test #201:

score: 0
Accepted
time: 2ms
memory: 13184kb

input:

1 0 0
1
1 1

output:


result:

ok 0 number(s): ""

Test #202:

score: 0
Accepted
time: 166ms
memory: 54816kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

188
189
189
189
189
189
189
189
189
189
189
187
188
189
189
189
189
189
189
189
189
185
186
186
186
186
185
184
186
186
186
186
186
186
186
186
186
186
186
186
186
186
182
183
183
183
183
183
183
183
183
183
183
183
183
183
183
183
183
181
182
183
183
179
180
180
180
180
180
180
180
180
180
180
180
...

result:

ok 175261 numbers

Test #203:

score: 0
Accepted
time: 166ms
memory: 54048kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

71
72
72
72
72
72
72
70
71
72
72
72
72
72
71
71
71
71
71
71
71
67
68
68
68
68
68
68
68
68
67
66
68
68
68
68
68
68
68
68
68
68
64
63
64
65
65
65
65
65
65
65
65
65
65
65
65
65
65
65
65
65
65
63
64
64
63
62
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
64
60
61
61
61
61
61
61
61
61
61
61
60
59
61
61
61
...

result:

ok 175183 numbers

Test #204:

score: 0
Accepted
time: 177ms
memory: 54464kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

151
152
152
152
152
152
152
152
152
152
152
150
151
152
152
152
100
100
100
100
100
96
97
97
97
97
96
95
97
76
76
76
76
76
76
76
76
76
76
76
76
76
72
73
73
73
73
72
71
73
73
73
73
73
73
73
73
73
73
73
73
73
73
70
71
71
66
66
66
66
66
66
66
66
66
66
66
66
64
65
66
66
66
66
62
63
63
63
63
63
63
63
63
...

result:

ok 175096 numbers

Test #205:

score: 0
Accepted
time: 169ms
memory: 57104kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

191
190
191
192
192
192
192
192
192
192
192
192
192
192
192
192
192
192
192
192
192
189
190
190
190
190
190
190
189
188
190
190
190
190
190
190
190
190
190
190
190
190
186
187
187
187
187
187
187
187
187
187
187
187
187
187
187
187
187
185
186
187
187
184
185
185
185
185
185
185
185
185
185
185
185
...

result:

ok 166827 numbers

Test #206:

score: 0
Accepted
time: 158ms
memory: 48624kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

141
142
142
142
142
142
142
142
142
142
142
142
141
141
141
141
141
139
140
141
141
137
138
138
138
138
138
138
138
138
138
138
137
136
138
138
138
138
138
138
138
138
134
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
135
134
133
135
135
131
132
132
132
132
130
131
132
132
132
132
132
...

result:

ok 166600 numbers

Test #207:

score: 0
Accepted
time: 145ms
memory: 50332kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

139
140
140
140
140
140
140
140
140
140
101
101
101
101
101
101
101
99
100
101
66
62
63
63
63
63
63
63
62
61
63
63
63
63
63
63
63
63
63
63
63
63
59
60
60
60
60
60
60
60
60
60
60
58
59
60
60
60
60
60
60
60
60
56
57
57
57
57
57
57
57
57
57
57
57
57
57
57
57
57
55
56
57
57
53
53
52
54
54
54
54
54
54
54...

result:

ok 166662 numbers

Test #208:

score: 0
Accepted
time: 189ms
memory: 57280kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

201
202
202
202
202
202
202
202
202
202
202
200
201
202
202
202
202
202
202
202
202
199
200
200
200
200
200
200
200
200
199
198
200
200
200
200
200
200
200
200
200
200
197
198
198
198
198
198
198
198
198
198
198
198
198
198
198
198
198
196
197
198
198
194
195
195
195
195
195
195
195
195
195
195
195
...

result:

ok 154827 numbers

Test #209:

score: 0
Accepted
time: 152ms
memory: 50788kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

183
184
184
182
183
184
184
183
183
183
183
183
183
183
183
183
183
183
183
183
183
179
180
180
180
180
180
180
180
180
180
180
180
180
179
178
180
180
180
180
180
180
176
177
177
177
177
175
176
177
177
177
177
177
177
177
177
177
177
177
177
177
177
173
174
174
174
174
174
174
174
174
174
174
172
...

result:

ok 154781 numbers

Test #210:

score: 0
Accepted
time: 198ms
memory: 57052kb

input:

49980 73779 10
1 2
1 3
2 3
1 4
1 5
4 5
1 6
1 7
6 7
1 8
1 9
8 9
1 10
1 11
10 11
1 12
1 13
12 13
1 14
1 15
14 15
1 16
1 17
16 17
1 18
1 19
18 19
1 20
1 21
20 21
22 23
22 24
23 24
22 25
22 26
25 26
22 27
22 28
27 28
22 29
22 30
29 30
22 31
22 32
31 32
22 33
22 34
33 34
22 35
22 36
35 36
22 37
22 38
37 ...

output:

162
163
163
163
163
162
161
163
149
149
149
149
149
149
149
149
149
149
149
102
102
98
99
99
88
88
88
88
88
88
88
88
88
88
87
86
88
88
88
88
88
88
84
85
85
85
85
85
85
85
85
85
80
78
79
80
80
80
80
80
80
80
80
76
75
76
77
77
77
77
77
77
77
77
61
61
61
61
61
61
61
61
61
61
57
57
56
58
58
58
58
58
58
...

result:

ok 155248 numbers

Test #211:

score: 0
Accepted
time: 109ms
memory: 34464kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

33333
33333
33332
33331
33331
33330
33329
33329
33328
33327
33327
33326
33325
33325
33324
33323
33323
33322
33321
33321
33320
33319
33319
33318
33317
33317
33316
33315
33315
33314
33313
33313
33312
33311
33311
33310
33309
33309
33308
33307
33307
33306
33305
33305
33304
33303
33303
33302
33301
33301
...

result:

ok 199999 numbers

Test #212:

score: 0
Accepted
time: 92ms
memory: 34460kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

28885
28885
28884
28883
28883
28882
28881
28881
28880
28879
28879
28878
28877
28877
28876
28875
28875
28874
28873
28873
28872
28871
28871
28870
28869
28869
28868
28867
28867
28866
28865
28865
28864
28863
28863
28862
28861
28861
28860
28859
28859
28858
28857
28857
28856
28855
28855
28854
28853
28853
...

result:

ok 199999 numbers

Test #213:

score: 0
Accepted
time: 96ms
memory: 34428kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

5825
5825
5824
5823
5823
5822
5821
5821
5820
5819
5819
5818
5817
5817
5816
5815
5815
5814
5813
5813
5812
5811
5811
5810
5809
5809
5808
5807
5807
5806
5805
5805
5804
5803
5803
5802
5801
5801
5800
5799
5799
5798
5797
5797
5796
5795
5795
5794
5793
5793
5792
5791
5791
5790
5789
5789
5788
5787
5787
5786
...

result:

ok 199999 numbers

Test #214:

score: 0
Accepted
time: 100ms
memory: 34672kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

33333
33333
33332
33331
33331
33330
33328
33328
33327
33325
33325
33324
33323
33323
33322
33320
33320
33319
33317
33317
33316
33315
33315
33314
33313
33313
33311
33310
33310
33309
33308
33308
33307
33306
33306
33305
33304
33304
33303
33302
33302
33301
33299
33299
33298
33297
33297
33296
33295
33295
...

result:

ok 183302 numbers

Test #215:

score: 0
Accepted
time: 115ms
memory: 34676kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

4092
4092
4091
4090
4090
4089
4088
4088
4087
4086
4086
4085
4084
4083
4082
4081
4081
4080
4079
4079
4078
4077
4077
4076
4075
4075
4074
4073
4073
4072
4071
4071
4070
4069
4069
4068
4067
4067
4066
4065
4065
4064
4063
4063
4062
4061
4061
4059
4058
4058
4057
4056
4056
4055
4054
4054
4053
4052
4052
4051
...

result:

ok 183503 numbers

Test #216:

score: 0
Accepted
time: 99ms
memory: 34612kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

28873
28873
28872
28871
28871
28870
28869
28869
28868
28867
28867
28866
28865
28865
28864
28863
28863
28862
28861
28861
28860
28859
28859
28858
28857
28857
28856
6138
6138
6137
6136
6136
6135
6134
6134
6133
6132
6132
6131
6130
6130
6129
6128
6128
6127
6126
6126
6125
6124
6124
6123
6122
6122
6121
612...

result:

ok 183445 numbers

Test #217:

score: 0
Accepted
time: 101ms
memory: 34468kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

0
1
1
2
3
3
4
5
5
6
7
7
8
9
9
10
11
11
12
13
13
14
14
13
14
15
15
16
17
17
18
19
19
20
21
21
22
23
22
22
23
23
24
25
25
26
27
27
28
29
29
30
31
31
32
33
33
34
35
35
36
37
37
37
37
37
38
39
39
40
41
41
42
43
43
44
45
45
46
47
46
46
47
47
48
48
48
49
49
49
50
51
51
52
53
53
54
55
55
56
57
57
58
59
59
...

result:

ok 174751 numbers

Test #218:

score: 0
Accepted
time: 101ms
memory: 34396kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

30649
30649
30648
30647
30647
30646
30645
30645
30643
30642
30642
30641
30640
30640
30639
30638
30638
30637
30636
30636
30635
30633
30633
30632
30631
30631
30630
30629
30629
30628
30627
30627
30626
30625
30625
30624
30623
30623
30622
30621
30621
30620
30619
30619
30618
30616
30616
30615
30614
30614
...

result:

ok 175014 numbers

Test #219:

score: 0
Accepted
time: 108ms
memory: 34484kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

11390
11390
11389
11388
11388
11387
11386
3207
3206
3205
3205
3204
3203
3203
3202
3201
3201
3200
3199
3199
3198
3197
3197
3196
3195
3195
3194
3193
3193
3192
3191
3191
3190
3189
3189
3188
3187
3187
3186
3185
3185
3184
3183
3183
3182
3181
3181
3180
3179
3179
3178
3177
3177
3176
3175
3175
3174
3173
317...

result:

ok 174839 numbers

Test #220:

score: 0
Accepted
time: 94ms
memory: 34408kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

33333
33333
33332
33331
33331
33330
33328
33328
33327
33326
33326
33325
33324
33324
33323
33322
33322
33321
33319
33318
33317
33315
33315
33314
33313
33313
33311
33309
33309
33308
33307
33307
33306
33305
33304
33303
33302
33302
33301
33300
33300
33299
33298
33298
33297
33296
33296
33295
33294
33294
...

result:

ok 166965 numbers

Test #221:

score: 0
Accepted
time: 84ms
memory: 34400kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

31797
31797
31796
31795
31795
31794
31793
31793
31792
31791
31791
31789
31788
31788
31787
31786
31786
31785
31784
31784
31783
31782
31781
31780
31779
31779
31778
31777
31777
31776
31775
31775
31774
31773
31773
31772
31771
31771
31770
31769
31769
31768
31767
31767
31766
31765
31765
31764
31763
31763
...

result:

ok 166459 numbers

Test #222:

score: 0
Accepted
time: 104ms
memory: 34412kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

18769
18769
18768
18767
18767
18766
18765
18765
18764
18763
18763
18762
1112
1112
1111
1110
1110
1109
1108
1108
1107
1106
1106
1105
1104
1104
1103
1102
1102
1101
1100
1100
1099
1098
1098
1097
1096
1096
1095
1094
1094
1093
901
901
900
899
899
898
897
897
896
895
895
894
893
893
892
891
891
890
889
88...

result:

ok 166974 numbers

Test #223:

score: 0
Accepted
time: 91ms
memory: 34616kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

0
0
0
1
0
1
2
3
3
3
4
4
4
5
5
5
5
5
6
7
7
8
8
8
9
9
9
10
11
11
12
13
13
14
14
14
15
15
15
16
17
17
18
19
19
20
21
21
22
22
21
22
23
23
24
25
25
25
26
26
27
28
28
29
27
24
25
26
26
27
27
27
28
28
27
28
28
28
29
29
29
29
30
30
31
31
31
32
33
33
34
35
34
35
35
34
35
35
35
36
37
37
38
39
38
39
40
40
41
...

result:

ok 155032 numbers

Test #224:

score: 0
Accepted
time: 86ms
memory: 34368kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

13408
13408
13407
13406
13405
13404
13403
13403
13402
13401
13401
13400
13399
13399
13398
13397
13397
13396
13395
13394
13393
13391
13391
13390
13389
13389
13387
13386
13386
13385
13384
13384
13383
13382
13382
13381
13380
13380
13378
13377
13377
13376
13375
13375
13374
13373
13373
13372
13370
13370
...

result:

ok 155206 numbers

Test #225:

score: 0
Accepted
time: 126ms
memory: 34488kb

input:

50000 66665 2
1 2
2 3
1 3
3 4
4 5
5 6
4 6
6 7
7 8
8 9
7 9
9 10
10 11
11 12
10 12
12 13
13 14
14 15
13 15
15 16
16 17
17 18
16 18
18 19
19 20
20 21
19 21
21 22
22 23
23 24
22 24
24 25
25 26
26 27
25 27
27 28
28 29
29 30
28 30
30 31
31 32
32 33
31 33
33 34
34 35
35 36
34 36
36 37
37 38
38 39
37 39
39 ...

output:

14911
14911
14910
14909
14909
14908
14907
14907
14906
11643
11643
11642
11641
11641
11640
11639
11639
11638
11637
11637
11636
11635
11635
3359
3358
3358
3357
3356
3356
3355
3354
3354
3353
3352
3352
3351
3350
3350
3349
3348
3348
3347
3346
3346
3345
3344
3344
3343
3342
3342
847
846
846
845
844
844
843...

result:

ok 155059 numbers

Test #226:

score: 0
Accepted
time: 140ms
memory: 46788kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

1
1
0
1
2
2
3
3
3
4
4
5
5
5
6
6
7
7
7
8
8
9
9
9
10
10
11
11
11
12
12
13
13
13
14
14
15
15
15
16
16
17
17
17
18
18
19
19
19
20
20
21
21
21
22
22
23
23
23
24
24
25
25
25
26
26
27
27
27
28
28
29
29
29
30
30
31
31
31
32
32
33
33
33
34
34
35
35
35
36
36
37
37
37
38
38
39
39
39
40
40
41
41
41
42
42
43
43
...

result:

ok 199999 numbers

Test #227:

score: 0
Accepted
time: 126ms
memory: 46500kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

14454
14454
14454
14453
14453
14452
14452
14452
14451
14451
14450
14450
14450
14449
14449
14448
14448
14448
14447
14447
14446
14446
14446
14445
14445
14444
14444
14444
14443
14443
14442
14442
14442
14441
14441
14440
14440
14440
14439
14439
14438
14438
14438
14437
14437
14436
14436
14436
14435
14435
...

result:

ok 199999 numbers

Test #228:

score: 0
Accepted
time: 142ms
memory: 46552kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

4943
4943
4943
4942
4942
4941
4941
4941
4940
4940
4939
4939
4939
4938
4938
4937
4937
4937
4936
4936
4935
4935
4935
4934
4934
4933
4933
4933
4932
4932
4931
4931
4931
4930
4930
4929
4929
4929
4928
4928
4927
4927
4927
4926
4926
4925
4925
4925
4924
4924
4923
4923
4923
4922
4922
4921
4921
4921
4920
4920
...

result:

ok 199999 numbers

Test #229:

score: 0
Accepted
time: 131ms
memory: 46692kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

1
1
0
1
2
2
3
3
3
4
4
5
5
5
6
6
7
7
7
8
8
9
9
9
10
10
11
11
11
12
12
13
13
13
14
14
15
15
15
16
16
17
17
17
18
18
19
19
19
20
20
21
21
21
22
22
23
23
23
24
24
25
25
25
26
26
27
27
27
28
28
29
29
29
30
29
30
30
30
31
31
32
32
32
33
33
34
34
34
35
35
36
36
36
37
37
38
38
38
39
39
40
40
40
41
41
42
42
...

result:

ok 183358 numbers

Test #230:

score: 0
Accepted
time: 138ms
memory: 46540kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

7775
7775
7775
7774
7774
7773
7773
7773
7772
7771
7770
7770
7770
7769
7769
7768
7768
7768
7767
7767
7766
7766
7766
7765
7765
7764
7764
7764
7763
7763
7762
7762
7762
7761
7761
7760
7760
7759
7758
7758
7757
7757
7757
7756
7756
7755
7755
7755
7754
7754
7753
7753
7753
7752
7752
7751
7751
7751
7750
7750
...

result:

ok 183295 numbers

Test #231:

score: 0
Accepted
time: 146ms
memory: 46568kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

19490
19490
19490
19489
19489
19488
19488
19488
19487
19487
19486
19486
19486
19485
19485
19484
19484
411
410
410
409
409
409
408
408
407
407
407
406
406
405
405
405
404
404
403
403
403
402
402
401
401
401
400
400
399
399
399
398
398
397
397
397
396
396
395
395
395
394
394
393
393
393
392
392
391
39...

result:

ok 183411 numbers

Test #232:

score: 0
Accepted
time: 142ms
memory: 46440kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

1
1
0
1
2
2
3
3
3
4
4
5
5
4
5
5
6
6
5
6
6
7
7
7
8
8
9
8
8
9
9
10
10
10
11
11
12
12
12
13
13
14
14
14
15
15
16
16
16
16
16
17
17
17
18
18
19
19
19
20
20
21
21
21
22
22
23
23
23
24
24
24
24
24
25
25
26
26
26
27
27
28
28
28
29
29
30
30
29
30
30
31
31
31
32
32
33
33
33
34
34
35
35
35
36
36
37
37
37
38
3...

result:

ok 174874 numbers

Test #233:

score: 0
Accepted
time: 146ms
memory: 46544kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

9178
9178
9178
9177
9177
9176
9176
9176
9175
9175
9174
9174
9174
9172
9172
9171
9171
9171
9170
9170
9169
9169
9169
9168
9168
9167
9167
9167
9166
9166
9165
9165
9165
9164
9164
9163
9163
9162
9161
9161
9160
9160
9160
9159
9159
9158
9158
9158
9157
9157
9156
9156
9156
9155
9155
9154
9154
9154
9152
9152
...

result:

ok 175024 numbers

Test #234:

score: 0
Accepted
time: 151ms
memory: 46484kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

13727
13727
13727
13726
12552
12551
12551
12551
12550
12550
12549
12549
12549
12548
12548
12547
12547
12547
12546
12546
12545
430
430
429
429
428
428
428
427
427
426
426
426
425
425
424
424
424
423
423
422
422
422
421
421
420
420
420
419
419
418
418
418
417
417
416
416
416
415
415
414
414
414
413
41...

result:

ok 175158 numbers

Test #235:

score: 0
Accepted
time: 145ms
memory: 46484kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

1
1
0
1
2
2
3
3
3
4
4
5
5
5
6
6
7
7
7
8
8
9
9
8
9
9
9
9
9
10
10
11
11
11
12
12
12
12
12
13
13
14
14
13
14
13
14
14
14
15
15
16
16
16
17
17
18
18
18
19
19
20
20
20
21
21
22
22
21
22
22
23
23
23
24
24
25
24
24
25
25
26
26
26
26
26
27
27
27
28
28
29
29
29
30
30
31
31
31
32
32
32
32
32
33
33
34
34
33
34...

result:

ok 167011 numbers

Test #236:

score: 0
Accepted
time: 131ms
memory: 46528kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

9515
9515
9515
9514
9514
9513
9513
9513
9512
9512
9510
9510
9510
9509
9509
9508
9508
9508
9507
9507
9506
9506
9506
9504
9504
9503
9503
9503
9502
9502
9501
9500
9500
9499
9499
9498
9498
9498
9497
9497
9496
9496
9496
9495
9495
9494
9494
9494
9493
9493
9492
9491
9491
9490
9490
9489
9489
9488
9487
9487
...

result:

ok 166620 numbers

Test #237:

score: 0
Accepted
time: 147ms
memory: 46552kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

338
338
338
337
337
336
336
336
335
335
334
334
334
333
333
332
332
332
331
331
330
330
330
329
329
328
328
328
327
327
326
326
326
325
325
324
324
324
323
323
322
322
322
321
321
320
320
320
319
319
318
318
318
317
317
316
316
316
315
315
314
314
314
313
313
312
312
312
311
311
310
310
310
309
309
...

result:

ok 166668 numbers

Test #238:

score: 0
Accepted
time: 135ms
memory: 46480kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

19999
19999
19999
19998
19998
19997
19997
19997
19996
19996
19995
19995
19995
19994
19994
19993
19993
19993
19992
19992
19991
19991
19991
19990
19990
19989
19989
19989
19988
19988
19987
19987
19987
19986
19985
19984
19984
19984
19982
19982
19981
19981
19981
19979
19979
19978
19978
19978
19977
19977
...

result:

ok 155091 numbers

Test #239:

score: 0
Accepted
time: 129ms
memory: 46444kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

10693
10693
10693
10691
10691
10690
10690
10690
10688
10688
10687
10687
10687
10686
10686
10685
10685
10685
10684
10684
10683
10683
10683
10682
10682
10681
10681
10681
10680
10680
10679
10679
10679
10678
10678
10677
10676
10676
10675
10675
10674
10674
10674
10673
10673
10672
10671
10671
10670
10670
...

result:

ok 155248 numbers

Test #240:

score: 0
Accepted
time: 152ms
memory: 46552kb

input:

49999 89997 7
1 2
1 3
1 4
2 3
2 4
3 4
4 5
4 6
5 6
6 7
6 8
6 9
7 8
7 9
8 9
9 10
9 11
10 11
11 12
11 13
11 14
12 13
12 14
13 14
14 15
14 16
15 16
16 17
16 18
16 19
17 18
17 19
18 19
19 20
19 21
20 21
21 22
21 23
21 24
22 23
22 24
23 24
24 25
24 26
25 26
26 27
26 28
26 29
27 28
27 29
28 29
29 30
29 31
...

output:

5487
5487
5487
5486
5486
5485
5485
5485
5484
5484
5483
5483
5483
5482
5482
5481
5481
5481
5480
5480
5479
5479
4053
2778
2778
2777
2777
2777
2776
2776
2775
2775
2775
2774
2774
2773
2773
2773
2772
2772
2771
2771
2771
2770
2770
830
830
830
829
829
828
828
828
827
827
826
826
826
825
825
824
824
824
823...

result:

ok 155364 numbers