QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#422421#8726. Magic Showjames1BadCreeper100 ✓383ms0kbC++171.6kb2024-05-27 14:10:052024-05-27 14:10:06

Judging History

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

  • [2024-05-27 14:10:06]
  • 评测
  • 测评结果:100
  • 用时:383ms
  • 内存:0kb
  • [2024-05-27 14:10:05]
  • 提交

Alice

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

namespace A1 {
mt19937 Rand(923235); 
inline int rnd(int l, int r) { return uniform_int_distribution<int>(l, r)(Rand); }
int G[5005][5005]; 
int vis[5005], n, b[5005]; 

vector<pair<int, int>> ans; 
int fa[5005]; 
int find(int x) { return fa[x] == x ? x : fa[x] = find(fa[x]); }

void work(void) {
    n = 5000; 
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j < i; ++j)
            G[i][j] = G[j][i] = rnd(0, 60); 
    for (int i = 1; i <= n; ++i) fa[i] = i; 
    i64 x = setN(n); 
    for (int i = 0; i <= 60; ++i) b[i] = (x >> i & 1); 
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j < i; ++j)
            if (find(i) != find(j) && b[G[i][j]] == 1) ans.emplace_back(i, j), b[G[i][j]] = 2, fa[find(i)] = find(j); 
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j < i; ++j)
            if (find(i) != find(j) && b[G[i][j]] == 2) ans.emplace_back(i, j), fa[find(i)] = find(j); 
}
}

vector<pair<int, int>> Alice(void) {
	// add your code here
    A1::work(); 
	// change below into your code

    return A1::ans; 
}

Bob

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

mt19937 Rand(923235); 
inline int rnd(int l, int r) { return uniform_int_distribution<int>(l, r)(Rand); }
int G[5005][5005]; 

