QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#421437#8726. Magic ShowWTR2007100 ✓191ms3140kbC++202.2kb2024-05-25 18:43:452024-05-25 18:43:45

Judging History

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

  • [2024-05-25 18:43:45]
  • 评测
  • 测评结果:100
  • 用时:191ms
  • 内存:3140kb
  • [2024-05-25 18:43:45]
  • 提交

Alice

#include<bits/stdc++.h>
#include"Alice.h"
using namespace std;
typedef long long ll;
const int N = 5005;
int x[N][N];
struct dsu {
    vector<int> fa;
    dsu(int n) : fa(n + 2) { iota(fa.begin(), fa.end(), 0); };
    inline int Find(int r) {
        while (r != fa[r]) r = fa[r] = fa[fa[r]];
        return r;
    }
    inline bool Merge(int x, int y) {
        x = Find(x); y = Find(y);
        if (x == y) return true;
        else return fa[y] = x, false;
    }
};
vector<pair<int, int>> Alice() {
    srand(114515);
    ll X = setN(5000);
    for (int i = 2; i <= 5000; i++) 
        for (int j = 1; j < i; j++) 
            x[i][j] = rand() % 60;
    vector<pair<int, int>> E;
    dsu A(5005);
    for (int tot = 0; tot < 5000 - 1;) {
        int u = rand() % 5000 + 1, v = rand() % 5000 + 1;
        if (u == v) continue;
        if (u < v) swap(u, v);
        if (!((X >> x[u][v]) & 1)) continue;
        if (!A.Merge(u, v)) E.push_back({v, u}), tot++;
    }
    sort(E.begin(), E.end());
    return E;
}
// signed main() {
//     freopen("a.out", "w", stdout);
//     auto T = Alice();
//     random_shuffle(T.begin(), T.end());
//     for (int i = 2497; i < 4999; i++) 
//         cout << T[i].first << " " << T[i].second << endl;
// }

Bob

#include<bits/stdc++.h>
#include"Bob.h"
using namespace std;
typedef long long ll;
const int N = 5005;
int x[N][N];
// inline int read() {
//     int w = 0, f = 1;
//     char ch = getchar();
//     while (ch < '0' || ch > '9') {
//         if (ch == '-') f = -1;
//         ch = getchar();
//     }
//     while (ch >= '0' && ch <= '9') {
//         w = (w << 1) + (w << 3) + ch - 48;
//         ch = getchar();
//     }
//     return w * f;
// }
long long Bob(vector<pair<int, int>> V) {
    srand(114515);
    ll ans = 0;
    for (int i = 2; i <= 5000; i++) 
        for (int j = 1; j < i; j++) 
            x[i][j] = rand() % 60;
    for (auto [u, v] : V) ans |= (1ll << x[v][u]);
    return ans;
}
// signed main() {
//     freopen("a.out", "r", stdin);
//     vector<pair<int, int>> E;
//     for (int i = 0; i < 2500; i++) {
//         int u = read(), v = read();
//         E.push_back({u, v});
//     }
//     auto X = Bob(E);
//     cout << X << endl;
// }

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 162ms = 72ms + 90ms
memory: 3136kb,3084kb

input:

1
4005

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 883
1 1172
1 4387
2 3226
2 4654
3 1534
3 1916
3 3373
3 3901
4 1977
5 3815
5 4424
6 2319
7 1605
7 1721
8 1257
8 2772
9 1935
9 3374
9 3744
10 2457
11 2487
11 3125
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 883
1 1172
1 4387
2 3226
2 4654
3 1534
3 1916
3 3373
3 3901
4 1977
5 3815
5 4424
6 2319
7 1605
7 1721
8 1257
8 2772
9 1935
9 3374
9 3744
10 2457
11 2487
11 3125
1...

output:

2
5000 4406
1 883
1 1172
2 3226
2 4654
3 1534
3 1916
3 3373
4 1977
5 3815
5 4424
6 2319
7 1605
7 1721
8 2772
9 1935
9 3374
9 3744
10 2457
11 2487
11 3125
12 1507
12 3183
12 3944
13 568
13 2074
14 2914
15 2005
15 3060
15 3787
16 1855
16 1964
16 3835
17 559
17 800
18 880
18 1399
18 2408
18 3492
19 586...

input:

2
5000 4406
1 883
1 1172
2 3226
2 4654
3 1534
3 1916
3 3373
4 1977
5 3815
5 4424
6 2319
7 1605
7 1721
8 2772
9 1935
9 3374
9 3744
10 2457
11 2487
11 3125
12 1507
12 3183
12 3944
13 568
13 2074
14 2914
15 2005
15 3060
15 3787
16 1855
16 1964
16 3835
17 559
17 800
18 880
18 1399
18 2408
18 3492
19 586...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

score: 5
Accepted
time: 160ms = 77ms + 83ms
memory: 3136kb,3084kb

input:

1
459

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 1172
1 1726
1 4387
2 3226
3 4214
4 574
5 4424
6 916
6 2940
6 4950
7 1721
7 3494
8 2772
8 3967
9 1935
9 3374
10 510
10 2457
11 2042
11 3094
11 3125
11 3617
12 3183...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 1172
1 1726
1 4387
2 3226
3 4214
4 574
5 4424
6 916
6 2940
6 4950
7 1721
7 3494
8 2772
8 3967
9 1935
9 3374
10 510
10 2457
11 2042
11 3094
11 3125
11 3617
12 3183...

output:

2
5000 4406
1 1172
1 1726
2 3226
3 4214
4 574
5 4424
6 916
6 4950
7 1721
7 3494
8 2772
8 3967
9 1935
10 510
10 2457
11 2042
11 3094
11 3125
11 3617
12 3183
12 3944
13 568
13 2548
13 4543
14 2914
15 2005
15 3866
16 1855
16 1964
16 3835
17 800
18 203
18 4218
19 246
20 618
21 966
21 1441
22 621
22 2163...

input:

2
5000 4406
1 1172
1 1726
2 3226
3 4214
4 574
5 4424
6 916
6 4950
7 1721
7 3494
8 2772
8 3967
9 1935
10 510
10 2457
11 2042
11 3094
11 3125
11 3617
12 3183
12 3944
13 568
13 2548
13 4543
14 2914
15 2005
15 3866
16 1855
16 1964
16 3835
17 800
18 203
18 4218
19 246
20 618
21 966
21 1441
22 621
22 2163...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

score: 5
Accepted
time: 184ms = 97ms + 87ms
memory: 3136kb,3080kb

input:

1
2495

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2930
1 4387
2 3226
2 4654
3 1534
3 1916
3 3373
3 3901
4 1977
5 3815
5 4424
6 887
7 1721
7 2834
7 3494
8 2772
8 3967
9 3744
9 3831
10 510
10 2457
11 3125
12 3183
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2930
1 4387
2 3226
2 4654
3 1534
3 1916
3 3373
3 3901
4 1977
5 3815
5 4424
6 887
7 1721
7 2834
7 3494
8 2772
8 3967
9 3744
9 3831
10 510
10 2457
11 3125
12 3183
1...

output:

2
5000 4406
1 2930
1 4387
2 4654
3 1534
3 1916
3 3373
3 3901
5 3815
5 4424
6 887
7 1721
7 2834
7 3494
8 3967
9 3744
9 3831
10 510
10 2457
11 3125
12 3183
12 3944
13 1699
13 4543
14 2914
15 2005
16 1855
16 1964
17 800
18 1713
18 2408
18 4218
18 4263
19 586
19 969
21 2735
22 621
22 2163
22 2727
23 493...

input:

2
5000 4406
1 2930
1 4387
2 4654
3 1534
3 1916
3 3373
3 3901
5 3815
5 4424
6 887
7 1721
7 2834
7 3494
8 3967
9 3744
9 3831
10 510
10 2457
11 3125
12 3183
12 3944
13 1699
13 4543
14 2914
15 2005
16 1855
16 1964
17 800
18 1713
18 2408
18 4218
18 4263
19 586
19 969
21 2735
22 621
22 2163
22 2727
23 493...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

score: 5
Accepted
time: 191ms = 112ms + 79ms
memory: 3140kb,3052kb

input:

3
1560

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 851
1 1175
1 1726
1 2930
1 3283
2 3008
3 235
3 1622
4 3769
5 844
6 2319
7 1605
7 2175
7 2834
7 3494
8 1257
8 2230
8 2304
9 3831
10 4649
11 1814
11 4100
12 3747
13...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 851
1 1175
1 1726
1 2930
1 3283
2 3008
3 235
3 1622
4 3769
5 844
6 2319
7 1605
7 2175
7 2834
7 3494
8 1257
8 2230
8 2304
9 3831
10 4649
11 1814
11 4100
12 3747
13...

output:

4
5000 2500
3 235
4 3769
6 2319
9 3831
10 4649
11 1814
11 4100
12 3747
13 1699
13 2074
14 3608
15 3787
16 3955
17 559
17 4274
20 618
21 2320
21 2784
22 621
23 3815
25 949
25 3365
26 221
28 3865
30 1808
30 4832
31 740
32 4048
34 1606
36 1940
36 2304
43 2385
44 320
45 4636
47 2310
48 4224
49 1234
49 4...

input:

4
5000 2500
3 235
4 3769
6 2319
9 3831
10 4649
11 1814
11 4100
12 3747
13 1699
13 2074
14 3608
15 3787
16 3955
17 559
17 4274
20 618
21 2320
21 2784
22 621
23 3815
25 949
25 3365
26 221
28 3865
30 1808
30 4832
31 740
32 4048
34 1606
36 1940
36 2304
43 2385
44 320
45 4636
47 2310
48 4224
49 1234
49 4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

