QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#429743#8726. Magic ShowSanguineChameleon100 ✓372ms0kbC++233.3kb2024-06-02 20:16:272024-06-02 20:16:27

Judging History

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

  • [2024-06-02 20:16:27]
  • 评测
  • 测评结果:100
  • 用时:372ms
  • 内存:0kb
  • [2024-06-02 20:16:27]
  • 提交

Alice

#include "Alice.h"
#include <bits/stdc++.h>
using namespace std;

namespace alice_rng {
	unsigned long long state = 88172645463325252LL;

	long long rand_bits(int k) {
		state ^= (state << 13);
		state ^= (state >> 7);
		state ^= (state << 17);
		return (state & ((1LL << k) - 1));
	}

	long long rand_int(long long l, long long r) {
		long long d = r - l;
		int k = 0;
		while ((1LL << k) <= d) {
			k++;
		}
		while (true) {
			long long x = rand_bits(k);
			if (x <= d) {
				return l + x;
			}
		}
	}

	template <typename T>
	void shuffle(T *first, T *last) {
		int n = last - first;
		for (int i = 0; i < n; i++) {
			T *p1 = first + i;
			T *p2 = first + rand_int(i, n - 1);
			int tmp = *p1;
			*p1 = *p2;
			*p2 = tmp;
		}
	}
}

namespace alice_edges {
	const int K = 60;
	const int M = 83;
	const int N = K * M + 2;
	long long weight[N][N];
	int pos[K * M];

	void build() {
		for (int i = 0; i < K; i++) {
			fill(pos + i * M, pos + (i + 1) * M, i);
		}
		alice_rng::shuffle(pos, pos + K * M);
		for (int i = 2; i < N; i++) {
			while (true) {
				int sum = 0;
				for (int j = 0; j < i; j++) {
					weight[i][j] = alice_rng::rand_bits(1);
					sum += weight[i][j];
				}
				if (sum != 0 && sum != i) {
					break;
				}
			}
			alice_rng::shuffle(weight[i], weight[i] + i);
			for (int j = 0; j < i; j++) {
				weight[i][j] <<= pos[i - 2];
			}
		}
	}
}

vector<pair<int, int>> Alice() {
	alice_edges::build();
	long long X = setN(alice_edges::N);
	vector<pair<int, int>> res;
	for (int i = 1; i < alice_edges::N; i++) {
		while (true) {
			int j = alice_rng::rand_int(0, i - 1);
			if ((X & alice_edges::weight[i][j]) == alice_edges::weight[i][j]) {
				res.emplace_back(j + 1, i + 1);
				break;
			}
		}
	}
	return res;
}

Bob

#include "Bob.h"
#include <bits/stdc++.h>
using namespace std;

namespace bob_rng {
	unsigned long long state = 88172645463325252LL;

	long long rand_bits(int k) {
		state ^= (state << 13);
		state ^= (state >> 7);
		state ^= (state << 17);
		return (state & ((1LL << k) - 1));
	}

	long long rand_int(long long l, long long r) {
		long long d = r - l;
		int k = 0;
		while ((1LL << k) <= d) {
			k++;
		}
		while (true) {
			long long x = rand_bits(k);
			if (x <= d) {
				return l + x;
			}
		}
	}

	template <typename T>
	void shuffle(T *first, T *last) {
		int n = last - first;
		for (int i = 0; i < n; i++) {
			T *p1 = first + i;
			T *p2 = first + rand_int(i, n - 1);
			int tmp = *p1;
			*p1 = *p2;
			*p2 = tmp;
		}
	}
}

namespace bob_edges {
	const int K = 60;
	const int M = 83;
	const int N = K * M + 2;
	long long weight[N][N];
	int pos[K * M];

	void build() {
		for (int i = 0; i < K; i++) {
			fill(pos + i * M, pos + (i + 1) * M, i);
		}
		bob_rng::shuffle(pos, pos + K * M);
		for (int i = 2; i < N; i++) {
			while (true) {
				int sum = 0;
				for (int j = 0; j < i; j++) {
					weight[i][j] = bob_rng::rand_bits(1);
					sum += weight[i][j];
				}
				if (sum != 0 && sum != i) {
					break;
				}
			}
			bob_rng::shuffle(weight[i], weight[i] + i);
			for (int j = 0; j < i; j++) {
				weight[i][j] <<= pos[i - 2];
			}
		}
	}
}

long long Bob(vector<pair<int, int>> V) {
	bob_edges::build();
	long long res = 0;
	for (auto [j, i]: V) {
		j--;
		i--;
		res |= bob_edges::weight[i][j];
	}
	return res;
}

详细

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 363ms = 170ms + 193ms

input:

1
4005

output:

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

input:

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

output:

2
4982 3505
1 2
1 3
1 6
1 10
1 15
1 59
2 13
2 27
2 31
2 68
2 351
3 5
3 11
3 24
3 26
4 8
4 121
4 525
4 2941
5 12
5 21
5 23
5 78
5 206
5 340
5 1832
6 9
6 14
6 88
6 231
6 469
6 510
6 642
6 2885
7 28
7 133
7 1067
7 2937
7 3861
7 3959
9 36
9 52
9 60
9 290
9 2767
9 3796
9 4339
10 25
10 47
10 161
10 373
10...

input:

2
4982 3505
1 2
1 3
1 6
1 10
1 15
1 59
2 13
2 27
2 31
2 68
2 351
3 5
3 11
3 24
3 26
4 8
4 121
4 525
4 2941
5 12
5 21
5 23
5 78
5 206
5 340
5 1832
6 9
6 14
6 88
6 231
6 469
6 510
6 642
6 2885
7 28
7 133
7 1067
7 2937
7 3861
7 3959
9 36
9 52
9 60
9 290
9 2767
9 3796
9 4339
10 25
10 47
10 161
10 373
10...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

score: 5
Accepted
time: 347ms = 163ms + 184ms

input:

1
459

output:

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

input:

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

output:

2
4982 3696
1 2
1 3
1 6
1 10
1 15
1 59
1 126
1 1173
1 1491
2 17
2 27
2 31
2 37
2 68
2 332
2 1315
2 3404
3 5
3 11
3 26
3 89
3 200
3 265
3 606
4 8
4 2941
5 7
5 12
5 21
5 78
5 236
5 324
5 1832
6 53
6 88
6 144
6 456
6 632
6 1331
7 28
7 79
7 115
7 2936
8 388
8 1896
9 30
9 52
9 60
9 149
9 335
9 826
9 1522...

input:

2
4982 3696
1 2
1 3
1 6
1 10
1 15
1 59
1 126
1 1173
1 1491
2 17
2 27
2 31
2 37
2 68
2 332
2 1315
2 3404
3 5
3 11
3 26
3 89
3 200
3 265
3 606
4 8
4 2941
5 7
5 12
5 21
5 78
5 236
5 324
5 1832
6 53
6 88
6 144
6 456
6 632
6 1331
7 28
7 79
7 115
7 2936
8 388
8 1896
9 30
9 52
9 60
9 149
9 335
9 826
9 1522...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