i64 Bob(vector<pair<int, int>> V) {
    int n = 5000; 
    for (int i = 1; i <= n; ++i)
        for (int j = 1; j < i; ++j)
            G[i][j] = G[j][i] = rnd(0, 60); 
    i64 ans = 0; 
    for (auto it : V) ans |= 1ll << G[it.first][it.second]; 
    return ans; 
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 289ms = 153ms + 136ms

input:

1
4005

output:

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

input:

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

output:

2
5000 3256
1 8
1 15
1 22
1 29
1 38
1 42
1 44
1 48
1 55
1 73
1 80
1 118
1 129
1 134
1 139
1 171
1 178
1 184
1 189
1 218
1 225
1 242
1 250
1 255
1 266
1 287
1 296
1 302
1 313
1 355
1 356
1 359
1 385
1 411
1 416
1 420
1 439
1 455
1 457
1 471
1 478
1 488
1 499
1 512
1 516
1 541
1 548
1 559
1 573
1 577
...

input:

2
5000 3256
1 8
1 15
1 22
1 29
1 38
1 42
1 44
1 48
1 55
1 73
1 80
1 118
1 129
1 134
1 139
1 171
1 178
1 184
1 189
1 218
1 225
1 242
1 250
1 255
1 266
1 287
1 296
1 302
1 313
1 355
1 356
1 359
1 385
1 411
1 416
1 420
1 439
1 455
1 457
1 471
1 478
1 488
1 499
1 512
1 516
1 541
1 548
1 559
1 573
1 577
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

score: 5
Accepted
time: 325ms = 172ms + 153ms

input:

1
459

output:

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

input:

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

output:

2
5000 3256
1 5
1 11
1 15
1 22
1 48
1 55
1 76
1 98
1 134
1 139
1 177
1 178
1 188
1 189
1 206
1 218
1 222
1 248
1 253
1 287
1 302
1 312
1 313
1 355
1 364
1 392
1 394
1 416
1 426
1 455
1 459
1 465
1 471
1 478
1 482
1 494
1 512
1 516
1 521
1 559
1 571
1 573
1 618
1 676
1 686
1 688
1 714
1 729
1 735
1 7...

input:

2
5000 3256
1 5
1 11
1 15
1 22
1 48
1 55
1 76
1 98
1 134
1 139
1 177
1 178
1 188
1 189
1 206
1 218
1 222
1 248
1 253
1 287
1 302
1 312
1 313
1 355
1 364
1 392
1 394
1 416
1 426
1 455
1 459
1 465
1 471
1 478
1 482
1 494
1 512
1 516
1 521
1 559
1 571
1 573
1 618
1 676
1 686
1 688
1 714
1 729
1 735
1 7...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

score: 5
Accepted
time: 320ms = 179ms + 141ms

input:

1
2495

output:

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

input:

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

output:

2
5000 3256
1 5
1 15
1 19
1 48
1 55
1 80
1 98
1 118
1 134
1 139
1 151
1 177
1 178
1 184
1 188
1 189
1 204
1 206
1 218
1 222
1 225
1 242
1 253
1 255
1 266
1 287
1 296
1 302
1 312
1 313
1 345
1 355
1 359
1 364
1 385
1 392
1 394
1 411
1 416
1 455
1 456
1 457
1 471
1 478
1 488
1 494
1 499
1 512
1 516
1 ...

input:

2
5000 3256
1 5
1 15
1 19
1 48
1 55
1 80
1 98
1 118
1 134
1 139
1 151
1 177
1 178
1 184
1 188
1 189
1 204
1 206
1 218
1 222
1 225
1 242
1 253
1 255
1 266
1 287
1 296
1 302
1 312
1 313
1 345
1 355
1 359
1 364
1 385
1 392
1 394
1 411
1 416
1 455
1 456
1 457
1 471
1 478
1 488
1 494
1 499
1 512
1 516
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

score: 5
Accepted
time: 351ms = 193ms + 158ms

input:

3
1560

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
4 3
13 7
14 9
14 11
17 5
18 14
21 8
21 15
22 11
22 21
23 14
25 2
25 8
26 15
28 8
28 13
29 5
29 8
30 3
30 21
31 7
32 14
34 6
34 23
35 16
35 34
36 5
36 19
36 20
37 4
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
4 3
13 7
14 9
14 11
17 5
18 14
21 8
21 15
22 11
22 21
23 14
25 2
25 8
26 15
28 8
28 13
29 5
29 8
30 3
30 21
31 7
32 14
34 6
34 23
35 16
35 34
36 5
36 19
36 20
37 4
...

output:

4
5000 2500
1 38
1 42
1 46
1 73
1 127
1 129
1 151
1 156
1 171
1 177
1 188
1 204
1 205
1 206
1 222
1 250
1 315
1 324
1 345
1 356
1 364
1 366
1 378
1 379
1 394
1 412
1 420
1 439
1 456
1 494
1 515
1 521
1 531
1 555
1 577
1 589
1 645
1 661
1 663
1 688
1 693
1 711
1 734
1 735
1 737
1 768
1 775
1 777
1 81...

input:

4
5000 2500
1 38
1 42
1 46
1 73
1 127
1 129
1 151
1 156
1 171
1 177
1 188
1 204
1 205
1 206
1 222
1 250
1 315
1 324
1 345
1 356
1 364
1 366
1 378
1 379
1 394
1 412
1 420
1 439
1 456
1 494
1 515
1 521
1 531
1 555
1 577
1 589
1 645
1 661
1 663
1 688
1 693
1 711
1 734
1 735
1 737
1 768
1 775
1 777
1 81...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

score: 5
Accepted
time: 299ms = 149ms + 150ms

input:

3
3594

output:

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

input:

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

output:

4
5000 2500
1 8
1 19
1 38
1 42
1 46
1 73
1 78
1 91
1 92
1 98
1 118
1 127
1 129
1 156
1 171
1 177
1 188
1 206
1 222
1 250
1 253
1 278
1 282
1 296
1 312
1 315
1 324
1 356
1 359
1 364
1 366
1 378
1 379
1 392
1 394
1 412
1 420
1 439
1 457
1 468
1 494
1 499
1 506
1 521
1 541
1 543
1 577
1 578
1 589
1 663...

input:

4
5000 2500
1 8
1 19
1 38
1 42
1 46
1 73
1 78
1 91
1 92
1 98
1 118
1 127
1 129
1 156
1 171
1 177
1 188
1 206
1 222
1 250
1 253
1 278
1 282
1 296
1 312
1 315
1 324
1 356
1 359
1 364
1 366
1 378
1 379
1 392
1 394
1 412
1 420
1 439
1 457
1 468
1 494
1 499
1 506
1 521
1 541
1 543
1 577
1 578
1 589
1 663...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

score: 5
Accepted
time: 320ms = 174ms + 146ms

input:

3
1750

output:

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

input:

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

output:

4
5000 2500
1 11
1 13
1 19
1 28
1 29
1 38
1 42
1 44
1 46
1 71
1 73
1 76
1 78
1 91
1 98
1 129
1 139
1 151
1 166
1 171
1 175
1 178
1 184
1 204
1 205
1 210
1 234
1 248
1 250
1 253
1 255
1 270
1 278
1 282
1 302
1 312
1 324
1 345
1 356
1 363
1 378
1 379
1 392
1 411
1 412
1 416
1 420
1 426
1 427
1 434
1 4...

input:

4
5000 2500
1 11
1 13
1 19
1 28
1 29
1 38
1 42
1 44
1 46
1 71
1 73
1 76
1 78
1 91
1 98
1 129
1 139
1 151
1 166
1 171
1 175
1 178
1 184
1 204
1 205
1 210
1 234
1 248
1 250
1 253
1 255
1 270
1 278
1 282
1 302
1 312
1 324
1 345
1 356
1 363
1 378
1 379
1 392
1 411
1 412
1 416
1 420
1 426
1 427
1 434
1 4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1750

Test #7:

score: 5
Accepted
time: 349ms = 197ms + 152ms

input:

5
4878

output:

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

input:

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

output:

6
5000 2612
1 19
2 21
2 25
2 47
2 96
2 107
2 109
2 110
2 113
2 194
2 211
2 213
2 220
2 223
2 225
2 235
2 252
2 262
2 274
2 288
2 305
2 345
2 347
2 349
2 350
2 373
2 385
2 402
2 406
2 415
2 419
2 425
2 427
2 430
2 432
2 434
2 445
2 460
2 470
2 473
2 499
2 515
2 522
2 528
2 533
2 544
2 551
2 555
2 562...

input:

6
5000 2612
1 19
2 21
2 25
2 47
2 96
2 107
2 109
2 110
2 113
2 194
2 211
2 213
2 220
2 223
2 225
2 235
2 252
2 262
2 274
2 288
2 305
2 345
2 347
2 349
2 350
2 373
2 385
2 402
2 406
2 415
2 419
2 425
2 427
2 430
2 432
2 434
2 445
2 460
2 470
2 473
2 499
2 515
2 522
2 528
2 533
2 544
2 551
2 555
2 562...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4878

Test #8:

score: 5
Accepted
time: 321ms = 185ms + 136ms

input:

5
1223

output:

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

input:

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

output:

6
5000 2620
1 11
1 13
1 15
1 19
1 27
1 28
1 29
1 38
1 42
1 44
1 46
1 55
1 71
1 73
1 76
1 78
1 91
1 98
1 135
1 139
1 166
1 175
1 178
1 184
1 210
1 218
1 234
1 248
1 253
1 255
1 270
1 278
1 282
1 287
1 302
1 312
1 355
1 363
1 379
1 392
1 411
1 412
1 416
1 420
1 426
1 427
1 434
1 439
1 452
1 459
1 465
...

input:

6
5000 2620
1 11
1 13
1 15
1 19
1 27
1 28
1 29
1 38
1 42
1 44
1 46
1 55
1 71
1 73
1 76
1 78
1 91
1 98
1 135
1 139
1 166
1 175
1 178
1 184
1 210
1 218
1 234
1 248
1 253
1 255
1 270
1 278
1 282
1 287
1 302
1 312
1 355
1 363
1 379
1 392
1 411
1 412
1 416
1 420
1 426
1 427
1 434
1 439
1 452
1 459
1 465
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1223

Test #9:

score: 5
Accepted
time: 294ms = 163ms + 131ms

input:

5
648

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
4 3
8 5
14 9
13 5
15 6
16 11
18 6
21 8
22 11
22 21
24 8
25 2
26 15
27 5
27 7
28 3
28 8
29 5
30 3
31 7
31 14
32 14
32 18
34 32
35 16
36 5
36 19
37 4
39 12
39 21
40 5...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
4 3
8 5
14 9
13 5
15 6
16 11
18 6
21 8
22 11
22 21
24 8
25 2
26 15
27 5
27 7
28 3
28 8
29 5
30 3
31 7
31 14
32 14
32 18
34 32
35 16
36 5
36 19
37 4
39 12
39 21
40 5...

output:

6
5000 2626
1 129
1 139
1 156
1 166
1 171
1 177
1 178
1 188
1 206
1 222
1 250
1 270
1 302
1 315
1 324
1 356
1 364
1 366
1 378
1 394
1 416
1 452
1 494
1 512
1 521
1 559
1 589
1 663
1 688
1 734
1 735
1 737
1 768
1 775
1 795
1 845
1 869
1 872
1 885
1 917
1 918
1 948
1 958
1 959
1 973
1 1007
1 1011
1 10...

input:

6
5000 2626
1 129
1 139
1 156
1 166
1 171
1 177
1 178
1 188
1 206
1 222
1 250
1 270
1 302
1 315
1 324
1 356
1 364
1 366
1 378
1 394
1 416
1 452
1 494
1 512
1 521
1 559
1 589
1 663
1 688
1 734
1 735
1 737
1 768
1 775
1 795
1 845
1 869
1 872
1 885
1 917
1 918
1 948
1 958
1 959
1 973
1 1007
1 1011
1 10...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
648

Test #10:

score: 5
Accepted
time: 330ms = 185ms + 145ms

input:

7
4475

output:

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

input:

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

output:

8
5000 2500
1 48
1 55
1 76
1 78
1 80
1 91
1 97
1 98
1 124
1 127
1 134
1 135
1 137
1 151
1 156
1 177
1 185
1 188
1 189
1 195
1 204
1 205
1 206
1 210
1 218
1 222
1 225
1 233
1 242
1 248
1 253
1 266
1 278
1 282
1 287
1 312
1 313
1 315
1 326
1 327
1 345
1 355
1 363
1 364
1 366
1 385
1 391
1 392
1 394
1 ...

input:

8
5000 2500
1 48
1 55
1 76
1 78
1 80
1 91
1 97
1 98
1 124
1 127
1 134
1 135
1 137
1 151
1 156
1 177
1 185
1 188
1 189
1 195
1 204
1 205
1 206
1 210
1 218
1 222
1 225
1 233
1 242
1 248
1 253
1 266
1 278
1 282
1 287
1 312
1 313
1 315
1 326
1 327
1 345
1 355
1 363
1 364
1 366
1 385
1 391
1 392
1 394
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4475

Test #11:

score: 5
Accepted
time: 300ms = 162ms + 138ms

input:

7
4240

output:

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

input:

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

output:

8
5000 2500
1 137
1 151
1 166
1 178
1 185
1 195
1 204
1 205
1 233
1 270
1 302
1 326
1 345
1 416
1 452
1 456
1 512
1 515
1 531
1 555
1 559
1 563
1 582
1 645
1 661
1 691
1 711
1 777
1 785
1 795
1 796
1 813
1 814
1 831
1 836
1 869
1 885
1 892
1 917
1 918
1 950
1 958
1 985
1 1024
1 1051
1 1064
1 1074
1 ...

input:

8
5000 2500
1 137
1 151
1 166
1 178
1 185
1 195
1 204
1 205
1 233
1 270
1 302
1 326
1 345
1 416
1 452
1 456
1 512
1 515
1 531
1 555
1 559
1 563
1 582
1 645
1 661
1 691
1 711
1 777
1 785
1 795
1 796
1 813
1 814
1 831
1 836
1 869
1 885
1 892
1 917
1 918
1 950
1 958
1 985
1 1024
1 1051
1 1064
1 1074
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4240

Test #12:

score: 5
Accepted
time: 309ms = 177ms + 132ms

input:

7
1291

output:

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

input:

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

output:

8
5000 2500
1 73
1 78
1 91
1 97
1 98
1 127
1 134
1 135
1 156
1 177
1 188
1 189
1 206
1 218
1 222
1 253
1 278
1 282
1 287
1 312
1 313
1 315
1 327
1 355
1 364
1 366
1 379
1 392
1 394
1 412
1 420
1 439
1 449
1 455
1 468
1 471
1 478
1 486
1 494
1 506
1 516
1 521
1 542
1 543
1 573
1 577
1 584
1 618
1 663...

input:

8
5000 2500
1 73
1 78
1 91
1 97
1 98
1 127
1 134
1 135
1 156
1 177
1 188
1 189
1 206
1 218
1 222
1 253
1 278
1 282
1 287
1 312
1 313
1 315
1 327
1 355
1 364
1 366
1 379
1 392
1 394
1 412
1 420
1 439
1 449
1 455
1 468
1 471
1 478
1 486
1 494
1 506
1 516
1 521
1 542
1 543
1 573
1 577
1 584
1 618
1 663...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1291

Subtask #2:

score: 30
Accepted

Test #13:

score: 30
Accepted
time: 334ms = 177ms + 157ms

input:

1
17476204

output:

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

input:

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

output:

2
5000 4703
1 4
1 7
1 8
1 11
1 13
1 16
1 20
1 28
1 29
1 30
1 31
1 35
1 44
1 60
1 71
1 76
1 77
1 92
1 93
1 118
1 127
1 129
1 131
1 140
1 156
1 171
1 173
1 175
1 177
1 180
1 184
1 188
1 198
1 206
1 209
1 210
1 222
1 225
1 234
1 243
1 248
1 250
1 251
1 255
1 260
1 263
1 264
1 266
1 267
1 295
1 296
1 30...

input:

2
5000 4703
1 4
1 7
1 8
1 11
1 13
1 16
1 20
1 28
1 29
1 30
1 31
1 35
1 44
1 60
1 71
1 76
1 77
1 92
1 93
1 118
1 127
1 129
1 131
1 140
1 156
1 171
1 173
1 175
1 177
1 180
1 184
1 188
1 198
1 206
1 209
1 210
1 222
1 225
1 234
1 243
1 248
1 250
1 251
1 255
1 260
1 263
1 264
1 266
1 267
1 295
1 296
1 30...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

score: 30
Accepted
time: 383ms = 198ms + 185ms

input:

1
11926600

output:

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

input:

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

output:

2
5000 4392
1 8
1 11
1 18
1 24
1 38
1 42
1 46
1 56
1 57
1 73
1 76
1 77
1 92
1 93
1 99
1 106
1 108
1 118
1 125
1 127
1 163
1 165
1 172
1 177
1 180
1 185
1 188
1 195
1 197
1 198
1 200
1 202
1 209
1 210
1 219
1 222
1 227
1 229
1 231
1 232
1 233
1 238
1 240
1 246
1 247
1 248
1 251
1 252
1 261
1 264
1 29...

input:

2
5000 4392
1 8
1 11
1 18
1 24
1 38
1 42
1 46
1 56
1 57
1 73
1 76
1 77
1 92
1 93
1 99
1 106
1 108
1 118
1 125
1 127
1 163
1 165
1 172
1 177
1 180
1 185
1 188
1 195
1 197
1 198
1 200
1 202
1 209
1 210
1 219
1 222
1 227
1 229
1 231
1 232
1 233
1 238
1 240
1 246
1 247
1 248
1 251
1 252
1 261
1 264
1 29...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 305ms = 180ms + 125ms

input:

1
16602378

output:

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

input:

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

output:

2
5000 4392
1 7
1 16
1 18
1 22
1 24
1 38
1 42
1 46
1 48
1 56
1 73
1 78
1 91
1 97
1 98
1 99
1 101
1 103
1 106
1 108
1 116
1 125
1 127
1 134
1 163
1 165
1 172
1 177
1 185
1 188
1 189
1 195
1 197
1 200
1 202
1 219
1 222
1 227
1 229
1 231
1 232
1 233
1 238
1 240
1 246
1 247
1 252
1 253
1 261
1 278
1 282...

input:

2
5000 4392
1 7
1 16
1 18
1 22
1 24
1 38
1 42
1 46
1 48
1 56
1 73
1 78
1 91
1 97
1 98
1 99
1 101
1 103
1 106
1 108
1 116
1 125
1 127
1 134
1 163
1 165
1 172
1 177
1 185
1 188
1 189
1 195
1 197
1 200
1 202
1 219
1 222
1 227
1 229
1 231
1 232
1 233
1 238
1 240
1 246
1 247
1 252
1 253
1 261
1 278
1 282...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 318ms = 170ms + 148ms

input:

3
13129243

output:

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

input:

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

output:

4
5000 2500
1 5
1 7
1 15
1 16
1 27
1 38
1 42
1 46
1 55
1 73
1 78
1 91
1 98
1 101
1 103
1 116
1 124
1 127
1 129
1 135
1 137
1 151
1 156
1 163
1 165
1 171
1 172
1 177
1 185
1 188
1 195
1 204
1 205
1 206
1 218
1 222
1 227
1 233
1 238
1 240
1 250
1 252
1 253
1 278
1 282
1 283
1 287
1 297
1 312
1 315
1 3...

input:

4
5000 2500
1 5
1 7
1 15
1 16
1 27
1 38
1 42
1 46
1 55
1 73
1 78
1 91
1 98
1 101
1 103
1 116
1 124
1 127
1 129
1 135
1 137
1 151
1 156
1 163
1 165
1 171
1 172
1 177
1 185
1 188
1 195
1 204
1 205
1 206
1 218
1 222
1 227
1 233
1 238
1 240
1 250
1 252
1 253
1 278
1 282
1 283
1 287
1 297
1 312
1 315
1 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

score: 30
Accepted
time: 331ms = 177ms + 154ms

input:

3
7892141

output:

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

input:

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

output:

4
5000 2500
1 5
1 7
1 8
1 16
1 18
1 27
1 35
1 38
1 42
1 44
1 46
1 55
1 56
1 71
1 73
1 80
1 92
1 101
1 103
1 108
1 116
1 118
1 125
1 127
1 135
1 139
1 156
1 166
1 175
1 177
1 178
1 184
1 188
1 198
1 200
1 206
1 209
1 215
1 218
1 219
1 222
1 225
1 232
1 234
1 242
1 246
1 247
1 251
1 255
1 264
1 266
1 ...

input:

4
5000 2500
1 5
1 7
1 8
1 16
1 18
1 27
1 35
1 38
1 42
1 44
1 46
1 55
1 56
1 71
1 73
1 80
1 92
1 101
1 103
1 108
1 116
1 118
1 125
1 127
1 135
1 139
1 156
1 166
1 175
1 177
1 178
1 184
1 188
1 198
1 200
1 206
1 209
1 215
1 218
1 219
1 222
1 225
1 232
1 234
1 242
1 246
1 247
1 251
1 255
1 264
1 266
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

score: 30
Accepted
time: 326ms = 172ms + 154ms

input:

3
21314775

output:

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

input:

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

output:

4
5000 2500
1 4
1 5
1 8
1 11
1 15
1 19
1 24
1 27
1 28
1 29
1 38
1 42
1 44
1 46
1 47
1 55
1 60
1 71
1 73
1 76
1 78
1 91
1 92
1 98
1 99
1 101
1 103
1 106
1 116
1 118
1 124
1 135
1 137
1 139
1 140
1 150
1 151
1 166
1 175
1 178
1 184
1 185
1 195
1 197
1 198
1 202
1 204
1 205
1 209
1 210
1 218
1 229
1 23...

input:

4
5000 2500
1 4
1 5
1 8
1 11
1 15
1 19
1 24
1 27
1 28
1 29
1 38
1 42
1 44
1 46
1 47
1 55
1 60
1 71
1 73
1 76
1 78
1 91
1 92
1 98
1 99
1 101
1 103
1 106
1 116
1 118
1 124
1 135
1 137
1 139
1 140
1 150
1 151
1 166
1 175
1 178
1 184
1 185
1 195
1 197
1 198
1 202
1 204
1 205
1 209
1 210
1 218
1 229
1 23...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

score: 30
Accepted
time: 319ms = 171ms + 148ms

input:

5
5559540

output:

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

input:

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

output:

6
5000 2893
1 11
1 18
1 24
1 28
1 35
1 38
1 42
1 44
1 46
1 57
1 71
1 73
1 76
1 77
1 80
1 93
1 101
1 103
1 116
1 124
1 125
1 137
1 139
1 151
1 166
1 175
1 178
1 180
1 184
1 185
1 195
1 200
1 202
1 204
1 205
1 210
1 225
1 229
1 233
1 234
1 242
1 248
1 255
1 261
1 266
1 270
1 281
1 283
1 297
1 302
1 30...

input:

6
5000 2893
1 11
1 18
1 24
1 28
1 35
1 38
1 42
1 44
1 46
1 57
1 71
1 73
1 76
1 77
1 80
1 93
1 101
1 103
1 116
1 124
1 125
1 137
1 139
1 151
1 166
1 175
1 178
1 180
1 184
1 185
1 195
1 200
1 202
1 204
1 205
1 210
1 225
1 229
1 233
1 234
1 242
1 248
1 255
1 261
1 266
1 270
1 281
1 283
1 297
1 302
1 30...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

score: 30
Accepted
time: 306ms = 175ms + 131ms

input:

5
9424319

output:

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

input:

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

output:

6
5000 2625
1 7
1 8
1 15
1 16
1 19
1 20
1 22
1 24
1 27
1 29
1 30
1 31
1 35
1 38
1 42
1 44
1 46
1 48
1 55
1 57
1 71
1 73
1 77
1 78
1 80
1 91
1 92
1 93
1 97
1 98
1 99
1 106
1 118
1 127
1 131
1 134
1 135
1 139
1 150
1 151
1 156
1 163
1 165
1 166
1 172
1 173
1 175
1 177
1 178
1 180
1 184
1 188
1 189
1 1...

input:

6
5000 2625
1 7
1 8
1 15
1 16
1 19
1 20
1 22
1 24
1 27
1 29
1 30
1 31
1 35
1 38
1 42
1 44
1 46
1 48
1 55
1 57
1 71
1 73
1 77
1 78
1 80
1 91
1 92
1 93
1 97
1 98
1 99
1 106
1 118
1 127
1 131
1 134
1 135
1 139
1 150
1 151
1 156
1 163
1 165
1 166
1 172
1 173
1 175
1 177
1 178
1 180
1 184
1 188
1 189
1 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

score: 30
Accepted
time: 304ms = 159ms + 145ms

input:

5
10955780

output:

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

input:

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

output:

6
5000 3192
1 13
1 20
1 24
1 29
1 30
1 31
1 38
1 42
1 44
1 46
1 56
1 71
1 73
1 92
1 99
1 106
1 108
1 118
1 131
1 150
1 163
1 165
1 172
1 173
1 175
1 184
1 197
1 198
1 202
1 209
1 215
1 219
1 227
1 229
1 231
1 232
1 234
1 238
1 240
1 243
1 246
1 247
1 251
1 252
1 255
1 260
1 261
1 264
1 267
1 280
1 2...

input:

6
5000 3192
1 13
1 20
1 24
1 29
1 30
1 31
1 38
1 42
1 44
1 46
1 56
1 71
1 73
1 92
1 99
1 106
1 108
1 118
1 131
1 150
1 163
1 165
1 172
1 173
1 175
1 184
1 197
1 198
1 202
1 209
1 215
1 219
1 227
1 229
1 231
1 232
1 234
1 238
1 240
1 243
1 246
1 247
1 251
1 252
1 255
1 260
1 261
1 264
1 267
1 280
1 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
10955780

Test #22:

score: 30
Accepted
time: 309ms = 153ms + 156ms

input:

7
19938721

output:

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

input:

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

output:

8
5000 2500
1 42
1 46
1 47
1 48
1 55
1 56
1 60
1 73
1 80
1 92
1 97
1 108
1 118
1 124
1 125
1 134
1 135
1 137
1 139
1 140
1 166
1 178
1 185
1 189
1 195
1 198
1 200
1 209
1 215
1 218
1 219
1 225
1 232
1 233
1 242
1 246
1 247
1 251
1 263
1 264
1 266
1 270
1 287
1 295
1 296
1 302
1 308
1 313
1 326
1 327...

input:

8
5000 2500
1 42
1 46
1 47
1 48
1 55
1 56
1 60
1 73
1 80
1 92
1 97
1 108
1 118
1 124
1 125
1 134
1 135
1 137
1 139
1 140
1 166
1 178
1 185
1 189
1 195
1 198
1 200
1 209
1 215
1 218
1 219
1 225
1 232
1 233
1 242
1 246
1 247
1 251
1 263
1 264
1 266
1 270
1 287
1 295
1 296
1 302
1 308
1 313
1 326
1 327...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
19938721

Test #23:

score: 30
Accepted
time: 305ms = 168ms + 137ms

input:

7
5129508

output:

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

input:

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

output:

8
5000 2500
1 44
1 46
1 48
1 71
1 73
1 80
1 97
1 101
1 103
1 116
1 131
1 134
1 173
1 175
1 184
1 189
1 202
1 225
1 229
1 234
1 242
1 243
1 255
1 260
1 261
1 266
1 267
1 281
1 283
1 297
1 313
1 319
1 321
1 325
1 327
1 332
1 342
1 350
1 358
1 370
1 376
1 377
1 379
1 385
1 386
1 391
1 395
1 405
1 411
1...

input:

8
5000 2500
1 44
1 46
1 48
1 71
1 73
1 80
1 97
1 101
1 103
1 116
1 131
1 134
1 173
1 175
1 184
1 189
1 202
1 225
1 229
1 234
1 242
1 243
1 255
1 260
1 261
1 266
1 267
1 281
1 283
1 297
1 313
1 319
1 321
1 325
1 327
1 332
1 342
1 350
1 358
1 370
1 376
1 377
1 379
1 385
1 386
1 391
1 395
1 405
1 411
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5129508

Test #24:

score: 30
Accepted
time: 327ms = 184ms + 143ms

input:

7
15332941

output:

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

input:

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

output:

8
5000 2500
1 27
1 38
1 42
1 44
1 46
1 55
1 56
1 57
1 71
1 73
1 76
1 77
1 93
1 99
1 101
1 103
1 106
1 108
1 116
1 124
1 127
1 129
1 135
1 137
1 150
1 156
1 163
1 165
1 171
1 172
1 175
1 177
1 180
1 184
1 185
1 188
1 195
1 197
1 198
1 206
1 209
1 210
1 215
1 218
1 219
1 222
1 227
1 231
1 232
1 233
1 ...

input:

8
5000 2500
1 27
1 38
1 42
1 44
1 46
1 55
1 56
1 57
1 71
1 73
1 76
1 77
1 93
1 99
1 101
1 103
1 106
1 108
1 116
1 124
1 127
1 129
1 135
1 137
1 150
1 156
1 163
1 165
1 171
1 172
1 175
1 177
1 180
1 184
1 185
1 188
1 195
1 197
1 198
1 206
1 209
1 210
1 215
1 218
1 219
1 222
1 227
1 231
1 232
1 233
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
15332941

Subtask #3:

score: 65
Accepted

Test #25:

score: 65
Accepted
time: 342ms = 191ms + 151ms

input:

1
355365355024496523

output:

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

input:

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

output:

2
5000 3990
1 4
1 5
1 6
1 12
1 14
1 17
1 18
1 19
1 26
1 40
1 42
1 43
1 47
1 48
1 51
1 53
1 54
1 55
1 59
1 60
1 61
1 63
1 64
1 65
1 73
1 74
1 78
1 82
1 86
1 88
1 95
1 97
1 98
1 100
1 106
1 107
1 108
1 110
1 111
1 112
1 113
1 114
1 115
1 117
1 120
1 124
1 125
1 129
1 131
1 135
1 137
1 138
1 140
1 141
...

input:

2
5000 3990
1 4
1 5
1 6
1 12
1 14
1 17
1 18
1 19
1 26
1 40
1 42
1 43
1 47
1 48
1 51
1 53
1 54
1 55
1 59
1 60
1 61
1 63
1 64
1 65
1 73
1 74
1 78
1 82
1 86
1 88
1 95
1 97
1 98
1 100
1 106
1 107
1 108
1 110
1 111
1 112
1 113
1 114
1 115
1 117
1 120
1 124
1 125
1 129
1 131
1 135
1 137
1 138
1 140
1 141
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
355365355024496523

Test #26:

score: 65
Accepted
time: 293ms = 163ms + 130ms

input:

1
727827999106414164

output:

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

input:

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

output:

2
5000 3055
1 6
1 11
1 13
1 30
1 31
1 39
1 42
1 44
1 45
1 46
1 58
1 65
1 66
1 67
1 70
1 72
1 73
1 74
1 83
1 84
1 85
1 88
1 100
1 101
1 103
1 114
1 116
1 117
1 121
1 124
1 126
1 131
1 137
1 141
1 153
1 161
1 169
1 174
1 175
1 176
1 179
1 181
1 182
1 184
1 185
1 187
1 191
1 198
1 200
1 203
1 205
1 210...

input:

2
5000 3055
1 6
1 11
1 13
1 30
1 31
1 39
1 42
1 44
1 45
1 46
1 58
1 65
1 66
1 67
1 70
1 72
1 73
1 74
1 83
1 84
1 85
1 88
1 100
1 101
1 103
1 114
1 116
1 117
1 121
1 124
1 126
1 131
1 137
1 141
1 153
1 161
1 169
1 174
1 175
1 176
1 179
1 181
1 182
1 184
1 185
1 187
1 191
1 198
1 200
1 203
1 205
1 210...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
727827999106414164

Test #27:

score: 65
Accepted
time: 330ms = 169ms + 161ms

input:

1
656410143989222955

output:

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

input:

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

output:

2
5000 3055
1 3
1 5
1 8
1 9
1 32
1 33
1 34
1 35
1 42
1 45
1 46
1 47
1 49
1 51
1 53
1 54
1 55
1 56
1 57
1 60
1 65
1 66
1 67
1 72
1 73
1 77
1 78
1 80
1 91
1 92
1 98
1 100
1 101
1 103
1 108
1 110
1 116
1 126
1 130
1 135
1 140
1 141
1 142
1 146
1 152
1 176
1 177
1 182
1 188
1 200
1 206
1 214
1 218
1 221...

input:

2
5000 3055
1 3
1 5
1 8
1 9
1 32
1 33
1 34
1 35
1 42
1 45
1 46
1 47
1 49
1 51
1 53
1 54
1 55
1 56
1 57
1 60
1 65
1 66
1 67
1 72
1 73
1 77
1 78
1 80
1 91
1 92
1 98
1 100
1 101
1 103
1 108
1 110
1 116
1 126
1 130
1 135
1 140
1 141
1 142
1 146
1 152
1 176
1 177
1 182
1 188
1 200
1 206
1 214
1 218
1 221...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
656410143989222955

Test #28:

score: 65
Accepted
time: 336ms = 178ms + 158ms

input:

1
410366615149657534

output:

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

input:

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

output:

2
5000 4533
1 3
1 4
1 7
1 8
1 9
1 13
1 14
1 19
1 37
1 38
1 42
1 44
1 45
1 46
1 47
1 48
1 50
1 52
1 56
1 57
1 58
1 59
1 60
1 63
1 68
1 69
1 71
1 72
1 73
1 74
1 75
1 77
1 79
1 80
1 81
1 88
1 89
1 91
1 92
1 93
1 94
1 97
1 98
1 104
1 105
1 108
1 110
1 117
1 118
1 119
1 122
1 123
1 124
1 127
1 130
1 132
...

input:

2
5000 4533
1 3
1 4
1 7
1 8
1 9
1 13
1 14
1 19
1 37
1 38
1 42
1 44
1 45
1 46
1 47
1 48
1 50
1 52
1 56
1 57
1 58
1 59
1 60
1 63
1 68
1 69
1 71
1 72
1 73
1 74
1 75
1 77
1 79
1 80
1 81
1 88
1 89
1 91
1 92
1 93
1 94
1 97
1 98
1 104
1 105
1 108
1 110
1 117
1 118
1 119
1 122
1 123
1 124
1 127
1 130
1 132
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
410366615149657534

Test #29:

score: 65
Accepted
time: 320ms = 184ms + 136ms

input:

1
298090682780948428

output:

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

input:

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

output:

2
5000 4533
1 10
1 11
1 13
1 26
1 29
1 31
1 38
1 39
1 41
1 42
1 43
1 44
1 46
1 48
1 50
1 58
1 59
1 63
1 67
1 71
1 73
1 75
1 76
1 81
1 88
1 90
1 94
1 97
1 99
1 100
1 106
1 110
1 114
1 122
1 123
1 124
1 127
1 129
1 131
1 133
1 134
1 136
1 137
1 138
1 139
1 143
1 144
1 145
1 147
1 150
1 154
1 156
1 166...

input:

2
5000 4533
1 10
1 11
1 13
1 26
1 29
1 31
1 38
1 39
1 41
1 42
1 43
1 44
1 46
1 48
1 50
1 58
1 59
1 63
1 67
1 71
1 73
1 75
1 76
1 81
1 88
1 90
1 94
1 97
1 99
1 100
1 106
1 110
1 114
1 122
1 123
1 124
1 127
1 129
1 131
1 133
1 134
1 136
1 137
1 138
1 139
1 143
1 144
1 145
1 147
1 150
1 154
1 156
1 166...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
298090682780948428

Test #30:

score: 65
Accepted
time: 332ms = 208ms + 124ms

input:

3
969441916331132577

output:

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

input:

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

output:

4
5000 2500
1 2
1 4
1 5
1 7
1 9
1 31
1 32
1 33
1 35
1 36
1 38
1 40
1 41
1 42
1 45
1 46
1 47
1 50
1 51
1 53
1 54
1 55
1 57
1 59
1 60
1 61
1 62
1 63
1 68
1 72
1 73
1 75
1 77
1 80
1 81
1 82
1 83
1 86
1 88
1 93
1 94
1 96
1 101
1 102
1 103
1 111
1 112
1 113
1 115
1 116
1 119
1 120
1 122
1 126
1 129
1 131...

input:

4
5000 2500
1 2
1 4
1 5
1 7
1 9
1 31
1 32
1 33
1 35
1 36
1 38
1 40
1 41
1 42
1 45
1 46
1 47
1 50
1 51
1 53
1 54
1 55
1 57
1 59
1 60
1 61
1 62
1 63
1 68
1 72
1 73
1 75
1 77
1 80
1 81
1 82
1 83
1 86
1 88
1 93
1 94
1 96
1 101
1 102
1 103
1 111
1 112
1 113
1 115
1 116
1 119
1 120
1 122
1 126
1 129
1 131...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
969441916331132577

Test #31:

score: 65
Accepted
time: 285ms = 185ms + 100ms

input:

3
929489812741933634

output:

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

input:

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

output:

4
5000 2535
1 2
1 8
1 11
1 12
1 14
1 19
1 33
1 36
1 37
1 40
1 41
1 50
1 51
1 52
1 53
1 54
1 57
1 61
1 62
1 63
1 68
1 69
1 75
1 76
1 77
1 78
1 81
1 82
1 83
1 86
1 88
1 91
1 92
1 93
1 94
1 96
1 98
1 99
1 101
1 102
1 103
1 105
1 106
1 107
1 109
1 110
1 111
1 112
1 113
1 115
1 116
1 118
1 119
1 120
1 12...

input:

4
5000 2535
1 2
1 8
1 11
1 12
1 14
1 19
1 33
1 36
1 37
1 40
1 41
1 50
1 51
1 52
1 53
1 54
1 57
1 61
1 62
1 63
1 68
1 69
1 75
1 76
1 77
1 78
1 81
1 82
1 83
1 86
1 88
1 91
1 92
1 93
1 94
1 96
1 98
1 99
1 101
1 102
1 103
1 105
1 106
1 107
1 109
1 110
1 111
1 112
1 113
1 115
1 116
1 118
1 119
1 120
1 12...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
929489812741933634

Test #32:

score: 65
Accepted
time: 338ms = 180ms + 158ms

input:

3
144032041325838295

output:

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

input:

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

output:

4
5000 2695
1 4
1 5
1 6
1 8
1 9
1 10
1 11
1 13
1 17
1 19
1 22
1 38
1 39
1 40
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 50
1 55
1 58
1 59
1 60
1 62
1 64
1 68
1 69
1 71
1 72
1 73
1 74
1 75
1 76
1 78
1 79
1 82
1 86
1 91
1 92
1 94
1 95
1 96
1 97
1 98
1 107
1 109
1 110
1 111
1 112
1 113
1 114
1 117
1 118
1 11...

input:

4
5000 2695
1 4
1 5
1 6
1 8
1 9
1 10
1 11
1 13
1 17
1 19
1 22
1 38
1 39
1 40
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 50
1 55
1 58
1 59
1 60
1 62
1 64
1 68
1 69
1 71
1 72
1 73
1 74
1 75
1 76
1 78
1 79
1 82
1 86
1 91
1 92
1 94
1 95
1 96
1 97
1 98
1 107
1 109
1 110
1 111
1 112
1 113
1 114
1 117
1 118
1 11...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
144032041325838295

Test #33:

score: 65
Accepted
time: 344ms = 205ms + 139ms

input:

3
832110946250826180

output:

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

input:

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

output:

4
5000 2500
1 2
1 6
1 7
1 9
1 11
1 12
1 13
1 14
1 20
1 31
1 33
1 34
1 37
1 39
1 40
1 43
1 44
1 48
1 51
1 52
1 53
1 54
1 56
1 57
1 59
1 61
1 62
1 64
1 69
1 70
1 71
1 76
1 77
1 79
1 81
1 84
1 85
1 89
1 93
1 97
1 101
1 102
1 103
1 104
1 105
1 108
1 111
1 114
1 116
1 120
1 121
1 125
1 126
1 131
1 132
1 ...

input:

4
5000 2500
1 2
1 6
1 7
1 9
1 11
1 12
1 13
1 14
1 20
1 31
1 33
1 34
1 37
1 39
1 40
1 43
1 44
1 48
1 51
1 52
1 53
1 54
1 56
1 57
1 59
1 61
1 62
1 64
1 69
1 70
1 71
1 76
1 77
1 79
1 81
1 84
1 85
1 89
1 93
1 97
1 101
1 102
1 103
1 104
1 105
1 108
1 111
1 114
1 116
1 120
1 121
1 125
1 126
1 131
1 132
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
832110946250826180

Test #34:

score: 65
Accepted
time: 307ms = 175ms + 132ms

input:

3
85728715707691821

output:

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

input:

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

output:

4
5000 2500
1 5
1 7
1 9
1 13
1 14
1 17
1 26
1 30
1 31
1 32
1 35
1 36
1 41
1 44
1 45
1 48
1 50
1 55
1 57
1 59
1 65
1 66
1 67
1 70
1 71
1 72
1 74
1 75
1 77
1 80
1 84
1 90
1 93
1 94
1 95
1 97
1 100
1 101
1 103
1 109
1 110
1 116
1 117
1 121
1 122
1 124
1 127
1 128
1 129
1 131
1 134
1 135
1 137
1 144
1 1...

input:

4
5000 2500
1 5
1 7
1 9
1 13
1 14
1 17
1 26
1 30
1 31
1 32
1 35
1 36
1 41
1 44
1 45
1 48
1 50
1 55
1 57
1 59
1 65
1 66
1 67
1 70
1 71
1 72
1 74
1 75
1 77
1 80
1 84
1 90
1 93
1 94
1 95
1 97
1 100
1 101
1 103
1 109
1 110
1 116
1 117
1 121
1 122
1 124
1 127
1 128
1 129
1 131
1 134
1 135
1 137
1 144
1 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
85728715707691821

Test #35:

score: 65
Accepted
time: 324ms = 185ms + 139ms

input:

5
777434612360931036

output:

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

input:

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

output:

6
5000 3068
1 2
1 4
1 6
1 7
1 10
1 11
1 12
1 26
1 28
1 33
1 38
1 39
1 42
1 43
1 44
1 46
1 47
1 51
1 53
1 54
1 57
1 60
1 61
1 64
1 65
1 69
1 71
1 73
1 76
1 77
1 79
1 81
1 85
1 93
1 96
1 99
1 100
1 101
1 102
1 103
1 106
1 107
1 112
1 113
1 114
1 116
1 120
1 125
1 126
1 127
1 129
1 133
1 138
1 139
1 14...

input:

6
5000 3068
1 2
1 4
1 6
1 7
1 10
1 11
1 12
1 26
1 28
1 33
1 38
1 39
1 42
1 43
1 44
1 46
1 47
1 51
1 53
1 54
1 57
1 60
1 61
1 64
1 65
1 69
1 71
1 73
1 76
1 77
1 79
1 81
1 85
1 93
1 96
1 99
1 100
1 101
1 102
1 103
1 106
1 107
1 112
1 113
1 114
1 116
1 120
1 125
1 126
1 127
1 129
1 133
1 138
1 139
1 14...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
777434612360931036

Test #36:

score: 65
Accepted
time: 334ms = 181ms + 153ms

input:

5
705262511549880222

output:

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

input:

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

output:

6
5000 2832
1 9
1 13
1 19
1 26
1 32
1 38
1 42
1 44
1 46
1 48
1 49
1 57
1 58
1 64
1 65
1 69
1 71
1 73
1 74
1 77
1 78
1 91
1 93
1 95
1 96
1 97
1 98
1 100
1 101
1 102
1 103
1 109
1 110
1 112
1 113
1 116
1 117
1 123
1 124
1 125
1 126
1 127
1 128
1 129
1 130
1 134
1 137
1 139
1 141
1 142
1 146
1 151
1 15...

input:

6
5000 2832
1 9
1 13
1 19
1 26
1 32
1 38
1 42
1 44
1 46
1 48
1 49
1 57
1 58
1 64
1 65
1 69
1 71
1 73
1 74
1 77
1 78
1 91
1 93
1 95
1 96
1 97
1 98
1 100
1 101
1 102
1 103
1 109
1 110
1 112
1 113
1 116
1 117
1 123
1 124
1 125
1 126
1 127
1 128
1 129
1 130
1 134
1 137
1 139
1 141
1 142
1 146
1 151
1 15...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
705262511549880222

Test #37:

score: 65
Accepted
time: 310ms = 184ms + 126ms

input:

5
510318082834167951

output:

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

input:

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

output:

6
5000 3884
1 4
1 5
1 7
1 8
1 9
1 12
1 14
1 19
1 26
1 32
1 37
1 40
1 44
1 45
1 47
1 52
1 53
1 55
1 57
1 58
1 60
1 61
1 62
1 63
1 65
1 66
1 67
1 70
1 71
1 72
1 77
1 78
1 79
1 81
1 83
1 84
1 85
1 88
1 90
1 91
1 92
1 93
1 98
1 99
1 100
1 101
1 103
1 105
1 106
1 111
1 115
1 116
1 118
1 121
1 123
1 124
1...

input:

6
5000 3884
1 4
1 5
1 7
1 8
1 9
1 12
1 14
1 19
1 26
1 32
1 37
1 40
1 44
1 45
1 47
1 52
1 53
1 55
1 57
1 58
1 60
1 61
1 62
1 63
1 65
1 66
1 67
1 70
1 71
1 72
1 77
1 78
1 79
1 81
1 83
1 84
1 85
1 88
1 90
1 91
1 92
1 93
1 98
1 99
1 100
1 101
1 103
1 105
1 106
1 111
1 115
1 116
1 118
1 121
1 123
1 124
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
510318082834167951

Test #38:

score: 65
Accepted
time: 346ms = 189ms + 157ms

input:

5
914858813253258744

output:

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

input:

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

output:

6
5000 2769
1 2
1 3
1 4
1 6
1 7
1 8
1 10
1 11
1 14
1 33
1 36
1 37
1 38
1 39
1 42
1 43
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 57
1 60
1 61
1 63
1 66
1 67
1 68
1 69
1 70
1 72
1 73
1 75
1 76
1 77
1 80
1 82
1 83
1 84
1 86
1 88
1 90
1 92
1 93
1 94
1 97
1 102
1 105
1 107
1 109
1 110
1 114
1 1...

input:

6
5000 2769
1 2
1 3
1 4
1 6
1 7
1 8
1 10
1 11
1 14
1 33
1 36
1 37
1 38
1 39
1 42
1 43
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 57
1 60
1 61
1 63
1 66
1 67
1 68
1 69
1 70
1 72
1 73
1 75
1 76
1 77
1 80
1 82
1 83
1 84
1 86
1 88
1 90
1 92
1 93
1 94
1 97
1 102
1 105
1 107
1 109
1 110
1 114
1 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
914858813253258744

Test #39:

score: 65
Accepted
time: 337ms = 197ms + 140ms

input:

5
659635316746638238

output:

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

input:

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

output:

6
5000 4282
1 3
1 4
1 7
1 9
1 12
1 13
1 14
1 18
1 19
1 22
1 26
1 41
1 44
1 47
1 48
1 49
1 50
1 52
1 53
1 56
1 58
1 59
1 60
1 61
1 62
1 65
1 68
1 70
1 71
1 75
1 78
1 81
1 82
1 83
1 84
1 86
1 88
1 89
1 91
1 94
1 97
1 98
1 100
1 101
1 102
1 103
1 104
1 105
1 107
1 108
1 109
1 110
1 111
1 115
1 116
1 11...

input:

6
5000 4282
1 3
1 4
1 7
1 9
1 12
1 13
1 14
1 18
1 19
1 22
1 26
1 41
1 44
1 47
1 48
1 49
1 50
1 52
1 53
1 56
1 58
1 59
1 60
1 61
1 62
1 65
1 68
1 70
1 71
1 75
1 78
1 81
1 82
1 83
1 84
1 86
1 88
1 89
1 91
1 94
1 97
1 98
1 100
1 101
1 102
1 103
1 104
1 105
1 107
1 108
1 109
1 110
1 111
1 115
1 116
1 11...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659635316746638238

Test #40:

score: 65
Accepted
time: 319ms = 184ms + 135ms

input:

7
858490260563149759

output:

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

input:

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

output:

8
5000 2500
1 9
1 14
1 17
1 22
1 34
1 36
1 47
1 49
1 50
1 52
1 56
1 57
1 58
1 59
1 64
1 68
1 69
1 70
1 71
1 75
1 79
1 80
1 81
1 82
1 86
1 89
1 91
1 93
1 94
1 95
1 96
1 97
1 98
1 99
1 101
1 102
1 103
1 105
1 109
1 110
1 113
1 116
1 117
1 119
1 121
1 122
1 123
1 125
1 127
1 128
1 129
1 130
1 131
1 134...

input:

8
5000 2500
1 9
1 14
1 17
1 22
1 34
1 36
1 47
1 49
1 50
1 52
1 56
1 57
1 58
1 59
1 64
1 68
1 69
1 70
1 71
1 75
1 79
1 80
1 81
1 82
1 86
1 89
1 91
1 93
1 94
1 95
1 96
1 97
1 98
1 99
1 101
1 102
1 103
1 105
1 109
1 110
1 113
1 116
1 117
1 119
1 121
1 122
1 123
1 125
1 127
1 128
1 129
1 130
1 131
1 134...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
858490260563149759

Test #41:

score: 65
Accepted
time: 321ms = 172ms + 149ms

input:

7
860058643727731209

output:

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

input:

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

output:

8
5000 2500
1 17
1 24
1 26
1 34
1 37
1 40
1 41
1 47
1 49
1 50
1 52
1 53
1 55
1 56
1 58
1 59
1 60
1 61
1 62
1 64
1 65
1 74
1 75
1 81
1 83
1 85
1 88
1 92
1 94
1 95
1 96
1 99
1 100
1 101
1 102
1 103
1 105
1 106
1 107
1 108
1 111
1 112
1 113
1 115
1 116
1 117
1 118
1 122
1 123
1 126
1 127
1 129
1 130
1 ...

input:

8
5000 2500
1 17
1 24
1 26
1 34
1 37
1 40
1 41
1 47
1 49
1 50
1 52
1 53
1 55
1 56
1 58
1 59
1 60
1 61
1 62
1 64
1 65
1 74
1 75
1 81
1 83
1 85
1 88
1 92
1 94
1 95
1 96
1 99
1 100
1 101
1 102
1 103
1 105
1 106
1 107
1 108
1 111
1 112
1 113
1 115
1 116
1 117
1 118
1 122
1 123
1 126
1 127
1 129
1 130
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
860058643727731209

Test #42:

score: 65
Accepted
time: 322ms = 180ms + 142ms

input:

7
718861404514377808

output:

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

input:

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

output:

8
5000 2500
1 17
1 26
1 32
1 34
1 37
1 39
1 43
1 45
1 49
1 50
1 52
1 58
1 64
1 65
1 68
1 69
1 72
1 74
1 75
1 76
1 81
1 89
1 94
1 95
1 96
1 99
1 100
1 101
1 102
1 103
1 104
1 105
1 106
1 110
1 112
1 113
1 114
1 116
1 117
1 119
1 122
1 123
1 125
1 126
1 130
1 132
1 133
1 141
1 142
1 143
1 146
1 148
1 ...

input:

8
5000 2500
1 17
1 26
1 32
1 34
1 37
1 39
1 43
1 45
1 49
1 50
1 52
1 58
1 64
1 65
1 68
1 69
1 72
1 74
1 75
1 76
1 81
1 89
1 94
1 95
1 96
1 99
1 100
1 101
1 102
1 103
1 104
1 105
1 106
1 110
1 112
1 113
1 114
1 116
1 117
1 119
1 122
1 123
1 125
1 126
1 130
1 132
1 133
1 141
1 142
1 143
1 146
1 148
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
718861404514377808

Test #43:

score: 65
Accepted
time: 320ms = 175ms + 145ms

input:

7
659192688464047828

output:

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

input:

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

output:

8
5000 2500
1 17
1 20
1 31
1 38
1 40
1 42
1 44
1 46
1 49
1 53
1 56
1 58
1 59
1 61
1 62
1 68
1 71
1 73
1 74
1 75
1 76
1 79
1 81
1 82
1 86
1 89
1 92
1 94
1 95
1 99
1 101
1 102
1 103
1 104
1 106
1 108
1 110
1 111
1 116
1 117
1 118
1 119
1 122
1 123
1 126
1 129
1 130
1 131
1 133
1 136
1 139
1 142
1 146
...

input:

8
5000 2500
1 17
1 20
1 31
1 38
1 40
1 42
1 44
1 46
1 49
1 53
1 56
1 58
1 59
1 61
1 62
1 68
1 71
1 73
1 74
1 75
1 76
1 79
1 81
1 82
1 86
1 89
1 92
1 94
1 95
1 99
1 101
1 102
1 103
1 104
1 106
1 108
1 110
1 111
1 116
1 117
1 118
1 119
1 122
1 123
1 126
1 129
1 130
1 131
1 133
1 136
1 139
1 142
1 146
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659192688464047828

Test #44:

score: 65
Accepted
time: 322ms = 172ms + 150ms

input:

7
685730986714800201

output:

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

input:

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

output:

8
5000 2500
1 23
1 28
1 32
1 37
1 39
1 40
1 43
1 52
1 55
1 62
1 65
1 68
1 69
1 70
1 76
1 81
1 84
1 99
1 100
1 102
1 105
1 106
1 109
1 110
1 111
1 114
1 119
1 121
1 125
1 126
1 127
1 128
1 132
1 133
1 135
1 136
1 143
1 146
1 149
1 150
1 153
1 154
1 156
1 157
1 158
1 162
1 163
1 165
1 168
1 172
1 176
...

input:

8
5000 2500
1 23
1 28
1 32
1 37
1 39
1 40
1 43
1 52
1 55
1 62
1 65
1 68
1 69
1 70
1 76
1 81
1 84
1 99
1 100
1 102
1 105
1 106
1 109
1 110
1 111
1 114
1 119
1 121
1 125
1 126
1 127
1 128
1 132
1 133
1 135
1 136
1 143
1 146
1 149
1 150
1 153
1 154
1 156
1 157
1 158
1 162
1 163
1 165
1 168
1 172
1 176
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
685730986714800201