score: 5
Accepted
time: 184ms = 93ms + 91ms
memory: 3132kb,3052kb

input:

3
3594

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 830
1 851
1 1175
1 1726
1 3283
1 4572
2 3008
3 1534
3 1622
3 1916
4 1977
5 2427
6 887
6 2319
6 4950
7 1605
7 3494
8 1257
8 2230
8 2304
8 3967
9 3489
9 4959
10 510...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 830
1 851
1 1175
1 1726
1 3283
1 4572
2 3008
3 1534
3 1622
3 1916
4 1977
5 2427
6 887
6 2319
6 4950
7 1605
7 3494
8 1257
8 2230
8 2304
8 3967
9 3489
9 4959
10 510...

output:

4
5000 2500
4 1977
7 3494
9 3489
9 4959
10 527
12 4216
13 2074
14 2041
14 3608
17 559
17 4274
20 618
21 2784
23 4316
25 949
25 3365
26 1705
27 49
31 4014
32 4871
33 4366
36 2304
37 2064
39 104
42 3852
43 4907
44 320
45 3868
46 1870
46 3288
47 3694
51 4569
52 1933
55 3029
56 3577
58 3131
58 3506
59 2...

input:

4
5000 2500
4 1977
7 3494
9 3489
9 4959
10 527
12 4216
13 2074
14 2041
14 3608
17 559
17 4274
20 618
21 2784
23 4316
25 949
25 3365
26 1705
27 49
31 4014
32 4871
33 4366
36 2304
37 2064
39 104
42 3852
43 4907
44 320
45 3868
46 1870
46 3288
47 3694
51 4569
52 1933
55 3029
56 3577
58 3131
58 3506
59 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

score: 5
Accepted
time: 182ms = 91ms + 91ms
memory: 3136kb,3052kb

input:

3
1750

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 851
1 2930
2 3226
3 3373
3 4214
4 574
4 3769
5 3815
6 916
6 2319
7 2834
8 1257
8 2304
8 3967
8 4475
9 1935
9 3831
10 510
10 527
10 2457
11 2042
11 3094
11 4100
12...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 851
1 2930
2 3226
3 3373
3 4214
4 574
4 3769
5 3815
6 916
6 2319
7 2834
8 1257
8 2304
8 3967
8 4475
9 1935
9 3831
10 510
10 527
10 2457
11 2042
11 3094
11 4100
12...

output:

4
5000 2500
1 851
3 3373
4 3769
5 3815
6 2319
7 2834
9 1935
9 3831
12 3183
14 626
16 3157
17 4274
18 4218
23 3257
23 3815
25 949
26 221
26 2068
27 4403
28 3865
28 4296
30 1808
31 2340
32 1706
33 1717
34 1606
35 3091
35 3878
39 1829
41 4754
42 1889
42 3852
44 3390
50 4182
51 3651
52 1933
52 2363
55 3...

input:

4
5000 2500
1 851
3 3373
4 3769
5 3815
6 2319
7 2834
9 1935
9 3831
12 3183
14 626
16 3157
17 4274
18 4218
23 3257
23 3815
25 949
26 221
26 2068
27 4403
28 3865
28 4296
30 1808
31 2340
32 1706
33 1717
34 1606
35 3091
35 3878
39 1829
41 4754
42 1889
42 3852
44 3390
50 4182
51 3651
52 1933
52 2363
55 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1750

Test #7:

score: 5
Accepted
time: 169ms = 84ms + 85ms
memory: 3136kb,3052kb

input:

5
4878

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 1172
1 1726
2 2891
3 3373
4 220
5 3815
5 4424
6 4950
7 1721
7 3494
8 2230
8 2304
8 3967
9 3374
10 510
10 527
11 3125
12 3944
13 568
13 1092
13 2548
13 4543
14 291...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 1172
1 1726
2 2891
3 3373
4 220
5 3815
5 4424
6 4950
7 1721
7 3494
8 2230
8 2304
8 3967
9 3374
10 510
10 527
11 3125
12 3944
13 568
13 1092
13 2548
13 4543
14 291...

output:

6
5000 2521
1 1726
3 3373
5 3815
7 3494
8 2230
9 3374
10 527
13 568
13 1092
13 2548
15 3866
17 4274
18 1399
18 4860
21 2784
22 621
23 493
24 1952
24 3664
25 3365
27 4282
28 4350
29 189
30 1785
31 2618
33 1161
34 1101
34 3591
35 4818
36 2394
37 4672
38 2177
39 1829
40 1397
40 4414
41 604
42 2056
43 3...

input:

6
5000 2521
1 1726
3 3373
5 3815
7 3494
8 2230
9 3374
10 527
13 568
13 1092
13 2548
15 3866
17 4274
18 1399
18 4860
21 2784
22 621
23 493
24 1952
24 3664
25 3365
27 4282
28 4350
29 189
30 1785
31 2618
33 1161
34 1101
34 3591
35 4818
36 2394
37 4672
38 2177
39 1829
40 1397
40 4414
41 604
42 2056
43 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4878

Test #8:

score: 5
Accepted
time: 181ms = 98ms + 83ms
memory: 3132kb,3052kb

input:

5
1223

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 851
1 883
1 4387
2 3008
2 3226
2 4919
3 3373
3 4214
4 574
5 3815
6 916
6 2319
7 1393
8 1257
8 2772
8 3967
9 1935
10 510
10 527
10 2457
11 2042
11 3094
12 3183
13 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 851
1 883
1 4387
2 3008
2 3226
2 4919
3 3373
3 4214
4 574
5 3815
6 916
6 2319
7 1393
8 1257
8 2772
8 3967
9 1935
10 510
10 527
10 2457
11 2042
11 3094
12 3183
13 ...

output:

6
5000 2512
1 883
2 3008
2 4919
3 3373
4 574
6 2319
8 1257
8 2772
9 1935
10 527
10 2457
11 3094
12 3183
13 2074
15 2005
16 1964
17 4729
18 880
19 2827
21 1441
22 4060
23 2057
24 1210
25 4236
26 2068
27 3301
28 4296
29 1562
30 2399
31 2340
31 3621
33 1717
34 3252
35 349
36 1550
36 2304
37 4672
38 459...

input:

6
5000 2512
1 883
2 3008
2 4919
3 3373
4 574
6 2319
8 1257
8 2772
9 1935
10 527
10 2457
11 3094
12 3183
13 2074
15 2005
16 1964
17 4729
18 880
19 2827
21 1441
22 4060
23 2057
24 1210
25 4236
26 2068
27 3301
28 4296
29 1562
30 2399
31 2340
31 3621
33 1717
34 3252
35 349
36 1550
36 2304
37 4672
38 459...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1223

Test #9:

score: 5
Accepted
time: 176ms = 105ms + 71ms
memory: 3140kb,3048kb

input:

5
648

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 1726
1 3283
2 3226
3 2622
3 3585
4 220
5 844
5 2785
5 2826
6 1162
6 4148
7 3494
7 3898
8 2230
8 2304
8 4475
9 1935
10 2457
10 4649
11 1928
12 3183
13 2924
14 626
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 1726
1 3283
2 3226
3 2622
3 3585
4 220
5 844
5 2785
5 2826
6 1162
6 4148
7 3494
7 3898
8 2230
8 2304
8 4475
9 1935
10 2457
10 4649
11 1928
12 3183
13 2924
14 626
...

output:

6
5000 2500
1 1726
2 3226
3 3585
4 220
5 2785
5 2826
6 4148
7 3898
8 2230
10 4649
12 3183
13 2924
14 3608
16 3955
17 4274
18 1399
19 246
20 618
21 966
22 1597
23 3257
24 2183
24 4326
25 3365
26 1809
27 796
28 3865
29 3648
30 3013
32 1706
33 1745
35 1963
35 4772
36 1550
37 4813
38 4036
39 4055
40 441...

input:

6
5000 2500
1 1726
2 3226
3 3585
4 220
5 2785
5 2826
6 4148
7 3898
8 2230
10 4649
12 3183
13 2924
14 3608
16 3955
17 4274
18 1399
19 246
20 618
21 966
22 1597
23 3257
24 2183
24 4326
25 3365
26 1809
27 796
28 3865
29 3648
30 3013
32 1706
33 1745
35 1963
35 4772
36 1550
37 4813
38 4036
39 4055
40 441...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
648

Test #10:

score: 5
Accepted
time: 160ms = 80ms + 80ms
memory: 3132kb,3052kb

input:

7
4475

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2930
1 4387
2 4654
3 3901
3 4214
4 574
4 4102
5 4424
6 916
6 4950
7 1393
7 1721
7 2834
8 2772
8 3967
9 3744
9 3831
10 510
11 2042
11 3125
11 3617
11 4076
12 1507
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2930
1 4387
2 4654
3 3901
3 4214
4 574
4 4102
5 4424
6 916
6 4950
7 1393
7 1721
7 2834
8 2772
8 3967
9 3744
9 3831
10 510
11 2042
11 3125
11 3617
11 4076
12 1507
...

output:

8
5000 2500
1 2930
1 4387
2 4654
3 3901
3 4214
4 574
4 4102
5 4424
6 916
7 2834
8 2772
9 3744
9 3831
12 1507
12 3944
13 568
13 1699
14 2914
15 3773
15 3866
17 503
20 618
21 2320
23 493
24 1210
24 1952
24 3737
26 2068
26 2841
27 4282
27 4857
28 4296
30 126
30 1785
30 2399
31 1807
31 2618
33 1717
33 1...

input:

8
5000 2500
1 2930
1 4387
2 4654
3 3901
3 4214
4 574
4 4102
5 4424
6 916
7 2834
8 2772
9 3744
9 3831
12 1507
12 3944
13 568
13 1699
14 2914
15 3773
15 3866
17 503
20 618
21 2320
23 493
24 1210
24 1952
24 3737
26 2068
26 2841
27 4282
27 4857
28 4296
30 126
30 1785
30 2399
31 1807
31 2618
33 1717
33 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4475

Test #11:

score: 5
Accepted
time: 181ms = 110ms + 71ms
memory: 3132kb,3052kb

input:

7
4240

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2930
1 3417
1 4714
2 3226
3 2620
4 3769
4 4577
5 2761
6 1162
6 1347
7 2175
7 2834
8 2645
8 4475
9 1703
9 1935
9 3831
10 2457
11 1814
11 4076
11 4100
12 3183
13 93...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 2930
1 3417
1 4714
2 3226
3 2620
4 3769
4 4577
5 2761
6 1162
6 1347
7 2175
7 2834
8 2645
8 4475
9 1703
9 1935
9 3831
10 2457
11 1814
11 4076
11 4100
12 3183
13 93...

output:

8
5000 2500
1 2930
1 4714
2 3226
3 2620
4 3769
5 2761
6 1162
6 1347
7 2175
8 4475
9 1703
10 2457
11 4076
13 1699
14 626
15 2005
17 800
20 3513
21 966
21 2198
21 2320
25 1669
25 2792
26 221
26 2735
27 744
27 1427
28 321
29 120
30 1785
30 1959
31 186
31 412
31 740
32 1706
33 1497
34 1606
34 3744
35 30...

input:

8
5000 2500
1 2930
1 4714
2 3226
3 2620
4 3769
5 2761
6 1162
6 1347
7 2175
8 4475
9 1703
10 2457
11 4076
13 1699
14 626
15 2005
17 800
20 3513
21 966
21 2198
21 2320
25 1669
25 2792
26 221
26 2735
27 744
27 1427
28 321
29 120
30 1785
30 1959
31 186
31 412
31 740
32 1706
33 1497
34 1606
34 3744
35 30...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4240

Test #12:

score: 5
Accepted
time: 172ms = 88ms + 84ms
memory: 3136kb,3056kb

input:

7
1291

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 883
1 1172
1 1175
1 1726
1 4387
1 4399
2 4919
3 1622
4 2502
4 4102
5 4424
6 2319
6 4950
7 1721
7 3494
8 1257
8 2772
8 3967
9 1568
9 3374
10 510
10 527
11 3094
11 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 883
1 1172
1 1175
1 1726
1 4387
1 4399
2 4919
3 1622
4 2502
4 4102
5 4424
6 2319
6 4950
7 1721
7 3494
8 1257
8 2772
8 3967
9 1568
9 3374
10 510
10 527
11 3094
11 ...

output:

8
5000 2500
2 4919
3 1622
4 4102
5 4424
6 2319
7 1721
7 3494
8 3967
9 1568
10 510
10 527
11 3125
11 3617
12 3944
13 568
13 2074
14 2914
15 3060
15 3866
16 1855
16 1964
17 3558
18 4218
19 1314
20 618
22 621
22 2163
22 4060
24 1210
24 1952
25 949
25 3365
26 1705
26 2841
27 4282
30 2399
31 1807
31 2618...

input:

8
5000 2500
2 4919
3 1622
4 4102
5 4424
6 2319
7 1721
7 3494
8 3967
9 1568
10 510
10 527
11 3125
11 3617
12 3944
13 568
13 2074
14 2914
15 3060
15 3866
16 1855
16 1964
17 3558
18 4218
19 1314
20 618
22 621
22 2163
22 4060
24 1210
24 1952
25 949
25 3365
26 1705
26 2841
27 4282
30 2399
31 1807
31 2618...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1291

Subtask #2:

score: 30
Accepted

Test #13:

score: 30
Accepted
time: 147ms = 87ms + 60ms
memory: 3132kb,3056kb

input:

1
17476204

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 1726
2 4412
2 4654
3 1916
3 3373
3 3901
4 574
5 216
5 3815
6 2987
6 3206
7 1393
8 2304
8 3177
9 3744
10 1810
11 52
11 2042
12 1507
13 1092
13 4692
14 2559
15 2107...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 1726
2 4412
2 4654
3 1916
3 3373
3 3901
4 574
5 216
5 3815
6 2987
6 3206
7 1393
8 2304
8 3177
9 3744
10 1810
11 52
11 2042
12 1507
13 1092
13 4692
14 2559
15 2107...

output:

2
5000 2743
2 4654
4 574
5 3815
6 3206
7 1393
8 3177
10 1810
11 2042
12 1507
13 1092
13 4692
15 2107
15 4952
16 1863
17 4274
18 1399
18 3492
19 586
20 1283
20 2147
22 4346
24 4254
25 1381
26 307
26 2068
27 49
27 4403
28 2408
29 230
32 1574
33 321
33 1717
34 3618
36 979
37 4672
38 2413
38 4599
40 103...

input:

2
5000 2743
2 4654
4 574
5 3815
6 3206
7 1393
8 3177
10 1810
11 2042
12 1507
13 1092
13 4692
15 2107
15 4952
16 1863
17 4274
18 1399
18 3492
19 586
20 1283
20 2147
22 4346
24 4254
25 1381
26 307
26 2068
27 49
27 4403
28 2408
29 230
32 1574
33 321
33 1717
34 3618
36 979
37 4672
38 2413
38 4599
40 103...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

score: 30
Accepted
time: 157ms = 78ms + 79ms
memory: 3140kb,3056kb

input:

1
11926600

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 682
1 851
2 1718
2 2088
2 4412
3 1916
3 4214
3 4535
4 143
4 574
5 216
5 1545
6 2319
6 4248
7 3512
8 1257
8 1486
8 2055
8 3424
9 4365
9 4487
10 4658
11 52
11 2042
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 682
1 851
2 1718
2 2088
2 4412
3 1916
3 4214
3 4535
4 143
4 574
5 216
5 1545
6 2319
6 4248
7 3512
8 1257
8 1486
8 2055
8 3424
9 4365
9 4487
10 4658
11 52
11 2042
...

output:

2
5000 2743
2 1718
3 4214
4 143
5 216
5 1545
6 4248
8 1257
8 2055
8 3424
9 4365
9 4487
11 52
12 424
13 4692
14 2949
15 3060
15 4952
16 2788
18 880
18 4332
22 2526
24 47
24 2541
24 2611
24 4254
25 949
25 1381
26 2068
27 589
29 3611
30 1785
31 186
32 1574
33 1717
34 3744
36 2394
36 3400
37 2148
38 329...

input:

2
5000 2743
2 1718
3 4214
4 143
5 216
5 1545
6 4248
8 1257
8 2055
8 3424
9 4365
9 4487
11 52
12 424
13 4692
14 2949
15 3060
15 4952
16 2788
18 880
18 4332
22 2526
24 47
24 2541
24 2611
24 4254
25 949
25 1381
26 2068
27 589
29 3611
30 1785
31 186
32 1574
33 1717
34 3744
36 2394
36 3400
37 2148
38 329...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 166ms = 79ms + 87ms
memory: 3140kb,3056kb

input:

1
16602378

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 682
2 1718
2 2088
3 4535
4 143
5 1545
6 2319
6 2987
6 4248
7 1721
7 3512
8 1257
8 2055
8 3424
8 3967
9 4487
10 510
11 698
11 3125
12 424
12 3944
13 3374
13 4543
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 682
2 1718
2 2088
3 4535
4 143
5 1545
6 2319
6 2987
6 4248
7 1721
7 3512
8 1257
8 2055
8 3424
8 3967
9 4487
10 510
11 698
11 3125
12 424
12 3944
13 3374
13 4543
1...

output:

2
5000 2743
2 2088
6 2319
6 4248
7 3512
8 1257
8 3424
9 4487
11 698
11 3125
12 424
12 3944
13 4543
15 3787
16 2788
18 880
18 4218
20 4270
21 1940
23 493
24 47
27 560
29 1822
29 1877
29 3611
30 3326
31 2618
32 1664
33 4609
34 3744
37 2148
38 329
38 2756
39 4233
40 1397
40 4414
41 604
42 4808
43 1626
...

input:

2
5000 2743
2 2088
6 2319
6 4248
7 3512
8 1257
8 3424
9 4487
11 698
11 3125
12 424
12 3944
13 4543
15 3787
16 2788
18 880
18 4218
20 4270
21 1940
23 493
24 47
27 560
29 1822
29 1877
29 3611
30 3326
31 2618
32 1664
33 4609
34 3744
37 2148
38 329
38 2756
39 4233
40 1397
40 4414
41 604
42 4808
43 1626
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 159ms = 87ms + 72ms
memory: 3136kb,3056kb

input:

3
13129243

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 851
1 2930
1 4387
2 1718
2 2088
3 1622
4 3769
5 1545
6 2319
6 2987
7 2834
7 3512
8 1257
8 2772
8 3424
8 3967
9 3831
10 510
11 698
11 4100
12 2612
12 3260
13 1699
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 851
1 2930
1 4387
2 1718
2 2088
3 1622
4 3769
5 1545
6 2319
6 2987
7 2834
7 3512
8 1257
8 2772
8 3424
8 3967
9 3831
10 510
11 698
11 4100
12 2612
12 3260
13 1699
...

output:

4
5000 2500
2 2088
3 1622
4 3769
5 1545
6 2319
7 2834
7 3512
9 3831
11 698
11 4100
12 2612
12 3260
13 1699
13 3374
14 3461
15 3787
16 1964
17 4274
20 4270
21 2320
22 621
23 2948
26 2841
27 560
27 4857
28 4115
31 1330
32 2552
33 4875
34 1606
34 3744
35 3878
35 4701
36 2394
36 3297
41 4754
42 1889
43 ...