score: 5
Accepted
time: 359ms = 167ms + 192ms

input:

1
2495

output:

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

input:

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

output:

2
4982 3696
1 2
1 3
1 6
1 10
1 15
1 59
1 126
1 1194
2 17
2 27
2 31
2 68
2 128
2 155
3 5
3 11
3 26
3 277
4 8
4 117
4 280
4 2969
5 7
5 12
5 21
5 78
5 208
5 1836
6 53
6 88
6 158
6 480
6 663
6 2912
7 28
7 79
7 1134
7 2962
8 346
8 788
8 1843
8 1903
9 30
9 52
9 60
9 895
9 2791
9 3888
10 25
10 47
10 48
10 ...

input:

2
4982 3696
1 2
1 3
1 6
1 10
1 15
1 59
1 126
1 1194
2 17
2 27
2 31
2 68
2 128
2 155
3 5
3 11
3 26
3 277
4 8
4 117
4 280
4 2969
5 7
5 12
5 21
5 78
5 208
5 1836
6 53
6 88
6 158
6 480
6 663
6 2912
7 28
7 79
7 1134
7 2962
8 346
8 788
8 1843
8 1903
9 30
9 52
9 60
9 895
9 2791
9 3888
10 25
10 47
10 48
10 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

score: 5
Accepted
time: 343ms = 171ms + 172ms

input:

3
1560

output:

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

input:

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

output:

4
4982 2491
1 2
1 3
1 4
1 6
1 10
1 15
1 59
1 126
1 1061
1 1173
1 1599
8 2246
17 4949
25 1445
25 2767
33 2002
33 3648
40 645
42 738
53 85
53 267
60 4497
66 1379
79 975
79 1924
85 1359
101 1695
105 1311
106 125
113 1251
114 717
114 789
117 418
120 3619
123 808
125 2702
129 494
129 4193
130 555
130 241...

input:

4
4982 2491
1 2
1 3
1 4
1 6
1 10
1 15
1 59
1 126
1 1061
1 1173
1 1599
8 2246
17 4949
25 1445
25 2767
33 2002
33 3648
40 645
42 738
53 85
53 267
60 4497
66 1379
79 975
79 1924
85 1359
101 1695
105 1311
106 125
113 1251
114 717
114 789
117 418
120 3619
123 808
125 2702
129 494
129 4193
130 555
130 241...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

score: 5
Accepted
time: 339ms = 175ms + 164ms

input:

3
3594

output:

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

input:

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

output:

4
4982 2491
17 3149
28 104
41 1151
60 182
64 2456
66 1377
70 916
70 1564
75 378
75 3242
95 254
104 140
104 325
104 495
104 620
104 1239
104 1301
104 1420
104 2148
104 3626
104 4782
104 4949
105 1311
113 1251
120 280
120 387
123 808
125 2702
132 1765
139 152
139 233
143 652
146 361
146 799
147 373
14...

input:

4
4982 2491
17 3149
28 104
41 1151
60 182
64 2456
66 1377
70 916
70 1564
75 378
75 3242
95 254
104 140
104 325
104 495
104 620
104 1239
104 1301
104 1420
104 2148
104 3626
104 4782
104 4949
105 1311
113 1251
120 280
120 387
123 808
125 2702
132 1765
139 152
139 233
143 652
146 361
146 799
147 373
14...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

score: 5
Accepted
time: 339ms = 187ms + 152ms

input:

3
1750

output:

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

input:

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

output:

4
4982 2491
17 1062
33 1207
33 1253
40 645
41 1161
46 50
50 66
50 93
50 138
50 194
50 258
50 264
50 426
50 1794
50 3048
50 3683
50 4136
50 4951
51 3652
66 1392
85 1109
90 2086
90 3352
95 254
99 282
99 4908
105 1319
106 3578
117 3739
123 130
123 813
125 2049
130 555
130 1774
134 412
135 2119
139 233
...

input:

4
4982 2491
17 1062
33 1207
33 1253
40 645
41 1161
46 50
50 66
50 93
50 138
50 194
50 258
50 264
50 426
50 1794
50 3048
50 3683
50 4136
50 4951
51 3652
66 1392
85 1109
90 2086
90 3352
95 254
99 282
99 4908
105 1319
106 3578
117 3739
123 130
123 813
125 2049
130 555
130 1774
134 412
135 2119
139 233
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1750

Test #7:

score: 5
Accepted
time: 358ms = 181ms + 177ms

input:

5
4878

output:

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

input:

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

output:

6
4982 2502
1 3
1 4
1 6
1 10
1 15
1 59
1 1173
1 1599
2 17
5 7
5 12
5 21
5 23
5 78
5 95
5 251
5 321
5 347
5 1322
5 1836
8 326
8 481
8 1843
8 2270
9 30
9 35
9 52
9 60
9 150
9 273
9 330
9 2738
9 3763
9 4313
11 18
11 212
11 1362
11 2040
11 2542
13 44
13 87
13 90
13 105
13 240
13 1370
14 16
14 179
14 361...

input:

6
4982 2502
1 3
1 4
1 6
1 10
1 15
1 59
1 1173
1 1599
2 17
5 7
5 12
5 21
5 23
5 78
5 95
5 251
5 321
5 347
5 1322
5 1836
8 326
8 481
8 1843
8 2270
9 30
9 35
9 52
9 60
9 150
9 273
9 330
9 2738
9 3763
9 4313
11 18
11 212
11 1362
11 2040
11 2542
13 44
13 87
13 90
13 105
13 240
13 1370
14 16
14 179
14 361...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4878

Test #8:

score: 5
Accepted
time: 347ms = 187ms + 160ms

input:

5
1223

output:

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

input:

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

output:

6
4982 2508
1 2
1 3
1 4
1 10
1 15
1 59
1 110
1 1173
1 1599
5 7
5 12
5 21
5 23
5 78
5 95
5 236
5 324
5 347
5 1322
5 1836
6 9
8 491
8 1843
8 1896
9 30
9 35
9 60
9 150
9 330
9 826
9 1522
9 2756
9 4339
11 18
11 140
11 219
11 266
11 438
11 2572
11 2705
13 44
13 87
13 90
13 105
13 3701
14 16
14 179
14 221...

input:

6
4982 2508
1 2
1 3
1 4
1 10
1 15
1 59
1 110
1 1173
1 1599
5 7
5 12
5 21
5 23
5 78
5 95
5 236
5 324
5 347
5 1322
5 1836
6 9
8 491
8 1843
8 1896
9 30
9 35
9 60
9 150
9 330
9 826
9 1522
9 2756
9 4339
11 18
11 140
11 219
11 266
11 438
11 2572
11 2705
13 44
13 87
13 90
13 105
13 3701
14 16
14 179
14 221...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1223