input:

4
5000 2500
2 2088
3 1622
4 3769
5 1545
6 2319
7 2834
7 3512
9 3831
11 698
11 4100
12 2612
12 3260
13 1699
13 3374
14 3461
15 3787
16 1964
17 4274
20 4270
21 2320
22 621
23 2948
26 2841
27 560
27 4857
28 4115
31 1330
32 2552
33 4875
34 1606
34 3744
35 3878
35 4701
36 2394
36 3297
41 4754
42 1889
43 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

score: 30
Accepted
time: 171ms = 84ms + 87ms
memory: 3132kb,3052kb

input:

3
7892141

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 889
1 4387
2 3226
2 4412
3 1534
3 1916
3 3373
3 3901
4 1977
5 3815
6 2319
6 2987
6 4248
7 3512
8 1257
8 2055
8 2772
8 3424
9 3744
10 2457
11 52
11 698
12 424
13 3...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 889
1 4387
2 3226
2 4412
3 1534
3 1916
3 3373
3 3901
4 1977
5 3815
6 2319
6 2987
6 4248
7 3512
8 1257
8 2055
8 2772
8 3424
9 3744
10 2457
11 52
11 698
12 424
13 3...

output:

4
5000 2500
1 889
2 3226
2 4412
4 1977
5 3815
7 3512
9 3744
10 2457
11 52
11 698
13 3374
14 2949
15 2005
15 3787
16 1964
18 2408
20 3580
20 4270
21 2735
22 621
23 4316
24 2611
24 4254
26 2841
26 4481
27 4403
29 1877
30 2399
30 3326
32 2552
33 4792
34 3618
35 4701
36 3297
41 1912
43 4907
45 4756
48 3...

input:

4
5000 2500
1 889
2 3226
2 4412
4 1977
5 3815
7 3512
9 3744
10 2457
11 52
11 698
13 3374
14 2949
15 2005
15 3787
16 1964
18 2408
20 3580
20 4270
21 2735
22 621
23 4316
24 2611
24 4254
26 2841
26 4481
27 4403
29 1877
30 2399
30 3326
32 2552
33 4792
34 3618
35 4701
36 3297
41 1912
43 4907
45 4756
48 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

score: 30
Accepted
time: 156ms = 89ms + 67ms
memory: 3140kb,3056kb

input:

3
21314775

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 682
1 2930
2 4412
3 1916
3 4535
4 143
4 574
5 2542
5 3815
6 961
6 2319
7 2122
7 2834
8 1257
8 2772
8 3967
9 3831
10 510
11 52
12 3183
13 1699
13 2074
13 3374
14 2...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 682
1 2930
2 4412
3 1916
3 4535
4 143
4 574
5 2542
5 3815
6 961
6 2319
7 2122
7 2834
8 1257
8 2772
8 3967
9 3831
10 510
11 52
12 3183
13 1699
13 2074
13 3374
14 2...

output:

4
5000 2500
1 682
3 1916
3 4535
4 143
4 574
5 3815
6 961
6 2319
7 2122
7 2834
12 3183
16 1964
19 969
21 2198
21 2320
22 4926
23 4316
25 949
26 221
26 2841
29 1562
33 1717
34 1606
35 3878
35 4701
36 2304
36 2394
37 2347
37 4672
38 329
41 4050
44 4634
48 3773
48 4890
50 1794
50 2058
51 340
51 2884
57 ...

input:

4
5000 2500
1 682
3 1916
3 4535
4 143
4 574
5 3815
6 961
6 2319
7 2122
7 2834
12 3183
16 1964
19 969
21 2198
21 2320
22 4926
23 4316
25 949
26 221
26 2841
29 1562
33 1717
34 1606
35 3878
35 4701
36 2304
36 2394
37 2347
37 4672
38 329
41 4050
44 4634
48 3773
48 4890
50 1794
50 2058
51 340
51 2884
57 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

score: 30
Accepted
time: 186ms = 103ms + 83ms
memory: 3136kb,3052kb

input:

5
5559540

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2930
1 4714
2 3226
3 3373
3 3901
3 4214
3 4535
4 574
5 216
5 3815
6 2319
6 4248
7 2834
7 3512
8 1257
8 3177
8 3424
9 3831
9 4487
10 2457
11 2042
12 3183
13 1092
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2930
1 4714
2 3226
3 3373
3 3901
3 4214
3 4535
4 574
5 216
5 3815
6 2319
6 4248
7 2834
7 3512
8 1257
8 3177
8 3424
9 3831
9 4487
10 2457
11 2042
12 3183
13 1092
1...

output:

6
5000 2513
1 4714
3 3373
3 3901
3 4214
5 3815
6 2319
7 3512
8 3177
9 3831
11 2042
12 3183
13 1092
15 2005
18 2408
19 1186
20 3580
21 2320
23 3257
24 427
25 1381
26 2068
27 589
28 4296
31 2340
31 3621
33 321
34 1606
36 2065
36 2304
36 2394
36 3297
37 2347
40 216
41 962
42 2010
42 3852
43 430
44 1777...

input:

6
5000 2513
1 4714
3 3373
3 3901
3 4214
5 3815
6 2319
7 3512
8 3177
9 3831
11 2042
12 3183
13 1092
15 2005
18 2408
19 1186
20 3580
21 2320
23 3257
24 427
25 1381
26 2068
27 589
28 4296
31 2340
31 3621
33 321
34 1606
36 2065
36 2304
36 2394
36 3297
37 2347
40 216
41 962
42 2010
42 3852
43 430
44 1777...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

score: 30
Accepted
time: 174ms = 86ms + 88ms
memory: 3132kb,3052kb

input:

5
9424319

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 682
1 2930
2 1718
2 2088
3 1916
3 3373
3 4535
4 143
5 216
5 1545
5 3815
6 2319
6 3206
7 1721
7 3512
8 1257
8 2772
8 3967
9 3831
10 510
11 3125
12 3944
13 4692
14 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 682
1 2930
2 1718
2 2088
3 1916
3 3373
3 4535
4 143
5 216
5 1545
5 3815
6 2319
6 3206
7 1721
7 3512
8 1257
8 2772
8 3967
9 3831
10 510
11 3125
12 3944
13 4692
14 ...

output:

6
5000 2537
1 2930
2 1718
3 1916
3 3373
5 1545
5 3815
6 3206
7 3512
8 1257
8 3967
9 3831
11 3125
13 4692
14 2914
15 2107
16 1964
17 800
18 880
18 1713
18 2408
18 4263
19 586
20 4270
21 2735
22 3566
23 493
24 47
25 949
26 307
27 49
27 560
29 1822
29 1877
29 3611
30 2399
31 3621
34 1606
35 3878
36 979...

input:

6
5000 2537
1 2930
2 1718
3 1916
3 3373
5 1545
5 3815
6 3206
7 3512
8 1257
8 3967
9 3831
11 3125
13 4692
14 2914
15 2107
16 1964
17 800
18 880
18 1713
18 2408
18 4263
19 586
20 4270
21 2735
22 3566
23 493
24 47
25 949
26 307
27 49
27 560
29 1822
29 1877
29 3611
30 2399
31 3621
34 1606
35 3878
36 979...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

score: 30
Accepted
time: 177ms = 78ms + 99ms
memory: 3132kb,3056kb

input:

5
10955780

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 625
1 682
1 851
1 1298
1 4572
2 1718
2 2088
2 4412
3 1534
3 1916
3 3373
3 4535
4 143
5 1545
5 3815
6 2319
6 3206
7 2122
8 1257
8 1486
8 2055
8 2950
9 3143
10 972
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 625
1 682
1 851
1 1298
1 4572
2 1718
2 2088
2 4412
3 1534
3 1916
3 3373
3 4535
4 143
5 1545
5 3815
6 2319
6 3206
7 2122
8 1257
8 1486
8 2055
8 2950
9 3143
10 972
...

output:

6
5000 2520
1 1298
2 4412
3 1534
5 3815
6 3206
8 1257
8 1486
8 2950
9 3143
12 424
13 2291
14 1002
14 2949
15 3060
15 3787
16 3030
18 2088
19 969
20 4419
21 1940
22 1964
22 4346
23 4316
24 47
24 427
24 2611
24 4254
25 2513
26 307
27 589
28 2408
29 1822
31 1742
31 2340
32 4015
33 4875
34 1014
35 4753
...

input:

6
5000 2520
1 1298
2 4412
3 1534
5 3815
6 3206
8 1257
8 1486
8 2950
9 3143
12 424
13 2291
14 1002
14 2949
15 3060
15 3787
16 3030
18 2088
19 969
20 4419
21 1940
22 1964
22 4346
23 4316
24 47
24 427
24 2611
24 4254
25 2513
26 307
27 589
28 2408
29 1822
31 1742
31 2340
32 4015
33 4875
34 1014
35 4753
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
10955780

Test #22:

score: 30
Accepted
time: 173ms = 78ms + 95ms
memory: 3136kb,3048kb

input:

7
19938721

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 1172
1 4387
2 3226
2 4412
2 4871
3 1916
3 3901
4 1977
5 2542
6 2319
6 4248
7 1721
8 1257
8 2055
8 2772
9 3374
9 3744
10 1810
10 2457
11 52
11 3125
12 424
13 568
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 1172
1 4387
2 3226
2 4412
2 4871
3 1916
3 3901
4 1977
5 2542
6 2319
6 4248
7 1721
8 1257
8 2055
8 2772
9 3374
9 3744
10 1810
10 2457
11 52
11 3125
12 424
13 568
1...