Test #9:

score: 5
Accepted
time: 325ms = 155ms + 170ms

input:

5
648

output:

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

input:

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

output:

6
4982 2510
1 2
1 4
1 6
1 10
1 15
1 59
1 126
1 1061
1 1173
1 1599
3 5
5 7
5 12
5 21
5 23
5 78
5 251
5 315
5 1322
8 366
8 491
9 30
9 35
9 52
9 60
9 149
9 273
9 327
9 2738
11 18
11 134
11 212
11 438
11 1362
11 2046
11 2542
11 4444
13 44
13 87
13 90
13 105
13 240
13 1370
13 1799
13 3644
14 16
14 179
14...

input:

6
4982 2510
1 2
1 4
1 6
1 10
1 15
1 59
1 126
1 1061
1 1173
1 1599
3 5
5 7
5 12
5 21
5 23
5 78
5 251
5 315
5 1322
8 366
8 491
9 30
9 35
9 52
9 60
9 149
9 273
9 327
9 2738
11 18
11 134
11 212
11 438
11 1362
11 2046
11 2542
11 4444
13 44
13 87
13 90
13 105
13 240
13 1370
13 1799
13 3644
14 16
14 179
14...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
648

Test #10:

score: 5
Accepted
time: 359ms = 167ms + 192ms

input:

7
4475

output:

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

input:

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

output:

8
4982 2491
8 388
8 509
19 4680
29 1404
35 1990
41 1151
47 349
65 2922
66 1382
66 3416
79 1924
87 1754
98 1926
100 1541
100 4981
103 3686
113 1260
114 717
116 1160
119 3713
120 3727
121 1851
130 555
130 1768
132 1760
132 2759
132 4767
136 3851
140 1296
141 2829
142 1423
142 3914
150 2226
151 2280
15...

input:

8
4982 2491
8 388
8 509
19 4680
29 1404
35 1990
41 1151
47 349
65 2922
66 1382
66 3416
79 1924
87 1754
98 1926
100 1541
100 4981
103 3686
113 1260
114 717
116 1160
119 3713
120 3727
121 1851
130 555
130 1768
132 1760
132 2759
132 4767
136 3851
140 1296
141 2829
142 1423
142 3914
150 2226
151 2280
15...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4475

Test #11:

score: 5
Accepted
time: 359ms = 183ms + 176ms

input:

7
4240

output:

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

input:

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

output:

8
4982 2491
8 491
15 4141
40 4710
66 1330
66 1389
77 300
79 975
79 1924
86 917
86 2016
99 1555
101 423
101 1695
106 125
110 1070
110 1592
114 717
114 1557
117 427
117 3610
119 4904
120 3379
121 3327
123 587
123 3153
124 441
124 2113
129 494
131 4945
132 2734
133 3005
136 3766
137 1320
137 4124
138 2...

input:

8
4982 2491
8 491
15 4141
40 4710
66 1330
66 1389
77 300
79 975
79 1924
86 917
86 2016
99 1555
101 423
101 1695
106 125
110 1070
110 1592
114 717
114 1557
117 427
117 3610
119 4904
120 3379
121 3327
123 587
123 3153
124 441
124 2113
129 494
131 4945
132 2734
133 3005
136 3766
137 1320
137 4124
138 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4240

Test #12:

score: 5
Accepted
time: 341ms = 165ms + 176ms

input:

7
1291

output:

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

input:

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

output:

8
4982 2491
4 2917
8 509
29 1401
47 595
49 2297
55 678
65 4389
66 1379
85 785
85 1357
86 1247
95 1860
98 1926
100 1541
100 4902
101 1695
103 1875
110 4296
113 1251
117 440
119 3612
120 3629
124 2113
125 4330
130 555
130 3015
132 1758
135 185
135 2104
136 3504
137 383
139 921
141 1474
141 2459
142 38...

input:

8
4982 2491
4 2917
8 509
29 1401
47 595
49 2297
55 678
65 4389
66 1379
85 785
85 1357
86 1247
95 1860
98 1926
100 1541
100 4902
101 1695
103 1875
110 4296
113 1251
117 440
119 3612
120 3629
124 2113
125 4330
130 555
130 3015
132 1758
135 185
135 2104
136 3504
137 383
139 921
141 1474
141 2459
142 38...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1291

Subtask #2:

score: 30
Accepted

Test #13:

score: 30
Accepted
time: 350ms = 170ms + 180ms

input:

1
17476204

output:

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

input:

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

output:

2
4982 2710
1 3
1 4
1 44
1 56
1 64
1 1081
1 1508
2 18
2 32
2 92
2 158
2 351
2 1315
3 11
3 96
3 218
3 2226
4 127
4 3000
5 1847
6 9
6 58
6 215
6 245
6 642
6 2943
7 17
7 29
7 1053
7 4141
7 4142
8 346
8 1907
9 19
9 65
9 291
9 2812
9 4428
10 42
10 53
10 161
10 373
10 576
10 3301
11 24
11 150
11 238
11 13...

input:

2
4982 2710
1 3
1 4
1 44
1 56
1 64
1 1081
1 1508
2 18
2 32
2 92
2 158
2 351
2 1315
3 11
3 96
3 218
3 2226
4 127
4 3000
5 1847
6 9
6 58
6 215
6 245
6 642
6 2943
7 17
7 29
7 1053
7 4141
7 4142
8 346
8 1907
9 19
9 65
9 291
9 2812
9 4428
10 42
10 53
10 161
10 373
10 576
10 3301
11 24
11 150
11 238
11 13...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

score: 30
Accepted
time: 355ms = 178ms + 177ms

input:

1
11926600

output:

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

input:

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

output:

2
4982 2712
1 2
1 3
1 6
1 10
1 15
1 60
1 1102
2 13
2 17
2 27
2 135
2 157
3 5
3 11
3 24
3 26
3 277
3 633
3 2261
3 2565
4 407
5 7
5 21
5 23
5 109
5 252
5 1348
6 9
6 53
6 160
6 208
6 663
6 2474
6 2985
7 19
7 28
7 1068
7 4147
7 4148
8 409
8 2329
9 30
9 52
9 895
9 2861
10 25
10 39
10 47
10 122
10 2113
10...

input:

2
4982 2712
1 2
1 3
1 6
1 10
1 15
1 60
1 1102
2 13
2 17
2 27
2 135
2 157
3 5
3 11
3 24
3 26
3 277
3 633
3 2261
3 2565
4 407
5 7
5 21
5 23
5 109
5 252
5 1348
6 9
6 53
6 160
6 208
6 663
6 2474
6 2985
7 19
7 28
7 1068
7 4147
7 4148
8 409
8 2329
9 30
9 52
9 895
9 2861
10 25
10 39
10 47
10 122
10 2113
10...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 335ms = 155ms + 180ms