output:

8
5000 2500
1 1172
2 3226
2 4412
3 1916
3 3901
4 1977
5 2542
6 2319
6 4248
7 1721
8 1257
10 1810
10 2457
11 52
11 3125
12 424
13 568
13 3036
14 2949
16 1964
17 152
17 800
18 2088
19 586
19 2257
20 2147
21 2735
22 2163
23 493
23 4316
26 2841
27 49
27 4857
28 373
28 679
28 4350
29 1562
31 825
33 4792
...

input:

8
5000 2500
1 1172
2 3226
2 4412
3 1916
3 3901
4 1977
5 2542
6 2319
6 4248
7 1721
8 1257
10 1810
10 2457
11 52
11 3125
12 424
13 568
13 3036
14 2949
16 1964
17 152
17 800
18 2088
19 586
19 2257
20 2147
21 2735
22 2163
23 493
23 4316
26 2841
27 49
27 4857
28 373
28 679
28 4350
29 1562
31 825
33 4792
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
19938721

Test #23:

score: 30
Accepted
time: 166ms = 83ms + 83ms
memory: 3132kb,3052kb

input:

7
5129508

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 625
1 3497
1 4960
2 4654
3 3373
3 3901
3 4535
4 3012
5 3815
5 4424
6 2319
6 2987
6 3206
7 1721
7 3512
8 1257
8 3424
9 3374
9 3744
9 4487
10 3368
11 698
11 3125
12...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 625
1 3497
1 4960
2 4654
3 3373
3 3901
3 4535
4 3012
5 3815
5 4424
6 2319
6 2987
6 3206
7 1721
7 3512
8 1257
8 3424
9 3374
9 3744
9 4487
10 3368
11 698
11 3125
12...

output:

8
5000 2500
1 625
1 4960
2 4654
3 3373
3 3901
4 3012
5 3815
5 4424
7 1721
8 1257
8 3424
9 4487
10 3368
11 698
11 3125
12 3944
13 2352
13 3374
15 2107
16 1863
18 880
19 586
19 1186
20 4270
21 2735
23 493
23 4026
27 589
29 1877
29 4329
30 3326
31 825
31 2618
31 3621
33 4366
34 3618
35 2144
37 4672
38 ...

input:

8
5000 2500
1 625
1 4960
2 4654
3 3373
3 3901
4 3012
5 3815
5 4424
7 1721
8 1257
8 3424
9 4487
10 3368
11 698
11 3125
12 3944
13 2352
13 3374
15 2107
16 1863
18 880
19 586
19 1186
20 4270
21 2735
23 493
23 4026
27 589
29 1877
29 4329
30 3326
31 825
31 2618
31 3621
33 4366
34 3618
35 2144
37 4672
38 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5129508

Test #24:

score: 30
Accepted
time: 182ms = 94ms + 88ms
memory: 3136kb,3052kb

input:

7
15332941

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 682
1 851
2 1718
2 2088
2 4412
3 3373
3 4214
4 143
4 574
5 216
5 1545
5 3815
6 2319
7 3512
8 1257
8 2055
8 2772
8 3424
9 4365
9 4487
10 4649
11 52
11 2042
12 424
...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 682
1 851
2 1718
2 2088
2 4412
3 3373
3 4214
4 143
4 574
5 216
5 1545
5 3815
6 2319
7 3512
8 1257
8 2055
8 2772
8 3424
9 4365
9 4487
10 4649
11 52
11 2042
12 424
...

output:

8
5000 2500
1 851
2 1718
2 2088
3 3373
3 4214
4 143
4 574
5 1545
5 3815
6 2319
7 3512
9 4365
9 4487
10 4649
11 52
11 2042
13 3374
14 2949
15 3787
16 1964
17 152
18 880
19 1186
20 4270
21 1940
23 2948
25 1381
26 2841
27 560
27 4403
27 4857
28 373
30 3326
31 2340
32 1574
33 1717
35 4701
36 4101
37 467...

input:

8
5000 2500
1 851
2 1718
2 2088
3 3373
3 4214
4 143
4 574
5 1545
5 3815
6 2319
7 3512
9 4365
9 4487
10 4649
11 52
11 2042
13 3374
14 2949
15 3787
16 1964
17 152
18 880
19 1186
20 4270
21 1940
23 2948
25 1381
26 2841
27 560
27 4403
27 4857
28 373
30 3326
31 2340
32 1574
33 1717
35 4701
36 4101
37 467...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
15332941

Subtask #3:

score: 65
Accepted

Test #25:

score: 65
Accepted
time: 167ms = 92ms + 75ms
memory: 3136kb,3080kb

input:

1
355365355024496523

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 682
2 1718
2 2088
2 3024
2 3595
3 4535
4 143
5 1545
6 2319
6 4248
7 1351
7 4326
8 1216
8 1853
8 3967
9 3374
10 1810
10 1813
11 52
11 168
11 3125
11 4328
12 664
12...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 682
2 1718
2 2088
2 3024
2 3595
3 4535
4 143
5 1545
6 2319
6 4248
7 1351
7 4326
8 1216
8 1853
8 3967
9 3374
10 1810
10 1813
11 52
11 168
11 3125
11 4328
12 664
12...

output:

2
5000 4435
1 682
2 2088
2 3024
2 3595
3 4535
4 143
6 2319
6 4248
7 1351
7 4326
8 1216
8 1853
8 3967
9 3374
10 1810
10 1813
11 52
11 168
11 3125
11 4328
12 664
12 1780
12 3745
12 4846
13 111
13 4537
14 406
14 2360
15 3122
15 4185
16 1964
17 3777
20 2198
21 750
22 2730
22 3287
22 3566
22 4346
23 4719...

input:

2
5000 4435
1 682
2 2088
2 3024
2 3595
3 4535
4 143
6 2319
6 4248
7 1351
7 4326
8 1216
8 1853
8 3967
9 3374
10 1810
10 1813
11 52
11 168
11 3125
11 4328
12 664
12 1780
12 3745
12 4846
13 111
13 4537
14 406
14 2360
15 3122
15 4185
16 1964
17 3777
20 2198
21 750
22 2730
22 3287
22 3566
22 4346
23 4719...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
355365355024496523

Test #26:

score: 65
Accepted
time: 161ms = 86ms + 75ms
memory: 3140kb,3080kb

input:

1
727827999106414164

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2930
2 1362
2 3595
3 171
3 4010
4 3604
5 3207
5 3815
6 2319
6 4248
6 4283
7 195
7 898
7 4326
8 2959
8 4335
9 1783
9 3831
10 4903
11 52
12 1780
12 3745
13 397
13 2...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 2930
2 1362
2 3595
3 171
3 4010
4 3604
5 3207
5 3815
6 2319
6 4248
6 4283
7 195
7 898
7 4326
8 2959
8 4335
9 1783
9 3831
10 4903
11 52
12 1780
12 3745
13 397
13 2...

output:

2
5000 4435
1 2930
2 3595
3 171
3 4010
4 3604
5 3207
6 2319
6 4248
6 4283
7 195
7 898
7 4326
8 2959
8 4335
9 1783
9 3831
10 4903
11 52
12 1780
12 3745
13 397
13 2445
14 1076
15 2107
16 1860
16 2830
17 1619
17 4274
18 4263
19 1186
19 1593
20 2198
22 2730
22 3566
22 4346
23 2976
24 2611
24 4254
25 949...

input:

2
5000 4435
1 2930
2 3595
3 171
3 4010
4 3604
5 3207
6 2319
6 4248
6 4283
7 195
7 898
7 4326
8 2959
8 4335
9 1783
9 3831
10 4903
11 52
12 1780
12 3745
13 397
13 2445
14 1076
15 2107
16 1860
16 2830
17 1619
17 4274
18 4263
19 1186
19 1593
20 2198
22 2730
22 3566
22 4346
23 2976
24 2611
24 4254
25 949...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
727827999106414164

Test #27:

score: 65
Accepted
time: 165ms = 87ms + 78ms
memory: 3140kb,3080kb

input:

1
656410143989222955

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 4387
2 3024
3 1916
4 1399
5 216
6 2319
6 3267
6 4248
6 4283
7 898
7 3512
8 815
8 1216
8 2959
8 3967
9 3744
10 1813
11 168
12 3745
12 4846
13 111
14 4074
15 4185
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 4387
2 3024
3 1916
4 1399
5 216
6 2319
6 3267
6 4248
6 4283
7 898
7 3512
8 815
8 1216
8 2959
8 3967
9 3744
10 1813
11 168
12 3745
12 4846
13 111
14 4074
15 4185
1...

output:

2
5000 4435
1 4387
3 1916
4 1399
5 216
6 2319
6 3267
6 4283
7 898
7 3512
8 815
8 1216
8 2959
8 3967
9 3744
10 1813
11 168
12 3745
12 4846
13 111
14 4074
15 4185
15 4952
16 1964
16 2830
17 3777
17 4274
18 2408
18 4218
19 1186
20 1283
20 2102
21 750
22 3287
23 4316
24 2289
25 213
25 949
26 2886
27 49
...

input:

2
5000 4435
1 4387
3 1916
4 1399
5 216
6 2319
6 3267
6 4283
7 898
7 3512
8 815
8 1216
8 2959
8 3967
9 3744
10 1813
11 168
12 3745
12 4846
13 111
14 4074
15 4185
15 4952
16 1964
16 2830
17 3777
17 4274
18 2408
18 4218
19 1186
20 1283
20 2102
21 750
22 3287
23 4316
24 2289
25 213
25 949
26 2886
27 49
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
656410143989222955

Test #28:

score: 65
Accepted
time: 168ms = 89ms + 79ms
memory: 3140kb,3088kb

input:

1
410366615149657534

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 585
2 1362
2 1718
2 2088
2 3595
2 4389
3 1916
3 4535
4 3604
5 1545
5 3815
6 2319
6 3267
7 195
7 898
7 4326
8 1216
8 3967
8 4335
9 902
10 510
11 52
11 3125
12 1591...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 585
2 1362
2 1718
2 2088
2 3595
2 4389
3 1916
3 4535
4 3604
5 1545
5 3815
6 2319
6 3267
7 195
7 898
7 4326
8 1216
8 3967
8 4335
9 902
10 510
11 52
11 3125
12 1591...

output:

2
5000 4435
1 585
2 1718
2 2088
2 3595
2 4389
3 1916
4 3604
5 1545
5 3815
6 2319
6 3267
7 195
7 898
7 4326
8 1216
8 3967
8 4335
9 902
10 510
11 52
11 3125
12 1591
12 1780
12 4645
13 4537
14 2798
14 4074
15 3122
16 1860
16 2079
17 152
18 294
19 969
19 1593
20 1283
20 2102
20 3958
20 4270
21 1940
21 2...

input:

2
5000 4435
1 585
2 1718
2 2088
2 3595
2 4389
3 1916
4 3604
5 1545
5 3815
6 2319
6 3267
7 195
7 898
7 4326
8 1216
8 3967
8 4335
9 902
10 510
11 52
11 3125
12 1591
12 1780
12 4645
13 4537
14 2798
14 4074
15 3122
16 1860
16 2079
17 152
18 294
19 969
19 1593
20 1283
20 2102
20 3958
20 4270
21 1940
21 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
410366615149657534

Test #29:

score: 65
Accepted
time: 161ms = 94ms + 67ms
memory: 3136kb,3064kb

input:

1
298090682780948428

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 682
1 4271
2 1362
2 3595
3 3373
3 4214
4 574
5 3815
6 1063
6 2319
7 195
8 1216
8 1257
8 4335
9 836
9 840
9 3374
10 2457
11 3125
12 1780
13 4537
14 406
14 2914
15 ...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
1
5000
1 682
1 4271
2 1362
2 3595
3 3373
3 4214
4 574
5 3815
6 1063
6 2319
7 195
8 1216
8 1257
8 4335
9 836
9 840
9 3374
10 2457
11 3125
12 1780
13 4537
14 406
14 2914
15 ...

output:

2
5000 2969
1 682
1 4271
3 3373
3 4214
4 574
6 2319
8 1216
8 4335
9 836
9 840
9 3374
10 2457
11 3125
12 1780
13 4537
14 406
14 2914
16 2830
18 880
19 1766
20 2198
21 750
22 2730
23 4719
24 47
25 1911
27 2490
27 4403
29 230
29 1684
29 1895
29 3021
30 2269
32 2726
33 3684
34 3744
35 2208
36 3868
37 23...

input:

2
5000 2969
1 682
1 4271
3 3373
3 4214
4 574
6 2319
8 1216
8 4335
9 836
9 840
9 3374
10 2457
11 3125
12 1780
13 4537
14 406
14 2914
16 2830
18 880
19 1766
20 2198
21 750
22 2730
23 4719
24 47
25 1911
27 2490
27 4403
29 230
29 1684
29 1895
29 3021
30 2269
32 2726
33 3684
34 3744
35 2208
36 3868
37 23...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
298090682780948428

Test #30:

score: 65
Accepted
time: 161ms = 87ms + 74ms
memory: 3132kb,3052kb

input:

3
969441916331132577

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 585
2 3024
2 3595
2 3938
2 4389
3 3773
4 3707
5 216
6 2319
6 4283
7 195
7 898
7 1351
8 1853
8 3688
8 4335
9 836
10 1813
11 168
11 4328
12 664
12 1591
12 1780
12 4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 585
2 3024
2 3595
2 3938
2 4389
3 3773
4 3707
5 216
6 2319
6 4283
7 195
7 898
7 1351
8 1853
8 3688
8 4335
9 836
10 1813
11 168
11 4328
12 664
12 1591
12 1780
12 4...

output:

4
5000 2500
3 3773
4 3707
6 2319
6 4283
11 4328
14 4074
15 2107
15 4185
17 4072
20 1283
20 4270
23 4719
24 2289
27 2640
31 4870
32 481
32 1574
35 821
35 2208
37 2347
38 735
38 3919
41 2965
43 1178
45 3158
45 3860
46 2662
47 1192
47 3866
49 214
54 4955
55 119
56 4424
58 1108
61 4876
62 1214
63 3469
6...

input:

4
5000 2500
3 3773
4 3707
6 2319
6 4283
11 4328
14 4074
15 2107
15 4185
17 4072
20 1283
20 4270
23 4719
24 2289
27 2640
31 4870
32 481
32 1574
35 821
35 2208
37 2347
38 735
38 3919
41 2965
43 1178
45 3158
45 3860
46 2662
47 1192
47 3866
49 214
54 4955
55 119
56 4424
58 1108
61 4876
62 1214
63 3469
6...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
969441916331132577

Test #31:

score: 65
Accepted
time: 148ms = 81ms + 67ms
memory: 3132kb,3048kb

input:

3
929489812741933634

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 682
2 1362
2 1718
2 2088
2 3024
2 3595
3 1916
4 658
5 216
5 1545
6 4248
6 4283
7 195
7 1351
7 2219
7 3512
8 815
8 1216
8 1853
8 3688
8 3967
8 4335
9 836
10 1813
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 682
2 1362
2 1718
2 2088
2 3024
2 3595
3 1916
4 658
5 216
5 1545
6 4248
6 4283
7 195
7 1351
7 2219
7 3512
8 815
8 1216
8 1853
8 3688
8 3967
8 4335
9 836
10 1813
1...

output:

4
5000 2500
5 216
5 1545
6 4283
9 836
11 4328
13 111
14 406
15 2107
15 3122
17 4072
17 4274
20 1283
21 69
23 1368
24 2541
27 49
27 2640
30 3057
30 3326
31 4870
33 3684
34 4020
36 3868
38 735
38 3919
41 2965
42 626
42 3164
44 1777
44 3635
48 2418
49 3164
50 474
51 2460
53 1405
53 2077
54 4955
55 119
...

input:

4
5000 2500
5 216
5 1545
6 4283
9 836
11 4328
13 111
14 406
15 2107
15 3122
17 4072
17 4274
20 1283
21 69
23 1368
24 2541
27 49
27 2640
30 3057
30 3326
31 4870
33 3684
34 4020
36 3868
38 735
38 3919
41 2965
42 626
42 3164
44 1777
44 3635
48 2418
49 3164
50 474
51 2460
53 1405
53 2077
54 4955
55 119
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
929489812741933634

Test #32:

score: 65
Accepted
time: 185ms = 99ms + 86ms
memory: 3132kb,3048kb

input:

3
144032041325838295

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 585
1 3581
2 1718
2 2088
2 3938
3 1916
4 658
5 1545
5 3815
6 2319
7 898
7 4326
8 815
8 1216
8 3967
9 902
10 1813
11 52
11 168
11 3125
12 1591
12 3745
12 4645
13 4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 585
1 3581
2 1718
2 2088
2 3938
3 1916
4 658
5 1545
5 3815
6 2319
7 898
7 4326
8 815
8 1216
8 3967
9 902
10 1813
11 52
11 168
11 3125
12 1591
12 3745
12 4645
13 4...

output:

4
5000 2500
1 585
1 3581
3 1916
4 658
5 1545
5 3815
6 2319
14 406
14 4074
15 4185
16 1964
17 4072
17 4274
18 294
19 1593
21 4730
22 1512
22 3287
23 493
23 4719
25 949
30 2399
32 2726
33 4239
34 3996
34 4361
35 4781
36 3868
37 2347
37 4672
39 1261
39 4724
41 604
41 1990
44 3635
45 327
45 4756
46 3387...

input:

4
5000 2500
1 585
1 3581
3 1916
4 658
5 1545
5 3815
6 2319
14 406
14 4074
15 4185
16 1964
17 4072
17 4274
18 294
19 1593
21 4730
22 1512
22 3287
23 493
23 4719
25 949
30 2399
32 2726
33 4239
34 3996
34 4361
35 4781
36 3868
37 2347
37 4672
39 1261
39 4724
41 604
41 1990
44 3635
45 327
45 4756
46 3387...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
144032041325838295

Test #33:

score: 65
Accepted
time: 178ms = 103ms + 75ms
memory: 3136kb,3048kb

input:

3
832110946250826180

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 4185
2 1718
2 2088
2 3024
2 3270
2 4412
3 4535
4 3604
5 1545
6 3206
6 4248
6 4283
7 195
7 3979
8 1853
8 4335
8 4474
9 902
9 1783
10 2457
11 52
11 168
11 3125
11 4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 4185
2 1718
2 2088
2 3024
2 3270
2 4412
3 4535
4 3604
5 1545
6 3206
6 4248
6 4283
7 195
7 3979
8 1853
8 4335
8 4474
9 902
9 1783
10 2457
11 52
11 168
11 3125
11 4...

output:

4
5000 2500
1 4185
3 4535
4 3604
5 1545
7 3979
9 902
9 1783
10 2457
13 397
14 4074
17 3777
21 1940
25 213
25 4268
26 307
27 4403
31 4870
35 821
36 631
36 979
37 2347
37 4672
38 735
38 2756
39 541
42 3582
43 1626
43 3008
44 3635
45 4756
47 3866
48 2418
49 3164
49 3664
50 1616
51 1985
52 658
53 594
55...

input:

4
5000 2500
1 4185
3 4535
4 3604
5 1545
7 3979
9 902
9 1783
10 2457
13 397
14 4074
17 3777
21 1940
25 213
25 4268
26 307
27 4403
31 4870
35 821
36 631
36 979
37 2347
37 4672
38 735
38 2756
39 541
42 3582
43 1626
43 3008
44 3635
45 4756
47 3866
48 2418
49 3164
49 3664
50 1616
51 1985
52 658
53 594
55...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
832110946250826180

Test #34:

score: 65
Accepted
time: 156ms = 76ms + 80ms
memory: 3132kb,3052kb

input:

3
85728715707691821

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 3581
2 1718
2 2088
3 3773
3 4535
4 658
5 1545
5 3815
6 3206
7 898
7 3979
7 4326
8 1216
8 1853
8 2959
9 3744
10 3429
11 52
11 3125
11 4328
12 664
13 397
13 4537
14...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
3
5000
1 3581
2 1718
2 2088
3 3773
3 4535
4 658
5 1545
5 3815
6 3206
7 898
7 3979
7 4326
8 1216
8 1853
8 2959
9 3744
10 3429
11 52
11 3125
11 4328
12 664
13 397
13 4537
14...

output:

4
5000 2500
2 1718
2 2088
3 3773
4 658
5 3815
10 3429
13 397
13 4537
14 4074
15 2107
17 4274
23 4719
25 1911
26 307
32 1574
33 4239
34 4361
36 3868
38 735
39 1008
41 1759
42 2010
44 1781
47 4987
48 2418
49 1406
55 119
55 620
57 2082
58 2406
59 2371
60 3524
61 3436
62 962
62 3304
63 3469
64 4573
65 2...

input:

4
5000 2500
2 1718
2 2088
3 3773
4 658
5 3815
10 3429
13 397
13 4537
14 4074
15 2107
17 4274
23 4719
25 1911
26 307
32 1574
33 4239
34 4361
36 3868
38 735
39 1008
41 1759
42 2010
44 1781
47 4987
48 2418
49 1406
55 119
55 620
57 2082
58 2406
59 2371
60 3524
61 3436
62 962
62 3304
63 3469
64 4573
65 2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
85728715707691821

Test #35:

score: 65
Accepted
time: 168ms = 81ms + 87ms
memory: 3140kb,3052kb

input:

5
777434612360931036

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 682
2 1718
2 2088
2 2869
2 3024
3 4535
4 574
5 1545
5 3207
6 2319
6 4248
6 4283
7 195
7 1351
7 3512
8 4335
9 902
9 1783
9 4365
10 2457
11 52
12 3745
13 111
14 406...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 682
2 1718
2 2088
2 2869
2 3024
3 4535
4 574
5 1545
5 3207
6 2319
6 4248
6 4283
7 195
7 1351
7 3512
8 4335
9 902
9 1783
9 4365
10 2457
11 52
12 3745
13 111
14 406...

output:

6
5000 2509
1 682
2 1718
3 4535
5 1545
6 2319
6 4283
7 195
7 3512
8 4335
9 1783
9 4365
10 2457
11 52
12 3745
13 111
15 4952
17 1619
18 880
19 1186
20 1283
21 750
22 2730
23 2948
24 47
24 4254
25 949
26 3012
28 4296
29 1684
29 1822
29 1877
29 1895
29 3021
29 3611
31 4870
32 481
33 1717
34 3996
35 387...

input:

6
5000 2509
1 682
2 1718
3 4535
5 1545
6 2319
6 4283
7 195
7 3512
8 4335
9 1783
9 4365
10 2457
11 52
12 3745
13 111
15 4952
17 1619
18 880
19 1186
20 1283
21 750
22 2730
23 2948
24 47
24 4254
25 949
26 3012
28 4296
29 1684
29 1822
29 1877
29 1895
29 3021
29 3611
31 4870
32 481
33 1717
34 3996
35 387...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
777434612360931036

Test #36:

score: 65
Accepted
time: 166ms = 83ms + 83ms
memory: 3136kb,3052kb

input:

5
705262511549880222

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2930
2 3938
2 4237
3 171
3 4535
4 658
4 1399
5 216
5 3815
6 2319
6 3267
6 4248
6 4283
7 1351
7 4326
8 1216
8 3967
9 3831
10 510
11 3125
12 3745
13 3203
14 4074
15...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 2930
2 3938
2 4237
3 171
3 4535
4 658
4 1399
5 216
5 3815
6 2319
6 3267
6 4248
6 4283
7 1351
7 4326
8 1216
8 3967
9 3831
10 510
11 3125
12 3745
13 3203
14 4074
15...

output:

6
5000 2500
1 2930
2 3938
3 4535
4 1399
5 3815
6 4248
7 1351
8 1216
11 3125
13 3203
14 4074
15 3787
17 4274
19 1593
20 1283
23 2976
25 1381
26 1341
27 4403
28 1261
29 1365
32 1574
34 4361
35 4781
36 2394
37 4672
39 3638
40 4795
41 604
42 1889
43 362
43 430
43 1585
43 1626
43 3008
45 4982
46 451
47 3...

input:

6
5000 2500
1 2930
2 3938
3 4535
4 1399
5 3815
6 4248
7 1351
8 1216
11 3125
13 3203
14 4074
15 3787
17 4274
19 1593
20 1283
23 2976
25 1381
26 1341
27 4403
28 1261
29 1365
32 1574
34 4361
35 4781
36 2394
37 4672
39 3638
40 4795
41 604
42 1889
43 362
43 430
43 1585
43 1626
43 3008
45 4982
46 451
47 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
705262511549880222

Test #37:

score: 65
Accepted
time: 162ms = 82ms + 80ms
memory: 3140kb,3048kb

input:

5
510318082834167951

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 682
2 1362
2 1718
2 2088
2 3595
3 1916
4 2087
5 1545
5 3815
6 2987
7 195
7 898
7 3512
8 3967
8 4335
8 4474
9 902
9 1783
10 510
11 52
11 168
12 1780
12 4846
13 397...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 682
2 1362
2 1718
2 2088
2 3595
3 1916
4 2087
5 1545
5 3815
6 2987
7 195
7 898
7 3512
8 3967
8 4335
8 4474
9 902
9 1783
10 510
11 52
11 168
12 1780
12 4846
13 397...

output:

6
5000 2506
2 3595
3 1916
5 3815
6 2987
7 898
7 3512
8 3967
8 4474
9 902
10 510
11 168
12 4846
13 397
14 4074
15 4952
16 453
16 2079
16 2830
17 3777
18 4218
20 1283
21 750
22 2730
24 2289
24 2541
24 4254
25 1381
26 1341
29 3021
30 2399
30 3057
31 533
32 2364
33 4573
34 4020
35 4781
36 2394
37 4672
3...

input:

6
5000 2506
2 3595
3 1916
5 3815
6 2987
7 898
7 3512
8 3967
8 4474
9 902
10 510
11 168
12 4846
13 397
14 4074
15 4952
16 453
16 2079
16 2830
17 3777
18 4218
20 1283
21 750
22 2730
24 2289
24 2541
24 4254
25 1381
26 1341
29 3021
30 2399
30 3057
31 533
32 2364
33 4573
34 4020
35 4781
36 2394
37 4672
3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
510318082834167951

Test #38:

score: 65
Accepted
time: 162ms = 87ms + 75ms
memory: 3136kb,3048kb

input:

5
914858813253258744

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 585
1 2930
2 1718
2 2088
2 3024
2 3595
3 1916
4 658
5 1545
6 3267
6 4248
6 4283
7 898
8 1216
8 1853
8 3688
9 3831
10 1813
11 3125
11 4328
12 664
12 1780
12 4645
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 585
1 2930
2 1718
2 2088
2 3024
2 3595
3 1916
4 658
5 1545
6 3267
6 4248
6 4283
7 898
8 1216
8 1853
8 3688
9 3831
10 1813
11 3125
11 4328
12 664
12 1780
12 4645
1...

output:

6
5000 2520
1 585
2 3024
3 1916
4 658
6 3267
6 4248
7 898
8 1216
8 3688
9 3831
11 3125
12 1780
13 111
13 397
14 2360
15 4185
16 2079
18 294
19 586
22 1512
24 2541
25 213
25 949
26 4962
27 2640
29 230
29 1365
29 1684
29 1877
29 1895
30 3057
31 4870
32 1574
32 4959
34 3996
35 3878
36 3868
37 319
38 39...

input:

6
5000 2520
1 585
2 3024
3 1916
4 658
6 3267
6 4248
7 898
8 1216
8 3688
9 3831
11 3125
12 1780
13 111
13 397
14 2360
15 4185
16 2079
18 294
19 586
22 1512
24 2541
25 213
25 949
26 4962
27 2640
29 230
29 1365
29 1684
29 1877
29 1895
30 3057
31 4870
32 1574
32 4959
34 3996
35 3878
36 3868
37 319
38 39...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
914858813253258744

Test #39:

score: 65
Accepted
time: 158ms = 67ms + 91ms
memory: 3140kb,3056kb

input:

5
659635316746638238

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 585
2 1718
2 2088
2 3595
3 4535
4 658
4 3604
5 1545
5 3815
6 3267
6 4248
6 4283
7 195
7 3512
8 815
8 1216
8 1853
8 2055
8 3688
9 836
10 1813
11 168
11 3125
11 432...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
5
5000
1 585
2 1718
2 2088
2 3595
3 4535
4 658
4 3604
5 1545
5 3815
6 3267
6 4248
6 4283
7 195
7 3512
8 815
8 1216
8 1853
8 2055
8 3688
9 836
10 1813
11 168
11 3125
11 432...

output:

6
5000 2509
1 585
2 1718
2 3595
4 3604
5 1545
6 4248
7 3512
8 1853
9 836
10 1813
11 3125
12 664
12 4645
13 4537
14 406
15 4185
16 1860
17 4072
20 2102
21 750
22 1512
22 3287
23 2976
24 2541
25 1911
28 3126
29 3021
30 3057
32 4959
34 4020
35 821
37 4672
39 1261
39 1521
40 1260
40 4414
40 4795
41 604
...

input:

6
5000 2509
1 585
2 1718
2 3595
4 3604
5 1545
6 4248
7 3512
8 1853
9 836
10 1813
11 3125
12 664
12 4645
13 4537
14 406
15 4185
16 1860
17 4072
20 2102
21 750
22 1512
22 3287
23 2976
24 2541
25 1911
28 3126
29 3021
30 3057
32 4959
34 4020
35 821
37 4672
39 1261
39 1521
40 1260
40 4414
40 4795
41 604
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659635316746638238

Test #40:

score: 65
Accepted
time: 165ms = 82ms + 83ms
memory: 3132kb,3048kb

input:

7
858490260563149759

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 682
2 1718
2 2088
3 3773
3 4535
4 658
5 1545
5 3815
6 3267
6 4248
6 4283
7 195
7 3512
7 4326
8 1216
8 1853
9 1783
10 1813
11 3125
11 4328
12 664
12 1591
12 3745
1...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 682
2 1718
2 2088
3 3773
3 4535
4 658
5 1545
5 3815
6 3267
6 4248
6 4283
7 195
7 3512
7 4326
8 1216
8 1853
9 1783
10 1813
11 3125
11 4328
12 664
12 1591
12 3745
1...

output:

8
5000 2500
2 1718
2 2088
3 3773
3 4535
4 658
5 1545
5 3815
6 3267
6 4283
7 3512
7 4326
8 1216
8 1853
9 1783
11 3125
11 4328
14 4074
15 2107
16 1964
17 4274
18 294
18 2408
19 586
20 2102
22 1512
23 4719
24 47
24 2289
24 2541
25 1911
27 4403
28 1261
28 3488
29 1365
29 1562
30 3057
30 3326
31 825
32 1...

input:

8
5000 2500
2 1718
2 2088
3 3773
3 4535
4 658
5 1545
5 3815
6 3267
6 4283
7 3512
7 4326
8 1216
8 1853
9 1783
11 3125
11 4328
14 4074
15 2107
16 1964
17 4274
18 294
18 2408
19 586
20 2102
22 1512
23 4719
24 47
24 2289
24 2541
25 1911
27 4403
28 1261
28 3488
29 1365
29 1562
30 3057
30 3326
31 825
32 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
858490260563149759

Test #41:

score: 65
Accepted
time: 165ms = 82ms + 83ms
memory: 3132kb,3052kb

input:

7
860058643727731209

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 682
2 115
2 1362
2 3595
3 4535
4 143
5 3207
6 3267
6 4283
7 195
7 1351
7 3512
7 4326
8 815
8 4335
8 4474
9 840
9 1783
10 1810
11 168
12 1780
12 3745
12 4846
13 45...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 682
2 115
2 1362
2 3595
3 4535
4 143
5 3207
6 3267
6 4283
7 195
7 1351
7 3512
7 4326
8 815
8 4335
8 4474
9 840
9 1783
10 1810
11 168
12 1780
12 3745
12 4846
13 45...

output:

8
5000 2500
1 682
2 115
2 1362
3 4535
6 3267
6 4283
8 815
8 4474
9 840
10 1810
11 168
12 1780
12 3745
13 4537
14 4074
15 3122
15 4185
16 1964
18 4332
20 4720
21 750
22 2730
22 3287
23 4719
24 2289
25 1911
26 3012
28 2782
28 3488
29 1562
29 3021
30 3057
33 4239
34 3996
35 4701
35 4781
36 3868
37 3949...

input:

8
5000 2500
1 682
2 115
2 1362
3 4535
6 3267
6 4283
8 815
8 4474
9 840
10 1810
11 168
12 1780
12 3745
13 4537
14 4074
15 3122
15 4185
16 1964
18 4332
20 4720
21 750
22 2730
22 3287
23 4719
24 2289
25 1911
26 3012
28 2782
28 3488
29 1562
29 3021
30 3057
33 4239
34 3996
35 4701
35 4781
36 3868
37 3949...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
860058643727731209

Test #42:

score: 65
Accepted
time: 173ms = 89ms + 84ms
memory: 3132kb,3048kb

input:

7
718861404514377808

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 585
1 682
1 3581
2 1718
2 2088
3 4214
4 3604
5 1545
6 3267
6 4248
6 4283
7 195
7 898
7 1351
7 3512
7 4326
8 1216
8 4335
9 3831
10 4903
11 52
12 1591
12 3745
12 46...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 585
1 682
1 3581
2 1718
2 2088
3 4214
4 3604
5 1545
6 3267
6 4248
6 4283
7 195
7 898
7 1351
7 3512
7 4326
8 1216
8 4335
9 3831
10 4903
11 52
12 1591
12 3745
12 46...

output:

8
5000 2500
2 1718
2 2088
3 4214
6 3267
8 1216
8 4335
10 4903
11 52
12 1591
12 3745
12 4645
13 4537
14 4074
15 3122
16 1886
17 1619
18 294
18 4263
20 4720
21 750
25 2348
26 1341
27 2490
28 4296
31 639
32 481
32 1972
33 4239
33 4875
34 1606
34 3996
35 4781
36 631
36 3868
38 2291
39 4724
40 208
40 300...

input:

8
5000 2500
2 1718
2 2088
3 4214
6 3267
8 1216
8 4335
10 4903
11 52
12 1591
12 3745
12 4645
13 4537
14 4074
15 3122
16 1886
17 1619
18 294
18 4263
20 4720
21 750
25 2348
26 1341
27 2490
28 4296
31 639
32 481
32 1972
33 4239
33 4875
34 1606
34 3996
35 4781
36 631
36 3868
38 2291
39 4724
40 208
40 300...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
718861404514377808

Test #43:

score: 65
Accepted
time: 165ms = 90ms + 75ms
memory: 3132kb,3056kb

input:

7
659192688464047828

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 682
2 4237
2 4389
2 4412
3 1916
3 4535
4 3604
5 3815
6 2319
6 3267
6 4283
7 195
7 4326
8 1216
8 4335
9 902
10 1813
11 52
11 168
12 1591
12 4645
12 4846
13 4537
14...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 682
2 4237
2 4389
2 4412
3 1916
3 4535
4 3604
5 3815
6 2319
6 3267
6 4283
7 195
7 4326
8 1216
8 4335
9 902
10 1813
11 52
11 168
12 1591
12 4645
12 4846
13 4537
14...

output:

8
5000 2500
2 4237
2 4389
3 1916
3 4535
4 3604
5 3815
6 3267
7 4326
8 1216
9 902
11 52
11 168
12 4645
14 4074
17 4072
19 1186
19 1593
20 2102
20 3958
20 4270
21 1940
23 4719
26 1341
26 4414
27 4403
30 1656
30 3326
32 481
33 4239
34 4361
35 4281
35 4781
36 631
36 3868
37 4672
38 735
39 1521
39 4724
4...

input:

8
5000 2500
2 4237
2 4389
3 1916
3 4535
4 3604
5 3815
6 3267
7 4326
8 1216
9 902
11 52
11 168
12 4645
14 4074
17 4072
19 1186
19 1593
20 2102
20 3958
20 4270
21 1940
23 4719
26 1341
26 4414
27 4403
30 1656
30 3326
32 481
33 4239
34 4361
35 4281
35 4781
36 631
36 3868
37 4672
38 735
39 1521
39 4724
4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659192688464047828

Test #44:

score: 65
Accepted
time: 155ms = 100ms + 55ms
memory: 3136kb,3056kb

input:

7
685730986714800201

output:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 585
1 682
2 115
2 1718
2 2088
2 4412
3 4010
3 4535
4 143
4 658
4 2087
5 1545
6 4248
6 4283
7 195
8 815
8 1216
8 2772
8 4335
9 836
10 555
11 52
11 168
12 1591
12 4...

input:

a890c6696058af3ad84e267191c856938f206a8ef7c63581510cdfa15e45f9c07d82b6a58fe3c8183e2b8f4b976dd90fbca50f420ce3dcf29a3d6a73adf47022
7
5000
1 585
1 682
2 115
2 1718
2 2088
2 4412
3 4010
3 4535
4 143
4 658
4 2087
5 1545
6 4248
6 4283
7 195
8 815
8 1216
8 2772
8 4335
9 836
10 555
11 52
11 168
12 1591
12 4...

output:

8
5000 2500
1 585
3 4010
4 143
4 2087
5 1545
6 4248
9 836
11 52
11 168
12 1591
12 4645
12 4846
13 397
14 4074
15 3122
16 1964
16 4579
17 4832
18 294
19 1147
20 3580
20 4270
21 750
22 1512
22 2730
22 3287
23 575
25 4236
27 2490
28 4296
30 3057
32 481
33 1717
34 4020
34 4519
35 2208
38 2291
39 1261
39...

input:

8
5000 2500
1 585
3 4010
4 143
4 2087
5 1545
6 4248
9 836
11 52
11 168
12 1591
12 4645
12 4846
13 397
14 4074
15 3122
16 1964
16 4579
17 4832
18 294
19 1147
20 3580
20 4270
21 750
22 1512
22 2730
22 3287
23 575
25 4236
27 2490
28 4296
30 3057
32 481
33 1717
34 4020
34 4519
35 2208
38 2291
39 1261
39...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
685730986714800201