input:

1
16602378

output:

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

input:

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

output:

2
4982 2712
1 2
1 3
1 10
1 15
1 60
1 130
1 1530
2 13
2 17
2 27
2 37
2 157
3 5
3 11
3 24
3 26
3 277
3 633
3 2520
4 407
4 1792
5 6
5 7
5 21
5 23
5 109
5 252
6 9
6 53
6 160
6 208
6 663
7 28
7 134
8 409
8 1906
9 30
9 52
9 895
9 4424
10 25
10 47
10 120
11 18
11 39
11 229
11 487
11 2773
11 4618
12 22
12 1...

input:

2
4982 2712
1 2
1 3
1 10
1 15
1 60
1 130
1 1530
2 13
2 17
2 27
2 37
2 157
3 5
3 11
3 24
3 26
3 277
3 633
3 2520
4 407
4 1792
5 6
5 7
5 21
5 23
5 109
5 252
6 9
6 53
6 160
6 208
6 663
7 28
7 134
8 409
8 1906
9 30
9 52
9 895
9 4424
10 25
10 47
10 120
11 18
11 39
11 229
11 487
11 2773
11 4618
12 22
12 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 357ms = 167ms + 190ms

input:

3
13129243

output:

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

input:

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

output:

4
4982 2491
1 3
3 5
3 11
3 24
3 26
3 89
3 200
3 265
3 608
3 1122
3 2232
3 2511
4 3000
17 1063
64 4274
64 4498
66 1389
66 3473
78 545
87 601
87 1283
93 710
100 1450
103 1896
105 1328
116 831
130 555
130 2472
132 2791
132 4809
142 1435
148 277
152 852
154 158
156 850
156 899
158 840
158 981
161 275
16...

input:

4
4982 2491
1 3
3 5
3 11
3 24
3 26
3 89
3 200
3 265
3 608
3 1122
3 2232
3 2511
4 3000
17 1063
64 4274
64 4498
66 1389
66 3473
78 545
87 601
87 1283
93 710
100 1450
103 1896
105 1328
116 831
130 555
130 2472
132 2791
132 4809
142 1435
148 277
152 852
154 158
156 850
156 899
158 840
158 981
161 275
16...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

score: 30
Accepted
time: 354ms = 163ms + 191ms

input:

3
7892141

output:

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

input:

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

output:

4
4982 2491
1 2
1 3
1 4
1 8
1 10
1 15
1 44
1 56
1 64
1 131
1 177
1 375
1 1148
1 1269
1 1771
19 4881
29 3290
42 1403
56 2235
79 106
81 2850
86 1348
86 2352
90 2206
95 2063
97 1683
101 282
101 446
103 2072
105 1434
105 1592
106 155
106 3820
112 482
113 1354
116 1255
116 1321
117 434
117 489
120 432
12...

input:

4
4982 2491
1 2
1 3
1 4
1 8
1 10
1 15
1 44
1 56
1 64
1 131
1 177
1 375
1 1148
1 1269
1 1771
19 4881
29 3290
42 1403
56 2235
79 106
81 2850
86 1348
86 2352
90 2206
95 2063
97 1683
101 282
101 446
103 2072
105 1434
105 1592
106 155
106 3820
112 482
113 1354
116 1255
116 1321
117 434
117 489
120 432
12...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

score: 30
Accepted
time: 346ms = 167ms + 179ms

input:

3
21314775

output:

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

input:

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

output:

4
4982 2491
1 2
1 3
1 4
1 6
1 10
1 15
1 21
1 35
1 60
1 131
1 183
1 1102
1 1207
17 3416
19 4878
22 56
22 2114
40 202
42 784
56 2180
60 203
79 106
86 1159
86 1285
87 630
87 1047
90 4108
95 1989
100 1508
103 2010
103 3908
105 302
105 1517
113 1291
117 3915
119 3592
119 3932
120 282
120 2373
125 2123
12...

input:

4
4982 2491
1 2
1 3
1 4
1 6
1 10
1 15
1 21
1 35
1 60
1 131
1 183
1 1102
1 1207
17 3416
19 4878
22 56
22 2114
40 202
42 784
56 2180
60 203
79 106
86 1159
86 1285
87 630
87 1047
90 4108
95 1989
100 1508
103 2010
103 3908
105 302
105 1517
113 1291
117 3915
119 3592
119 3932
120 282
120 2373
125 2123
12...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

score: 30
Accepted
time: 357ms = 185ms + 172ms

input:

5
5559540

output:

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

input:

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

output:

6
4982 2519
1 6
2 13
2 17
2 27
2 31
2 68
2 114
2 150
2 355
2 1335
2 3560
3 5
3 11
3 24
3 26
3 89
3 2255
3 2552
4 8
4 116
4 277
4 412
4 537
4 1779
6 14
6 53
6 88
6 153
6 204
6 231
6 483
6 663
6 1352
7 19
7 28
7 118
7 1067
7 1134
7 3034
7 4147
7 4148
9 30
10 25
10 47
10 104
10 443
10 2113
12 22
12 103...

input:

6
4982 2519
1 6
2 13
2 17
2 27
2 31
2 68
2 114
2 150
2 355
2 1335
2 3560
3 5
3 11
3 24
3 26
3 89
3 2255
3 2552
4 8
4 116
4 277
4 412
4 537
4 1779
6 14
6 53
6 88
6 153
6 204
6 231
6 483
6 663
6 1352
7 19
7 28
7 118
7 1067
7 1134
7 3034
7 4147
7 4148
9 30
10 25
10 47
10 104
10 443
10 2113
12 22
12 103...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

score: 30
Accepted
time: 343ms = 163ms + 180ms

input:

5
9424319

output:

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

input:

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

output:

6
4982 2527
1 2
1 3
1 4
1 8
1 10
1 44
1 56
1 64
1 196
1 381
1 1269
1 1648
5 6
5 7
5 12
5 21
5 23
5 125
5 238
5 371
5 404
9 30
9 36
9 65
9 186
9 319
9 895
9 934
9 3039
9 4181
9 4656
11 18
11 41
11 167
11 304
11 2811
11 4838
13 48
13 115
13 137
13 724
13 4138
14 16
14 742
14 1210
15 20
17 88
17 1126
1...

input:

6
4982 2527
1 2
1 3
1 4
1 8
1 10
1 44
1 56
1 64
1 196
1 381
1 1269
1 1648
5 6
5 7
5 12
5 21
5 23
5 125
5 238
5 371
5 404
9 30
9 36
9 65
9 186
9 319
9 895
9 934
9 3039
9 4181
9 4656
11 18
11 41
11 167
11 304
11 2811
11 4838
13 48
13 115
13 137
13 724
13 4138
14 16
14 742
14 1210
15 20
17 88
17 1126
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

score: 30
Accepted
time: 335ms = 171ms + 164ms

input:

5
10955780

output:

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

input:

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

output:

6
4982 2493
1 2
1 3
1 4
1 10
1 15
1 60
1 130
1 1080
1 1187
5 7
5 12
5 21
5 23
5 80
5 109
5 357
5 1353
6 9
8 338
8 393
8 1956
8 2329
9 35
9 52
9 61
9 291
9 831
9 864
9 2839
9 3957
9 4425
11 18
11 458
11 1398
11 2088
11 4610
13 44
13 87
13 100
13 123
13 395
13 1414
13 1659
13 1867
13 3877
14 16
14 229...

input:

6
4982 2493
1 2
1 3
1 4
1 10
1 15
1 60
1 130
1 1080
1 1187
5 7
5 12
5 21
5 23
5 80
5 109
5 357
5 1353
6 9
8 338
8 393
8 1956
8 2329
9 35
9 52
9 61
9 291
9 831
9 864
9 2839
9 3957
9 4425
11 18
11 458
11 1398
11 2088
11 4610
13 44
13 87
13 100
13 123
13 395
13 1414
13 1659
13 1867
13 3877
14 16
14 229...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
10955780

Test #22:

score: 30
Accepted
time: 362ms = 178ms + 184ms

input:

7
19938721

output:

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

input:

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

output:

8
4982 2491
33 3972
44 2048
53 85
53 1547
56 199
58 983
60 4772
66 3561
71 330
75 3483
77 3006
79 1045
85 1406
86 1311
90 3502
90 4106
91 141
91 4890
94 202
94 1397
98 1095
103 3889
105 302
106 3740
110 1336
110 4506
116 420
117 3891
119 3905
123 871
124 1242
124 4697
125 2117
125 2901
126 557
126 3...

input:

8
4982 2491
33 3972
44 2048
53 85
53 1547
56 199
58 983
60 4772
66 3561
71 330
75 3483
77 3006
79 1045
85 1406
86 1311
90 3502
90 4106
91 141
91 4890
94 202
94 1397
98 1095
103 3889
105 302
106 3740
110 1336
110 4506
116 420
117 3891
119 3905
123 871
124 1242
124 4697
125 2117
125 2901
126 557
126 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
19938721

Test #23:

score: 30
Accepted
time: 357ms = 181ms + 176ms

input:

7
5129508

output:

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

input:

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

output:

8
4982 2491
8 484
14 656
15 4162
21 2694
21 3540
29 3015
42 1287
53 735
55 3359
56 2114
67 275
71 1409
78 1429
79 106
90 2943
99 179
103 234
103 3622
105 299
107 3262
107 3638
108 3037
115 664
115 974
117 3630
118 1073
119 3645
120 282
124 915
125 4353
130 1774
130 2472
134 377
135 523
135 2119
137 ...

input:

8
4982 2491
8 484
14 656
15 4162
21 2694
21 3540
29 3015
42 1287
53 735
55 3359
56 2114
67 275
71 1409
78 1429
79 106
90 2943
99 179
103 234
103 3622
105 299
107 3262
107 3638
108 3037
115 664
115 974
117 3630
118 1073
119 3645
120 282
124 915
125 4353
130 1774
130 2472
134 377
135 523
135 2119
137 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5129508

Test #24:

score: 30
Accepted
time: 350ms = 158ms + 192ms

input:

7
15332941

output:

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

input:

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

output:

8
4982 2491
16 1313
33 2811
51 3956
53 296
56 2216
60 4839
65 4682
66 1389
66 3692
67 826
71 1975
82 915
85 1425
85 1431
86 2143
86 2352
91 4965
94 4458
95 2046
97 3285
101 446
103 2061
107 3582
113 1315
114 781
116 1222
117 4044
119 3698
119 4061
120 3766
121 2145
124 4769
125 415
130 2604
133 1329...

input:

8
4982 2491
16 1313
33 2811
51 3956
53 296
56 2216
60 4839
65 4682
66 1389
66 3692
67 826
71 1975
82 915
85 1425
85 1431
86 2143
86 2352
91 4965
94 4458
95 2046
97 3285
101 446
103 2061
107 3582
113 1315
114 781
116 1222
117 4044
119 3698
119 4061
120 3766
121 2145
124 4769
125 415
130 2604
133 1329...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
15332941

Subtask #3:

score: 65
Accepted

Test #25:

score: 65
Accepted
time: 372ms = 187ms + 185ms

input:

1
355365355024496523

output:

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

input:

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

output:

2
4982 3367
1 3
1 10
1 15
1 151
2 19
2 45
2 154
2 397
2 1729
3 11
3 29
3 347
3 2759
4 8
4 3979
5 7
5 31
5 267
5 431
5 1739
6 68
6 273
6 303
6 3059
6 3886
7 17
8 24
9 35
9 209
9 375
9 461
9 1144
10 32
10 46
10 57
10 59
10 199
10 496
10 744
10 4801
11 63
11 122
11 1809
11 2506
11 3326
11 3595
12 27
12...

input:

2
4982 3367
1 3
1 10
1 15
1 151
2 19
2 45
2 154
2 397
2 1729
3 11
3 29
3 347
3 2759
4 8
4 3979
5 7
5 31
5 267
5 431
5 1739
6 68
6 273
6 303
6 3059
6 3886
7 17
8 24
9 35
9 209
9 375
9 461
9 1144
10 32
10 46
10 57
10 59
10 199
10 496
10 744
10 4801
11 63
11 122
11 1809
11 2506
11 3326
11 3595
12 27
12...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
355365355024496523

Test #26:

score: 65
Accepted
time: 349ms = 168ms + 181ms

input:

1
727827999106414164

output:

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

input:

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

output:

2
4982 2686
1 3
1 4
1 6
1 10
1 16
1 21
1 53
1 375
1 1215
2 32
2 92
2 120
2 134
3 5
3 100
3 221
3 1268
3 2539
4 8
4 31
4 128
4 289
5 111
6 9
6 106
6 2794
7 14
7 26
7 1275
7 3514
8 372
8 456
8 2618
9 20
9 167
9 307
9 3277
10 17
10 39
10 47
10 126
10 492
10 630
10 4475
11 24
11 55
11 149
11 245
12 83
1...

input:

2
4982 2686
1 3
1 4
1 6
1 10
1 16
1 21
1 53
1 375
1 1215
2 32
2 92
2 120
2 134
3 5
3 100
3 221
3 1268
3 2539
4 8
4 31
4 128
4 289
5 111
6 9
6 106
6 2794
7 14
7 26
7 1275
7 3514
8 372
8 456
8 2618
9 20
9 167
9 307
9 3277
10 17
10 39
10 47
10 126
10 492
10 630
10 4475
11 24
11 55
11 149
11 245
12 83
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
727827999106414164

Test #27:

score: 65
Accepted
time: 351ms = 154ms + 197ms

input:

1
656410143989222955

output:

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

input:

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

output:

2
4982 2686
1 3
1 4
1 6
1 10
1 15
1 21
1 56
1 134
1 186
1 1213
1 1804
2 29
2 100
2 135
2 170
2 415
3 5
3 25
3 88
3 240
3 2567
3 2958
4 8
4 126
5 233
5 435
6 9
6 173
6 553
6 2843
7 17
7 77
7 1268
8 491
8 2177
9 20
9 418
9 1007
10 16
10 32
10 53
10 125
10 657
10 1375
11 24
11 1607
11 3267
12 83
13 14
...

input:

2
4982 2686
1 3
1 4
1 6
1 10
1 15
1 21
1 56
1 134
1 186
1 1213
1 1804
2 29
2 100
2 135
2 170
2 415
3 5
3 25
3 88
3 240
3 2567
3 2958
4 8
4 126
5 233
5 435
6 9
6 173
6 553
6 2843
7 17
7 77
7 1268
8 491
8 2177
9 20
9 418
9 1007
10 16
10 32
10 53
10 125
10 657
10 1375
11 24
11 1607
11 3267
12 83
13 14
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
656410143989222955

Test #28:

score: 65
Accepted
time: 366ms = 174ms + 192ms

input:

1
410366615149657534

output:

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

input:

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

output:

2
4982 3358
1 2
1 3
1 4
1 8
1 10
1 25
1 54
1 1301
1 1458
1 1972
2 21
2 47
2 85
2 1666
3 5
3 11
3 101
3 331
4 511
4 3942
5 6
5 7
5 31
6 9
6 69
6 114
6 273
6 295
6 570
6 817
6 3043
7 14
7 26
7 28
7 161
7 4901
8 33
8 418
8 513
8 2304
8 2828
9 45
9 1110
9 4732
10 34
10 38
10 51
10 60
10 61
10 461
10 462...

input:

2
4982 3358
1 2
1 3
1 4
1 8
1 10
1 25
1 54
1 1301
1 1458
1 1972
2 21
2 47
2 85
2 1666
3 5
3 11
3 101
3 331
4 511
4 3942
5 6
5 7
5 31
6 9
6 69
6 114
6 273
6 295
6 570
6 817
6 3043
7 14
7 26
7 28
7 161
7 4901
8 33
8 418
8 513
8 2304
8 2828
9 45
9 1110
9 4732
10 34
10 38
10 51
10 60
10 61
10 461
10 462...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
410366615149657534

Test #29:

score: 65
Accepted
time: 346ms = 162ms + 184ms

input:

1
298090682780948428

output:

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

input:

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

output:

2
4982 3358
1 2
1 3
1 4
1 6
1 10
1 35
1 63
1 89
1 132
1 173
1 1269
2 21
2 92
2 158
2 4137
3 5
3 11
3 25
3 96
3 669
4 8
4 31
4 564
5 7
5 111
5 386
6 9
6 101
6 208
6 2714
7 14
7 3468
7 4541
8 850
8 2121
8 2533
9 54
9 365
9 940
9 979
9 1750
9 4418
10 47
10 122
10 161
10 475
10 1290
11 52
11 149
11 1506...

input:

2
4982 3358
1 2
1 3
1 4
1 6
1 10
1 35
1 63
1 89
1 132
1 173
1 1269
2 21
2 92
2 158
2 4137
3 5
3 11
3 25
3 96
3 669
4 8
4 31
4 564
5 7
5 111
5 386
6 9
6 101
6 208
6 2714
7 14
7 3468
7 4541
8 850
8 2121
8 2533
9 54
9 365
9 940
9 979
9 1750
9 4418
10 47
10 122
10 161
10 475
10 1290
11 52
11 149
11 1506...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
298090682780948428

Test #30:

score: 65
Accepted
time: 370ms = 182ms + 188ms

input:

3
969441916331132577

output:

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

input:

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

output:

4
4982 2491
1 2
1 3
1 4
1 8
1 10
1 12
1 16
1 44
1 56
1 144
1 199
1 425
1 1336
1 1792
1 1951
8 416
8 491
26 1764
62 856
62 2334
65 1442
70 173
70 2225
90 2348
90 3547
95 304
95 2187
101 514
103 140
103 4330
105 1529
105 1727
106 118
106 4225
113 1441
116 1323
118 608
118 634
130 661
132 3239
134 460
...

input:

4
4982 2491
1 2
1 3
1 4
1 8
1 10
1 12
1 16
1 44
1 56
1 144
1 199
1 425
1 1336
1 1792
1 1951
8 416
8 491
26 1764
62 856
62 2334
65 1442
70 173
70 2225
90 2348
90 3547
95 304
95 2187
101 514
103 140
103 4330
105 1529
105 1727
106 118
106 4225
113 1441
116 1323
118 608
118 634
130 661
132 3239
134 460
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
969441916331132577

Test #31:

score: 65
Accepted
time: 348ms = 167ms + 181ms

input:

3
929489812741933634

output:

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

input:

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

output:

4
4982 2491
1 2
1 3
1 4
1 6
1 10
1 12
1 16
1 59
1 134
1 198
1 447
1 1333
1 1490
1 2010
41 961
60 146
69 3441
79 1253
87 256
87 2253
95 304
95 2326
103 2337
103 4592
105 363
105 1708
108 275
108 2434
113 1616
116 1473
116 1567
117 563
129 211
129 3490
131 152
131 1521
138 1169
140 1677
143 4529
146 4...

input:

4
4982 2491
1 2
1 3
1 4
1 6
1 10
1 12
1 16
1 59
1 134
1 198
1 447
1 1333
1 1490
1 2010
41 961
60 146
69 3441
79 1253
87 256
87 2253
95 304
95 2326
103 2337
103 4592
105 363
105 1708
108 275
108 2434
113 1616
116 1473
116 1567
117 563
129 211
129 3490
131 152
131 1521
138 1169
140 1677
143 4529
146 4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
929489812741933634

Test #32:

score: 65
Accepted
time: 338ms = 166ms + 172ms

input:

3
144032041325838295

output:

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

input:

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

output:

4
4982 2491
1 10
10 16
10 32
10 34
10 46
10 57
10 58
10 60
10 182
10 444
10 445
10 2510
10 4759
30 1895
41 1424
60 106
69 3455
70 2083
78 885
78 1313
79 1195
82 3315
82 3722
90 172
99 317
100 1887
103 140
103 4617
105 1902
106 119
113 129
113 1570
119 428
129 3511
134 453
134 883
137 543
139 276
139...

input:

4
4982 2491
1 10
10 16
10 32
10 34
10 46
10 57
10 58
10 60
10 182
10 444
10 445
10 2510
10 4759
30 1895
41 1424
60 106
69 3455
70 2083
78 885
78 1313
79 1195
82 3315
82 3722
90 172
99 317
100 1887
103 140
103 4617
105 1902
106 119
113 129
113 1570
119 428
129 3511
134 453
134 883
137 543
139 276
139...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
144032041325838295

Test #33:

score: 65
Accepted
time: 340ms = 163ms + 177ms

input:

3
832110946250826180

output:

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

input:

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

output:

4
4982 2491
1 2
1 3
1 4
1 8
1 16
1 26
1 40
1 55
1 128
1 171
1 234
1 492
1 1359
1 1515
19 312
60 181
61 2973
66 4373
67 367
79 155
83 4945
84 310
84 2054
93 2721
95 2335
105 1953
117 564
117 614
119 851
134 584
147 1836
147 3438
152 559
152 3759
153 1419
153 3727
154 940
154 3599
162 1071
165 1117
16...

input:

4
4982 2491
1 2
1 3
1 4
1 8
1 16
1 26
1 40
1 55
1 128
1 171
1 234
1 492
1 1359
1 1515
19 312
60 181
61 2973
66 4373
67 367
79 155
83 4945
84 310
84 2054
93 2721
95 2335
105 1953
117 564
117 614
119 851
134 584
147 1836
147 3438
152 559
152 3759
153 1419
153 3727
154 940
154 3599
162 1071
165 1117
16...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
832110946250826180

Test #34:

score: 65
Accepted
time: 339ms = 166ms + 173ms

input:

3
85728715707691821

output:

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

input:

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

output:

4
4982 2491
1 2
1 3
1 4
1 8
1 10
1 19
1 35
1 44
1 59
1 151
1 412
1 1234
1 1381
1 1859
26 1836
53 529
69 95
94 707
94 1649
95 2232
105 1805
113 1506
117 538
131 174
132 211
132 2155
136 294
143 497
150 833
152 486
152 513
159 2131
162 954
162 2115
165 1857
167 2175
174 3440
178 1992
178 4285
179 2142...

input:

4
4982 2491
1 2
1 3
1 4
1 8
1 10
1 19
1 35
1 44
1 59
1 151
1 412
1 1234
1 1381
1 1859
26 1836
53 529
69 95
94 707
94 1649
95 2232
105 1805
113 1506
117 538
131 174
132 211
132 2155
136 294
143 497
150 833
152 486
152 513
159 2131
162 954
162 2115
165 1857
167 2175
174 3440
178 1992
178 4285
179 2142...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
85728715707691821

Test #35:

score: 65
Accepted
time: 339ms = 155ms + 184ms

input:

5
777434612360931036

output:

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

input:

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

output:

6
4982 2514
1 8
2 45
2 75
2 111
2 201
2 399
2 447
2 1700
3 5
3 11
3 25
3 29
3 98
3 341
3 782
3 1364
3 3108
4 41
4 347
4 3807
6 9
6 114
6 123
6 204
6 586
6 818
6 1729
6 3736
7 14
7 80
7 101
7 163
7 4809
7 4810
8 22
8 522
8 2332
8 2796
10 17
10 32
10 34
10 46
10 57
10 58
10 60
10 149
10 482
10 483
10 ...

input:

6
4982 2514
1 8
2 45
2 75
2 111
2 201
2 399
2 447
2 1700
3 5
3 11
3 25
3 29
3 98
3 341
3 782
3 1364
3 3108
4 41
4 347
4 3807
6 9
6 114
6 123
6 204
6 586
6 818
6 1729
6 3736
7 14
7 80
7 101
7 163
7 4809
7 4810
8 22
8 522
8 2332
8 2796
10 17
10 32
10 34
10 46
10 57
10 58
10 60
10 149
10 482
10 483
10 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
777434612360931036

Test #36:

score: 65
Accepted
time: 370ms = 188ms + 182ms

input:

5
705262511549880222

output:

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

input:

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

output:

6
4982 2498
1 2
1 4
1 6
1 10
1 16
1 35
1 44
1 56
1 64
1 89
1 174
1 355
1 1221
1 1376
1 1831
1 2005
3 11
5 7
5 12
5 17
5 21
5 106
5 252
5 344
5 387
5 1581
8 15
8 348
8 878
8 2195
8 2228
9 39
9 65
9 292
9 363
9 1904
9 3334
9 4520
11 19
11 229
11 1647
11 3052
11 3278
13 48
13 124
13 261
13 440
13 1471
...

input:

6
4982 2498
1 2
1 4
1 6
1 10
1 16
1 35
1 44
1 56
1 64
1 89
1 174
1 355
1 1221
1 1376
1 1831
1 2005
3 11
5 7
5 12
5 17
5 21
5 106
5 252
5 344
5 387
5 1581
8 15
8 348
8 878
8 2195
8 2228
9 39
9 65
9 292
9 363
9 1904
9 3334
9 4520
11 19
11 229
11 1647
11 3052
11 3278
13 48
13 124
13 261
13 440
13 1471
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
705262511549880222

Test #37:

score: 65
Accepted
time: 337ms = 170ms + 167ms

input:

5
510318082834167951

output:

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

input:

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

output:

6
4982 2497
1 3
2 48
2 85
2 135
2 1650
2 4382
3 32
3 109
3 277
3 338
3 741
3 1344
3 2689
3 3114
4 10
4 43
4 345
4 492
4 610
4 3854
5 9
6 11
6 73
6 146
6 204
6 561
6 791
6 1671
6 2993
7 19
7 30
7 88
7 114
7 1351
7 4840
7 4841
8 422
8 495
8 950
8 2780
9 25
9 26
9 36
9 45
9 210
9 432
9 1081
9 4693
12 1...

input:

6
4982 2497
1 3
2 48
2 85
2 135
2 1650
2 4382
3 32
3 109
3 277
3 338
3 741
3 1344
3 2689
3 3114
4 10
4 43
4 345
4 492
4 610
4 3854
5 9
6 11
6 73
6 146
6 204
6 561
6 791
6 1671
6 2993
7 19
7 30
7 88
7 114
7 1351
7 4840
7 4841
8 422
8 495
8 950
8 2780
9 25
9 26
9 36
9 45
9 210
9 432
9 1081
9 4693
12 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
510318082834167951

Test #38:

score: 65
Accepted
time: 342ms = 162ms + 180ms

input:

5
914858813253258744

output:

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

input:

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

output:

6
4982 2533
1 2
1 4
1 8
1 10
1 15
1 39
1 53
1 101
1 151
1 202
1 1296
1 1482
1 2010
3 11
5 6
5 7
5 9
5 12
5 28
5 31
5 254
5 420
5 475
11 63
11 177
11 326
11 2484
11 3270
13 14
13 56
13 110
13 144
13 877
13 1803
13 4653
16 18
16 193
16 372
16 875
16 1455
16 1605
17 88
17 802
17 1279
19 408
20 46
20 62...

input:

6
4982 2533
1 2
1 4
1 8
1 10
1 15
1 39
1 53
1 101
1 151
1 202
1 1296
1 1482
1 2010
3 11
5 6
5 7
5 9
5 12
5 28
5 31
5 254
5 420
5 475
11 63
11 177
11 326
11 2484
11 3270
13 14
13 56
13 110
13 144
13 877
13 1803
13 4653
16 18
16 193
16 372
16 875
16 1455
16 1605
17 88
17 802
17 1279
19 408
20 46
20 62...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
914858813253258744

Test #39:

score: 65
Accepted
time: 352ms = 173ms + 179ms

input:

5
659635316746638238

output:

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

input:

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

output:

6
4982 2500
1 2
1 3
1 4
1 8
1 10
1 12
1 38
1 53
1 112
1 163
1 239
1 507
1 1413
1 2160
5 6
5 7
5 9
5 13
5 282
5 478
11 49
11 67
11 129
11 310
11 1989
11 2690
11 3630
11 3916
14 20
14 54
14 55
14 312
14 945
14 1020
14 1522
15 87
15 96
15 1191
16 29
17 80
17 94
17 1382
18 63
18 335
18 550
18 799
18 108...

input:

6
4982 2500
1 2
1 3
1 4
1 8
1 10
1 12
1 38
1 53
1 112
1 163
1 239
1 507
1 1413
1 2160
5 6
5 7
5 9
5 13
5 282
5 478
11 49
11 67
11 129
11 310
11 1989
11 2690
11 3630
11 3916
14 20
14 54
14 55
14 312
14 945
14 1020
14 1522
15 87
15 96
15 1191
16 29
17 80
17 94
17 1382
18 63
18 335
18 550
18 799
18 108...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659635316746638238

Test #40:

score: 65
Accepted
time: 347ms = 175ms + 172ms

input:

7
858490260563149759

output:

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

input:

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

output:

8
4982 2491
4 4458
22 2868
24 4381
24 4744
29 4588
46 2967
55 1102
55 4955
56 194
56 2997
57 2103
58 454
61 2635
61 3538
62 2918
62 4703
66 4951
92 1182
93 3168
97 862
101 636
103 2706
106 155
113 162
115 1384
115 3831
119 1001
120 296
120 3334
125 172
128 557
130 3729
132 2571
134 647
137 613
137 2...

input:

8
4982 2491
4 4458
22 2868
24 4381
24 4744
29 4588
46 2967
55 1102
55 4955
56 194
56 2997
57 2103
58 454
61 2635
61 3538
62 2918
62 4703
66 4951
92 1182
93 3168
97 862
101 636
103 2706
106 155
113 162
115 1384
115 3831
119 1001
120 296
120 3334
125 172
128 557
130 3729
132 2571
134 647
137 613
137 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
858490260563149759

Test #41:

score: 65
Accepted
time: 357ms = 174ms + 183ms

input:

7
860058643727731209

output:

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

input:

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

output:

8
4982 2491
24 2742
41 906
46 4187
62 1640
66 1791
67 1010
77 3740
90 2508
90 4779
94 1735
95 2306
100 532
100 1885
101 515
103 2321
103 4627
105 337
105 1677
106 124
113 1580
116 1082
119 441
119 770
120 4655
124 2573
130 3083
131 1484
131 3410
135 608
142 1495
146 455
148 4378
151 2811
152 3750
15...

input:

8
4982 2491
24 2742
41 906
46 4187
62 1640
66 1791
67 1010
77 3740
90 2508
90 4779
94 1735
95 2306
100 532
100 1885
101 515
103 2321
103 4627
105 337
105 1677
106 124
113 1580
116 1082
119 441
119 770
120 4655
124 2573
130 3083
131 1484
131 3410
135 608
142 1495
146 455
148 4378
151 2811
152 3750
15...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
860058643727731209

Test #42:

score: 65
Accepted
time: 342ms = 182ms + 160ms

input:

7
718861404514377808

output:

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

input:

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

output:

8
4982 2491
17 1194
17 3994
29 849
29 3729
35 113
37 624
37 2019
53 517
53 1812
67 931
78 1726
79 1137
81 2663
89 1835
89 2434
91 836
97 3701
100 1757
100 1920
103 4369
105 1567
106 4280
112 915
116 1029
116 1436
117 473
119 415
130 654
130 2873
130 3731
134 499
137 529
137 4749
139 161
139 256
139 ...

input:

8
4982 2491
17 1194
17 3994
29 849
29 3729
35 113
37 624
37 2019
53 517
53 1812
67 931
78 1726
79 1137
81 2663
89 1835
89 2434
91 836
97 3701
100 1757
100 1920
103 4369
105 1567
106 4280
112 915
116 1029
116 1436
117 473
119 415
130 654
130 2873
130 3731
134 499
137 529
137 4749
139 161
139 256
139 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
718861404514377808

Test #43:

score: 65
Accepted
time: 338ms = 182ms + 156ms

input:

7
659192688464047828

output:

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

input:

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

output:

8
4982 2491
4 619
4 3845
24 559
24 2719
24 4180
32 1001
33 1495
33 3352
47 2438
51 4192
56 2508
69 767
85 1707
86 1389
86 1553
86 2701
89 1934
90 4703
92 1032
94 1689
95 2269
97 691
99 2041
103 146
103 2285
105 1854
106 4465
113 1555
116 1437
119 787
129 3452
130 4041
134 528
136 4678
142 4726
143 4...

input:

8
4982 2491
4 619
4 3845
24 559
24 2719
24 4180
32 1001
33 1495
33 3352
47 2438
51 4192
56 2508
69 767
85 1707
86 1389
86 1553
86 2701
89 1934
90 4703
92 1032
94 1689
95 2269
97 691
99 2041
103 146
103 2285
105 1854
106 4465
113 1555
116 1437
119 787
129 3452
130 4041
134 528
136 4678
142 4726
143 4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659192688464047828

Test #44:

score: 65
Accepted
time: 335ms = 163ms + 172ms

input:

7
685730986714800201

output:

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

input:

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

output:

8
4982 2491
17 722
17 3825
22 2263
37 849
37 1932
41 1320
42 3620
47 694
47 2300
51 168
51 3817
53 1729
65 3411
67 306
69 707
77 79
79 1129
85 1585
86 1427
86 2264
90 3479
92 924
92 4089
95 2152
100 1227
105 1521
106 4176
114 152
117 118
119 429
124 1354
130 2792
130 3581
136 212
136 347
140 4774
14...

input:

8
4982 2491
17 722
17 3825
22 2263
37 849
37 1932
41 1320
42 3620
47 694
47 2300
51 168
51 3817
53 1729
65 3411
67 306
69 707
77 79
79 1129
85 1585
86 1427
86 2264
90 3479
92 924
92 4089
95 2152
100 1227
105 1521
106 4176
114 152
117 118
119 429
124 1354
130 2792
130 3581
136 212
136 347
140 4774
14...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
685730986714800201