QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#488008#8726. Magic Show_FJqwq100 ✓2ms1900kbC++141.3kb2024-07-23 14:50:432024-07-23 14:50:44

Judging History

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

  • [2024-07-23 14:50:44]
  • 评测
  • 测评结果:100
  • 用时:2ms
  • 内存:1900kb
  • [2024-07-23 14:50:43]
  • 提交

Alice

#include<bits/stdc++.h>
#include"Alice.h"
using namespace std;
#define ll long long
const int N=5005;
int n=5000,b[N],p[N],tot;
std::vector<std::pair<int, int>>v;
std::vector<std::pair<int, int>> Alice(){
	b[1]=1;
	for(int i=2;i<=n;i++){
		if(!b[i]) p[++tot]=i;
		for(int j=1;j<=tot&&i*p[j]<=n;j++){
			b[i*p[j]]=1;
			if(!(i%p[j])) break;
		}
	}
	p[++tot]=1;
	sort(p+1,p+tot+1);
	for(int i=2;i<=n;i++)
		for(int j=tot;j>=1;j--)
			if(p[j]<i){
				b[i]=p[j];
				break;
			}
	ll res=setN(n);
	for(int i=2;i<=n;i++)
		v.push_back(std::make_pair(i,res%b[i]+1));
	return v;
}



Bob

#include<bits/stdc++.h>
#include"Bob.h"
using namespace std;
#define ll long long
const ll N=5005,inf=2e18;
ll n=5000,b[N],p[N],tot;
ll g=1,h=0;
ll qwq(ll x,ll y){
	ll t=__gcd(x,y);
	x/=t;
	if(inf/x<=y) return inf;
	return x*y;
}
ll Bob(std::vector<std::pair<int, int>> V){
	b[1]=1;
	for(int i=2;i<=n;i++){
		if(!b[i]) p[++tot]=i;
		for(int j=1;j<=tot&&i*p[j]<=n;j++){
			b[i*p[j]]=1;
			if(!(i%p[j])) break;
		}
	}
	p[++tot]=1;
	sort(p+1,p+tot+1);
	for(int i=2;i<=n;i++)
		for(int j=tot;j>=1;j--)
			if(p[j]<i){
				b[i]=p[j];
				break;
			}
	for(std::pair<int, int> e:V){
		ll x=e.first,y=e.second;
		if(x<y) swap(x,y);
		x=b[x];y--;
		while(h%x!=y) h+=g;
		g=qwq(g,x);
	}
	return h;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1876kb

input:

1
4005

output:

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

input:

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

output:

2
5000 3717
1 2
1 4
1 5
1 6
1 7
1 90
1 91
1 94
1 95
1 96
1 97
2 3
2 8
2 10
2 11
2 12
2 13
2 14
2 15
2 16
3 4004
3 4005
3 4007
4 24
4 25
4 27
4 29
4 31
5 4002
5 4003
7 33
7 34
7 35
7 37
7 44
7 45
7 46
7 47
8 2000
8 2001
8 2002
8 2003
9 573
9 574
9 575
9 577
10 38
10 39
10 40
10 41
11 19
11 48
11 49
1...

input:

2
5000 3717
1 2
1 4
1 5
1 6
1 7
1 90
1 91
1 94
1 95
1 96
1 97
2 3
2 8
2 10
2 11
2 12
2 13
2 14
2 15
2 16
3 4004
3 4005
3 4007
4 24
4 25
4 27
4 29
4 31
5 4002
5 4003
7 33
7 34
7 35
7 37
7 44
7 45
7 46
7 47
8 2000
8 2001
8 2002
8 2003
9 573
9 574
9 575
9 577
10 38
10 39
10 40
10 41
11 19
11 48
11 49
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1868kb

input:

1
459

output:

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

input:

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

output:

2
5000 3717
1 2
1 4
1 5
1 19
2 3
2 230
2 232
2 233
3 458
3 459
4 20
4 22
4 23
5 6
5 7
5 8
5 10
5 11
5 14
5 15
5 16
6 228
6 229
7 152
7 153
7 154
7 155
7 156
8 114
8 115
8 116
8 117
8 119
8 120
8 121
8 122
8 124
8 125
8 126
8 127
9 12
9 13
11 450
11 451
11 452
11 454
11 455
11 457
14 224
14 226
15 90...

input:

2
5000 3717
1 2
1 4
1 5
1 19
2 3
2 230
2 232
2 233
3 458
3 459
4 20
4 22
4 23
5 6
5 7
5 8
5 10
5 11
5 14
5 15
5 16
6 228
6 229
7 152
7 153
7 154
7 155
7 156
8 114
8 115
8 116
8 117
8 119
8 120
8 121
8 122
8 124
8 125
8 126
8 127
9 12
9 13
11 450
11 451
11 452
11 454
11 455
11 457
14 224
14 226
15 90...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1872kb

input:

1
2495

output:

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

input:

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

output:

2
5000 3717
1 2
1 6
1 7
1 500
1 501
1 502
1 503
2 3
2 31
2 44
2 45
2 46
2 47
3 4
3 5
3 281
4 8
4 10
4 11
4 90
4 91
4 94
4 95
4 96
4 97
5 48
5 49
5 50
5 51
5 53
5 54
5 55
5 56
5 57
5 59
6 84
6 85
6 86
6 87
6 88
6 89
7 20
7 22
7 23
7 132
7 134
7 135
7 137
8 312
8 313
9 830
9 831
9 833
9 834
9 835
9 83...

input:

2
5000 3717
1 2
1 6
1 7
1 500
1 501
1 502
1 503
2 3
2 31
2 44
2 45
2 46
2 47
3 4
3 5
3 281
4 8
4 10
4 11
4 90
4 91
4 94
4 95
4 96
4 97
5 48
5 49
5 50
5 51
5 53
5 54
5 55
5 56
5 57
5 59
6 84
6 85
6 86
6 87
6 88
6 89
7 20
7 22
7 23
7 132
7 134
7 135
7 137
8 312
8 313
9 830
9 831
9 833
9 834
9 835
9 83...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1864kb

input:

3
1560

output:

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

input:

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

output:

4
5000 3433
2 1561
1561 1568
1561 1569
1561 1570
1561 1571
1561 1572
1561 1573
1561 1574
1561 1575
1561 1576
1561 1577
1561 1578
1561 1579
1561 1580
1561 1581
1561 1582
1561 1583
1561 1584
1561 1585
1561 1586
1561 1587
1561 1588
1561 1589
1561 1590
1561 1591
1561 1592
1561 1593
1561 1594
1561 1595
1...

input:

4
5000 3433
2 1561
1561 1568
1561 1569
1561 1570
1561 1571
1561 1572
1561 1573
1561 1574
1561 1575
1561 1576
1561 1577
1561 1578
1561 1579
1561 1580
1561 1581
1561 1582
1561 1583
1561 1584
1561 1585
1561 1586
1561 1587
1561 1588
1561 1589
1561 1590
1561 1591
1561 1592
1561 1593
1561 1594
1561 1595
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

3
3594

output:

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

input:

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

output:

4
5000 2500
1 600
1 601
2 3595
10 240
10 241
14 3582
14 3583
15 181
19 150
19 151
21 1788
21 1789
22 398
22 399
22 400
22 401
27 224
27 226
28 31
28 42
28 43
29 1785
29 1786
29 1787
33 138
33 139
38 3558
38 3559
39 128
39 130
39 131
40 80
40 81
40 83
45 72
45 73
49 198
55 60
55 61
56 3540
56 3541
60...

input:

4
5000 2500
1 600
1 601
2 3595
10 240
10 241
14 3582
14 3583
15 181
19 150
19 151
21 1788
21 1789
22 398
22 399
22 400
22 401
27 224
27 226
28 31
28 42
28 43
29 1785
29 1786
29 1787
33 138
33 139
38 3558
38 3559
39 128
39 130
39 131
40 80
40 81
40 83
45 72
45 73
49 198
55 60
55 61
56 3540
56 3541
60...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1864kb

input:

3
1750

output:

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

input:

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

output:

4
5000 3247
4 1751
1751 1754
1751 1755
1751 1756
1751 1757
1751 1758
1751 1759
1751 1760
1751 1761
1751 1762
1751 1763
1751 1764
1751 1765
1751 1766
1751 1767
1751 1768
1751 1769
1751 1770
1751 1771
1751 1772
1751 1773
1751 1774
1751 1775
1751 1776
1751 1777
1751 1778
1751 1779
1751 1780
1751 1781
1...

input:

4
5000 3247
4 1751
1751 1754
1751 1755
1751 1756
1751 1757
1751 1758
1751 1759
1751 1760
1751 1761
1751 1762
1751 1763
1751 1764
1751 1765
1751 1766
1751 1767
1751 1768
1751 1769
1751 1770
1751 1771
1751 1772
1751 1773
1751 1774
1751 1775
1751 1776
1751 1777
1751 1778
1751 1779
1751 1780
1751 1781
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1750

Test #7:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1848kb

input:

5
4878

output:

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

input:

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

output:

6
5000 2540
1 2
1 3
1 5
1 272
1 273
1 274
1 275
1 276
1 277
4 17
6 12
6 13
6 444
6 445
6 446
6 447
6 448
6 449
7 8
7 9
7 10
7 11
7 30
7 31
14 140
14 141
14 142
14 143
14 144
14 145
14 146
14 147
14 148
14 149
15 20
15 21
15 22
15 23
16 1622
16 1623
16 1624
16 1625
16 1626
16 1627
17 18
24 972
24 973...

input:

6
5000 2540
1 2
1 3
1 5
1 272
1 273
1 274
1 275
1 276
1 277
4 17
6 12
6 13
6 444
6 445
6 446
6 447
6 448
6 449
7 8
7 9
7 10
7 11
7 30
7 31
14 140
14 141
14 142
14 143
14 144
14 145
14 146
14 147
14 148
14 149
15 20
15 21
15 22
15 23
16 1622
16 1623
16 1624
16 1625
16 1626
16 1627
17 18
24 972
24 973...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4878

Test #8:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1884kb

input:

5
1223

output:

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

input:

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

output:

6
5000 4443
1 2
2 14
2 15
2 16
2 17
2 48
2 49
2 50
2 51
2 52
2 53
3 4
4 7
4 62
4 63
4 64
4 65
4 66
4 67
5 24
5 25
5 26
5 27
5 28
5 29
5 54
5 55
5 56
5 57
5 58
5 59
6 9
8 20
8 21
8 22
8 23
10 608
10 609
10 610
10 611
10 612
10 613
11 1214
11 1215
11 1216
11 1217
12 102
12 103
13 174
13 175
13 176
13 ...

input:

6
5000 4443
1 2
2 14
2 15
2 16
2 17
2 48
2 49
2 50
2 51
2 52
2 53
3 4
4 7
4 62
4 63
4 64
4 65
4 66
4 67
5 24
5 25
5 26
5 27
5 28
5 29
5 54
5 55
5 56
5 57
5 58
5 59
6 9
8 20
8 21
8 22
8 23
10 608
10 609
10 610
10 611
10 612
10 613
11 1214
11 1215
11 1216
11 1217
12 102
12 103
13 174
13 175
13 176
13 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1223

Test #9:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1888kb

input:

5
648

output:

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

input:

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

output:

6
5000 4643
1 2
1 3
1 4
5 9
6 644
6 645
6 646
6 647
7 108
7 109
8 642
8 643
10 72
10 73
11 12
11 13
11 30
11 31
14 128
14 129
14 130
14 131
15 318
15 319
15 320
15 321
15 322
15 323
15 324
15 325
15 326
15 327
15 328
15 329
15 330
15 331
16 212
16 213
16 214
16 215
16 216
16 217
16 218
16 219
16 220...

input:

6
5000 4643
1 2
1 3
1 4
5 9
6 644
6 645
6 646
6 647
7 108
7 109
8 642
8 643
10 72
10 73
11 12
11 13
11 30
11 31
14 128
14 129
14 130
14 131
15 318
15 319
15 320
15 321
15 322
15 323
15 324
15 325
15 326
15 327
15 328
15 329
15 330
15 331
16 212
16 213
16 214
16 215
16 216
16 217
16 218
16 219
16 220...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
648

Test #10:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1892kb,1852kb

input:

7
4475

output:

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

input:

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

output:

8
5000 2500
3 73
4 17
5 264
5 267
7 43
7 110
7 111
8 1118
8 1119
8 1120
8 1121
8 1122
8 1123
11 21
11 48
14 101
18 744
18 747
18 750
18 751
19 4458
19 4459
19 4460
19 4461
19 4462
19 4463
20 560
20 561
20 562
20 563
22 133
22 136
23 66
23 74
23 76
24 56
24 58
25 4452
25 4453
25 4454
25 4455
25 4456
...

input:

8
5000 2500
3 73
4 17
5 264
5 267
7 43
7 110
7 111
8 1118
8 1119
8 1120
8 1121
8 1122
8 1123
11 21
11 48
14 101
18 744
18 747
18 750
18 751
19 4458
19 4459
19 4460
19 4461
19 4462
19 4463
20 560
20 561
20 562
20 563
22 133
22 136
23 66
23 74
23 76
24 56
24 58
25 4452
25 4453
25 4454
25 4455
25 4456
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4475

Test #11:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1852kb

input:

7
4240

output:

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

input:

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

output:

8
5000 2500
5 354
5 355
5 356
5 358
9 29
10 4232
10 4233
10 4234
10 4235
10 4236
10 4237
10 4238
10 4239
10 4240
13 152
13 153
13 154
13 156
18 42
18 105
18 107
21 212
21 213
21 215
21 216
21 218
21 221
21 223
22 4220
22 4221
22 4222
22 4223
22 4224
22 4225
22 4226
22 4227
22 4228
22 4229
25 36
28 3...

input:

8
5000 2500
5 354
5 355
5 356
5 358
9 29
10 4232
10 4233
10 4234
10 4235
10 4236
10 4237
10 4238
10 4239
10 4240
13 152
13 153
13 154
13 156
18 42
18 105
18 107
21 212
21 213
21 215
21 216
21 218
21 221
21 223
22 4220
22 4221
22 4222
22 4223
22 4224
22 4225
22 4226
22 4227
22 4228
22 4229
25 36
28 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4240

Test #12:

score: 5
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

7
1291

output:

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

input:

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

output:

8
5000 2500
1292 1299
1292 1300
1292 1303
1292 1304
1292 1305
1292 1306
1292 1307
1292 1308
1292 1309
1292 1310
1292 1312
1292 1319
1292 1320
1292 1323
1292 1324
1292 1326
1292 1327
1292 1328
1292 1329
1292 1330
1292 1331
1292 1333
1292 1338
1292 1339
1292 1340
1292 1341
1292 1342
1292 1343
1292 134...

input:

8
5000 2500
1292 1299
1292 1300
1292 1303
1292 1304
1292 1305
1292 1306
1292 1307
1292 1308
1292 1309
1292 1310
1292 1312
1292 1319
1292 1320
1292 1323
1292 1324
1292 1326
1292 1327
1292 1328
1292 1329
1292 1330
1292 1331
1292 1333
1292 1338
1292 1339
1292 1340
1292 1341
1292 1342
1292 1343
1292 134...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1291

Subtask #2:

score: 30
Accepted

Test #13:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1872kb

input:

1
17476204

output:

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

input:

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

output:

2
5000 3717
1 2
1 3
1 19
2 4
2 5
2 108
2 109
4 1188
4 1189
4 1190
4 1191
4 1192
4 1193
5 6
5 7
5 8
5 10
5 11
5 20
5 22
5 23
5 74
5 76
5 77
5 78
5 79
6 14
6 15
6 16
6 99
7 48
7 49
7 50
7 51
7 53
10 12
10 13
10 62
10 63
10 64
10 65
10 67
13 140
13 141
13 143
13 145
13 146
13 147
13 148
13 149
13 3930
...

input:

2
5000 3717
1 2
1 3
1 19
2 4
2 5
2 108
2 109
4 1188
4 1189
4 1190
4 1191
4 1192
4 1193
5 6
5 7
5 8
5 10
5 11
5 20
5 22
5 23
5 74
5 76
5 77
5 78
5 79
6 14
6 15
6 16
6 99
7 48
7 49
7 50
7 51
7 53
10 12
10 13
10 62
10 63
10 64
10 65
10 67
13 140
13 141
13 143
13 145
13 146
13 147
13 148
13 149
13 3930
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1868kb

input:

1
11926600

output:

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

input:

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

output:

2
5000 3717
1 2
1 3
1 6
1 7
1 8
1 10
1 11
1 1219
1 1220
1 1222
1 1223
2 4
2 5
2 33
2 34
2 35
2 37
2 258
2 260
2 261
2 262
2 263
2 500
2 501
2 502
2 503
3 31
3 62
3 63
3 64
3 65
3 67
4 2138
4 2139
4 2140
4 2141
5 12
5 13
7 74
7 76
7 77
7 78
7 79
9 332
9 333
9 334
9 335
9 336
9 337
9 565
9 566
9 568
9...

input:

2
5000 3717
1 2
1 3
1 6
1 7
1 8
1 10
1 11
1 1219
1 1220
1 1222
1 1223
2 4
2 5
2 33
2 34
2 35
2 37
2 258
2 260
2 261
2 262
2 263
2 500
2 501
2 502
2 503
3 31
3 62
3 63
3 64
3 65
3 67
4 2138
4 2139
4 2140
4 2141
5 12
5 13
7 74
7 76
7 77
7 78
7 79
9 332
9 333
9 334
9 335
9 336
9 337
9 565
9 566
9 568
9...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1900kb,1868kb

input:

1
16602378

output:

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

input:

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

output:

2
5000 3717
1 2
1 3
1 4
1 5
1 14
1 15
1 16
2 12
2 13
3 8
3 10
3 11
3 1035
3 1037
3 1038
3 1039
4 6
4 7
5 48
5 49
5 50
5 51
5 53
5 240
5 241
5 741
5 743
6 2418
6 2419
6 2420
6 2421
6 2422
6 2423
7 198
7 199
7 2343
7 2344
7 2345
7 2346
7 2347
8 20
8 22
8 23
8 200
8 201
8 202
8 203
8 204
8 205
8 207
8 ...

input:

2
5000 3717
1 2
1 3
1 4
1 5
1 14
1 15
1 16
2 12
2 13
3 8
3 10
3 11
3 1035
3 1037
3 1038
3 1039
4 6
4 7
5 48
5 49
5 50
5 51
5 53
5 240
5 241
5 741
5 743
6 2418
6 2419
6 2420
6 2421
6 2422
6 2423
7 198
7 199
7 2343
7 2344
7 2345
7 2346
7 2347
8 20
8 22
8 23
8 200
8 201
8 202
8 203
8 204
8 205
8 207
8 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

3
13129243

output:

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

input:

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

output:

4
5000 2500
1 2
2 3
2 4
2 5
2 8
2 9
2 10
2 11
3 99
3 100
3 101
4 7
4 384
4 385
4 386
4 387
4 388
4 389
4 858
4 859
7 12
7 13
8 18
8 19
10 614
10 617
11 14
11 15
11 44
11 45
11 46
11 47
18 228
18 229
18 240
18 241
19 42
19 43
21 264
21 265
21 266
21 267
21 268
21 269
23 108
23 109
27 632
27 633
27 63...

input:

4
5000 2500
1 2
2 3
2 4
2 5
2 8
2 9
2 10
2 11
3 99
3 100
3 101
4 7
4 384
4 385
4 386
4 387
4 388
4 389
4 858
4 859
7 12
7 13
8 18
8 19
10 614
10 617
11 14
11 15
11 44
11 45
11 46
11 47
18 228
18 229
18 240
18 241
19 42
19 43
21 264
21 265
21 266
21 267
21 268
21 269
23 108
23 109
27 632
27 633
27 63...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1852kb

input:

3
7892141

output:

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

input:

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

output:

4
5000 2500
2 3
2 6
2 102
2 103
2 3908
2 3909
2 3910
2 3911
3 4
3 5
4 84
4 85
4 86
4 88
4 89
5 12
5 13
5 38
5 39
5 40
5 41
6 10
6 2238
6 2239
14 24
14 27
14 28
14 29
17 20
17 21
17 22
17 23
17 3324
17 3325
17 3326
17 3327
17 3328
17 3329
18 54
18 55
18 56
18 57
18 58
18 59
19 878
19 879
19 880
19 88...

input:

4
5000 2500
2 3
2 6
2 102
2 103
2 3908
2 3909
2 3910
2 3911
3 4
3 5
4 84
4 85
4 86
4 88
4 89
5 12
5 13
5 38
5 39
5 40
5 41
6 10
6 2238
6 2239
14 24
14 27
14 28
14 29
17 20
17 21
17 22
17 23
17 3324
17 3325
17 3326
17 3327
17 3328
17 3329
18 54
18 55
18 56
18 57
18 58
18 59
19 878
19 879
19 880
19 88...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

3
21314775

output:

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

input:

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

output:

4
5000 2500
1 2
1 4
1 5
1 6
1 7
1 39
1 40
1 41
2 3
2 14
2 15
2 16
2 17
6 18
6 19
6 20
6 21
6 23
7 8
7 10
7 11
8 30
8 72
8 73
8 648
8 649
8 650
8 651
8 652
8 653
10 12
11 1232
11 1233
11 1234
11 1235
11 1236
11 1237
11 3464
11 3465
11 3466
11 3467
12 854
12 855
12 856
12 857
17 75
17 76
17 77
17 78
1...

input:

4
5000 2500
1 2
1 4
1 5
1 6
1 7
1 39
1 40
1 41
2 3
2 14
2 15
2 16
2 17
6 18
6 19
6 20
6 21
6 23
7 8
7 10
7 11
8 30
8 72
8 73
8 648
8 649
8 650
8 651
8 652
8 653
10 12
11 1232
11 1233
11 1234
11 1235
11 1236
11 1237
11 3464
11 3465
11 3466
11 3467
12 854
12 855
12 856
12 857
17 75
17 76
17 77
17 78
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1848kb

input:

5
5559540

output:

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

input:

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

output:

6
5000 2512
1 2
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 32
1 33
1 34
1 35
1 36
1 37
1 62
1 63
1 64
1 65
1 66
1 67
13 14
13 15
13 16
13 17
13 104
13 105
13 106
13 107
13 174
13 175
13 176
13 177
13 178
13 179
23 42
23 43
23 152
23 153
23 154
23 155
23 156
23 157
23 450
23 451
23 452
23 453
23 454
23 455
...

input:

6
5000 2512
1 2
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 32
1 33
1 34
1 35
1 36
1 37
1 62
1 63
1 64
1 65
1 66
1 67
13 14
13 15
13 16
13 17
13 104
13 105
13 106
13 107
13 174
13 175
13 176
13 177
13 178
13 179
23 42
23 43
23 152
23 153
23 154
23 155
23 156
23 157
23 450
23 451
23 452
23 453
23 454
23 455
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

5
9424319

output:

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

input:

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

output:

6
5000 2512
1 2
2 84
2 85
2 86
2 87
2 88
2 89
3 5
4 12
4 13
5 7
5 212
5 213
5 214
5 215
5 216
5 217
5 218
5 219
5 220
5 221
5 222
5 223
9 14
9 15
9 16
9 17
9 168
9 169
9 170
9 171
9 172
9 173
9 1448
9 1449
9 1450
9 1451
10 32
10 33
10 34
10 35
10 36
10 37
10 44
10 45
10 46
10 47
10 102
10 103
18 402...

input:

6
5000 2512
1 2
2 84
2 85
2 86
2 87
2 88
2 89
3 5
4 12
4 13
5 7
5 212
5 213
5 214
5 215
5 216
5 217
5 218
5 219
5 220
5 221
5 222
5 223
9 14
9 15
9 16
9 17
9 168
9 169
9 170
9 171
9 172
9 173
9 1448
9 1449
9 1450
9 1451
10 32
10 33
10 34
10 35
10 36
10 37
10 44
10 45
10 46
10 47
10 102
10 103
18 402...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1848kb

input:

5
10955780

output:

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

input:

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

output:

6
5000 2510
1 2
1 3
1 7
1 12
1 13
1 20
1 21
1 22
1 23
1 2622
1 2623
1 2624
1 2625
1 2626
1 2627
1 2628
1 2629
1 2630
1 2631
1 2632
1 2633
4 8
4 9
4 10
4 11
4 572
4 573
4 574
4 575
4 576
4 577
4 2742
4 2743
4 2744
4 2745
4 2746
4 2747
4 2748
4 2749
5 14
5 15
5 16
5 17
5 824
5 825
5 826
5 827
19 98
19...

input:

6
5000 2510
1 2
1 3
1 7
1 12
1 13
1 20
1 21
1 22
1 23
1 2622
1 2623
1 2624
1 2625
1 2626
1 2627
1 2628
1 2629
1 2630
1 2631
1 2632
1 2633
4 8
4 9
4 10
4 11
4 572
4 573
4 574
4 575
4 576
4 577
4 2742
4 2743
4 2744
4 2745
4 2746
4 2747
4 2748
4 2749
5 14
5 15
5 16
5 17
5 824
5 825
5 826
5 827
19 98
19...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
10955780

Test #22:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1852kb

input:

7
19938721

output:

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

input:

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

output:

8
5000 2500
7 374
7 375
7 376
7 377
7 378
9 44
9 45
9 46
9 4592
9 4593
9 4594
9 4595
9 4596
9 4597
11 15
11 462
11 1110
11 1111
11 1112
11 1113
11 1114
11 1115
11 1116
11 1117
13 74
13 75
13 79
16 54
16 55
16 57
16 59
16 139
16 1374
16 1375
16 1376
16 1378
16 1379
16 1381
18 32
18 33
18 34
18 37
18 ...

input:

8
5000 2500
7 374
7 375
7 376
7 377
7 378
9 44
9 45
9 46
9 4592
9 4593
9 4594
9 4595
9 4596
9 4597
11 15
11 462
11 1110
11 1111
11 1112
11 1113
11 1114
11 1115
11 1116
11 1117
13 74
13 75
13 79
16 54
16 55
16 57
16 59
16 139
16 1374
16 1375
16 1376
16 1378
16 1379
16 1381
18 32
18 33
18 34
18 37
18 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
19938721

Test #23:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1900kb,1848kb

input:

7
5129508

output:

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

input:

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

output:

8
5000 2500
2 332
2 333
2 334
2 335
2 336
2 337
3 20
3 24
3 25
3 27
3 28
3 29
6 107
10 54
10 55
10 57
10 58
12 445
13 193
13 374
13 375
13 376
13 379
14 41
14 234
14 235
14 236
14 237
14 239
16 564
16 565
16 566
16 567
16 568
16 569
16 3038
16 3039
16 3040
16 3041
21 274
21 275
21 276
21 277
23 48
2...

input:

8
5000 2500
2 332
2 333
2 334
2 335
2 336
2 337
3 20
3 24
3 25
3 27
3 28
3 29
6 107
10 54
10 55
10 57
10 58
12 445
13 193
13 374
13 375
13 376
13 379
14 41
14 234
14 235
14 236
14 237
14 239
16 564
16 565
16 566
16 567
16 568
16 569
16 3038
16 3039
16 3040
16 3041
21 274
21 275
21 276
21 277
23 48
2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5129508

Test #24:

score: 30
Accepted
time: 2ms = 1ms + 1ms
memory: 1900kb,1848kb

input:

7
15332941

output:

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

input:

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

output:

8
5000 2500
1 14
1 16
1 17
1 32
1 36
1 37
8 158
8 162
8 399
8 400
15 24
15 25
15 26
15 27
18 23
18 231
18 232
18 233
18 882
18 883
19 1184
19 1185
19 1186
19 1187
20 84
20 86
20 87
20 88
20 89
20 313
22 61
22 74
22 75
22 76
22 77
22 78
22 90
22 91
22 93
22 96
29 332
29 333
29 337
31 102
31 103
31 37...

input:

8
5000 2500
1 14
1 16
1 17
1 32
1 36
1 37
8 158
8 162
8 399
8 400
15 24
15 25
15 26
15 27
18 23
18 231
18 232
18 233
18 882
18 883
19 1184
19 1185
19 1186
19 1187
20 84
20 86
20 87
20 88
20 89
20 313
22 61
22 74
22 75
22 76
22 77
22 78
22 90
22 91
22 93
22 96
29 332
29 333
29 337
31 102
31 103
31 37...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
15332941

Subtask #3:

score: 65
Accepted

Test #25:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1900kb,1872kb

input:

1
355365355024496523

output:

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

input:

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

output:

2
5000 3717
1 2
1 4
1 5
1 8
1 10
1 11
1 380
1 383
2 3
3 258
3 260
3 261
3 262
3 263
4 6
4 7
4 12
4 13
4 284
4 286
4 287
4 290
4 291
4 292
4 293
6 14
6 15
6 16
6 54
6 55
6 56
6 57
6 59
7 33
7 34
7 35
7 37
10 24
10 25
10 27
10 29
10 38
10 39
10 40
10 41
10 84
10 85
10 86
10 87
10 88
10 89
11 31
15 19
...

input:

2
5000 3717
1 2
1 4
1 5
1 8
1 10
1 11
1 380
1 383
2 3
3 258
3 260
3 261
3 262
3 263
4 6
4 7
4 12
4 13
4 284
4 286
4 287
4 290
4 291
4 292
4 293
6 14
6 15
6 16
6 54
6 55
6 56
6 57
6 59
7 33
7 34
7 35
7 37
10 24
10 25
10 27
10 29
10 38
10 39
10 40
10 41
10 84
10 85
10 86
10 87
10 88
10 89
11 31
15 19
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
355365355024496523

Test #26:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1872kb

input:

1
727827999106414164

output:

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

input:

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

output:

2
5000 3717
1 2
1 3
1 4
1 5
1 8
1 10
1 11
1 110
1 111
1 112
1 113
1 132
1 134
1 135
1 137
3 12
3 13
4 62
4 63
4 64
4 65
4 67
5 6
5 7
11 14
11 15
11 16
11 194
11 195
11 196
11 197
11 1232
11 1233
11 1235
11 4800
11 4801
12 19
12 198
12 199
12 338
12 339
12 341
12 342
12 344
12 345
12 346
12 347
12 23...

input:

2
5000 3717
1 2
1 3
1 4
1 5
1 8
1 10
1 11
1 110
1 111
1 112
1 113
1 132
1 134
1 135
1 137
3 12
3 13
4 62
4 63
4 64
4 65
4 67
5 6
5 7
11 14
11 15
11 16
11 194
11 195
11 196
11 197
11 1232
11 1233
11 1235
11 4800
11 4801
12 19
12 198
12 199
12 338
12 339
12 341
12 342
12 344
12 345
12 346
12 347
12 23...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
727827999106414164

Test #27:

score: 65
Accepted
time: 1ms = 0ms + 1ms
memory: 1896kb,1872kb

input:

1
656410143989222955

output:

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

input:

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

output:

2
5000 3717
1 2
1 4
1 5
1 6
1 7
1 84
1 85
1 86
1 87
1 88
1 89
2 3
2 19
2 4484
2 4486
2 4488
2 4489
2 4491
2 4492
2 4493
3 12
3 13
4 8
4 10
4 11
4 2085
4 2086
4 2087
5 74
5 76
5 77
5 78
5 79
7 54
7 55
7 56
7 57
7 59
7 348
7 349
8 14
8 15
8 16
8 1584
8 1586
8 1588
8 1589
8 1590
8 1593
8 1594
8 1595
8 ...

input:

2
5000 3717
1 2
1 4
1 5
1 6
1 7
1 84
1 85
1 86
1 87
1 88
1 89
2 3
2 19
2 4484
2 4486
2 4488
2 4489
2 4491
2 4492
2 4493
3 12
3 13
4 8
4 10
4 11
4 2085
4 2086
4 2087
5 74
5 76
5 77
5 78
5 79
7 54
7 55
7 56
7 57
7 59
7 348
7 349
8 14
8 15
8 16
8 1584
8 1586
8 1588
8 1589
8 1590
8 1593
8 1594
8 1595
8 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
656410143989222955

Test #28:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1900kb,1868kb

input:

1
410366615149657534

output:

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

input:

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

output:

2
5000 3717
1 2
1 3
1 74
1 76
1 77
1 78
1 79
1 410
1 411
1 412
1 413
1 414
1 415
1 416
1 418
1 419
2 4
2 5
3 24
3 25
3 27
3 29
3 54
3 55
3 56
3 57
3 59
3 72
3 73
5 6
5 7
5 8
5 10
5 11
5 14
5 15
5 16
6 12
6 13
7 1980
7 1981
7 1982
7 1983
7 1984
7 1985
7 1987
9 20
9 22
9 23
9 33
9 34
9 35
9 37
10 284
...

input:

2
5000 3717
1 2
1 3
1 74
1 76
1 77
1 78
1 79
1 410
1 411
1 412
1 413
1 414
1 415
1 416
1 418
1 419
2 4
2 5
3 24
3 25
3 27
3 29
3 54
3 55
3 56
3 57
3 59
3 72
3 73
5 6
5 7
5 8
5 10
5 11
5 14
5 15
5 16
6 12
6 13
7 1980
7 1981
7 1982
7 1983
7 1984
7 1985
7 1987
9 20
9 22
9 23
9 33
9 34
9 35
9 37
10 284
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
410366615149657534

Test #29:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1876kb

input:

1
298090682780948428

output:

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

input:

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

output:

2
5000 3717
1 2
1 3
1 8
1 10
1 11
1 33
1 34
1 35
1 37
1 158
1 159
1 160
1 161
1 163
2 4
2 5
2 1172
2 1173
2 1174
2 1175
2 1176
2 1177
2 1179
2 1180
2 1181
4 6
4 7
5 24
5 25
5 27
5 29
6 128
6 129
6 130
6 398
6 399
6 400
6 401
6 2798
6 2801
8 14
8 15
8 16
8 38
8 39
8 40
8 41
9 12
9 13
9 60
9 61
9 464
...

input:

2
5000 3717
1 2
1 3
1 8
1 10
1 11
1 33
1 34
1 35
1 37
1 158
1 159
1 160
1 161
1 163
2 4
2 5
2 1172
2 1173
2 1174
2 1175
2 1176
2 1177
2 1179
2 1180
2 1181
4 6
4 7
5 24
5 25
5 27
5 29
6 128
6 129
6 130
6 398
6 399
6 400
6 401
6 2798
6 2801
8 14
8 15
8 16
8 38
8 39
8 40
8 41
9 12
9 13
9 60
9 61
9 464
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
298090682780948428

Test #30:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1848kb

input:

3
969441916331132577

output:

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

input:

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

output:

4
5000 2500
1 2
1 4
1 24
1 25
1 26
1 27
1 28
1 29
4 12
6 18
6 19
6 230
6 231
6 232
6 233
7 62
7 63
7 64
7 65
7 66
7 67
7 489
7 490
7 491
8 228
8 229
8 312
8 313
10 1734
10 1735
10 1736
10 1737
10 1738
10 1739
10 1740
10 1741
16 68
16 69
16 70
16 71
21 2342
21 2343
21 2344
21 2345
21 2346
21 2347
29 ...

input:

4
5000 2500
1 2
1 4
1 24
1 25
1 26
1 27
1 28
1 29
4 12
6 18
6 19
6 230
6 231
6 232
6 233
7 62
7 63
7 64
7 65
7 66
7 67
7 489
7 490
7 491
8 228
8 229
8 312
8 313
10 1734
10 1735
10 1736
10 1737
10 1738
10 1739
10 1740
10 1741
16 68
16 69
16 70
16 71
21 2342
21 2343
21 2344
21 2345
21 2346
21 2347
29 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
969441916331132577

Test #31:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

3
929489812741933634

output:

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

input:

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

output:

4
5000 2500
1 2
1 18
1 19
1 444
1 445
1 446
1 447
1 448
1 449
2 98
2 99
2 100
2 101
5 6
5 12
5 20
5 21
5 22
5 23
8 2238
8 2239
8 3848
8 3849
8 3851
9 594
9 595
9 596
9 598
9 599
10 14
10 15
10 16
10 17
10 30
10 80
10 81
10 82
10 83
14 54
14 55
14 56
14 57
14 58
14 59
14 2270
14 2271
14 2272
14 2273
...

input:

4
5000 2500
1 2
1 18
1 19
1 444
1 445
1 446
1 447
1 448
1 449
2 98
2 99
2 100
2 101
5 6
5 12
5 20
5 21
5 22
5 23
8 2238
8 2239
8 3848
8 3849
8 3851
9 594
9 595
9 596
9 598
9 599
10 14
10 15
10 16
10 17
10 30
10 80
10 81
10 82
10 83
14 54
14 55
14 56
14 57
14 58
14 59
14 2270
14 2271
14 2272
14 2273
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
929489812741933634

Test #32:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1852kb

input:

3
144032041325838295

output:

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

input:

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

output:

4
5000 2500
2 3
2 4
3 42
3 43
3 1098
3 1099
3 1100
3 1101
3 1102
3 1103
4 12
4 44
4 45
4 46
4 60
4 61
6 140
6 141
6 142
6 143
6 144
6 145
6 146
6 147
6 148
6 149
7 14
7 15
7 16
7 17
7 1932
7 1933
8 824
8 825
8 826
8 827
10 18
10 19
11 24
11 26
11 28
11 29
11 39
11 40
11 41
12 692
12 693
12 694
12 69...

input:

4
5000 2500
2 3
2 4
3 42
3 43
3 1098
3 1099
3 1100
3 1101
3 1102
3 1103
4 12
4 44
4 45
4 46
4 60
4 61
6 140
6 141
6 142
6 143
6 144
6 145
6 146
6 147
6 148
6 149
7 14
7 15
7 16
7 17
7 1932
7 1933
8 824
8 825
8 826
8 827
10 18
10 19
11 24
11 26
11 28
11 29
11 39
11 40
11 41
12 692
12 693
12 694
12 69...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
144032041325838295

Test #33:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1856kb

input:

3
832110946250826180

output:

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

input:

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

output:

4
5000 2500
1 4
1 5
1 7
1 42
1 43
1 230
1 231
1 232
1 233
4 14
4 15
4 16
4 17
5 12
5 558
5 560
5 562
5 563
7 108
7 109
14 278
14 280
14 281
15 282
15 283
16 128
16 129
16 130
16 131
23 30
23 31
24 830
24 832
24 833
24 834
24 835
24 836
24 837
24 838
24 839
26 984
26 985
26 986
26 987
26 988
26 989
2...

input:

4
5000 2500
1 4
1 5
1 7
1 42
1 43
1 230
1 231
1 232
1 233
4 14
4 15
4 16
4 17
5 12
5 558
5 560
5 562
5 563
7 108
7 109
14 278
14 280
14 281
15 282
15 283
16 128
16 129
16 130
16 131
23 30
23 31
24 830
24 832
24 833
24 834
24 835
24 836
24 837
24 838
24 839
26 984
26 985
26 986
26 987
26 988
26 989
2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
832110946250826180

Test #34:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1852kb

input:

3
85728715707691821

output:

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

input:

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

output:

4
5000 2500
1 4
1 5
5 33
5 34
5 35
5 36
5 37
5 464
5 465
5 466
5 467
6 1052
6 1053
6 1054
6 1055
6 1056
6 1057
6 1058
6 1059
6 1060
6 1061
7 20
7 21
7 22
7 23
9 228
9 229
14 18
14 19
17 440
17 442
17 443
18 270
18 271
18 360
18 361
18 362
18 363
18 364
18 365
18 366
18 367
24 31
24 138
24 139
25 458...

input:

4
5000 2500
1 4
1 5
5 33
5 34
5 35
5 36
5 37
5 464
5 465
5 466
5 467
6 1052
6 1053
6 1054
6 1055
6 1056
6 1057
6 1058
6 1059
6 1060
6 1061
7 20
7 21
7 22
7 23
9 228
9 229
14 18
14 19
17 440
17 442
17 443
18 270
18 271
18 360
18 361
18 362
18 363
18 364
18 365
18 366
18 367
24 31
24 138
24 139
25 458...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
85728715707691821

Test #35:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

5
777434612360931036

output:

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

input:

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

output:

6
5000 2513
1 3
2 6
2 7
2 8
2 9
2 10
2 11
2 30
2 31
2 62
2 63
2 64
2 65
2 66
2 67
2 4338
2 4339
4 20
4 21
4 22
4 23
4 24
4 25
4 26
4 27
4 28
4 29
12 138
12 139
12 168
12 169
12 170
12 171
12 172
12 173
13 48
13 49
13 50
13 51
13 52
13 53
13 720
13 721
13 722
13 723
13 724
13 725
13 726
13 727
13 774...

input:

6
5000 2513
1 3
2 6
2 7
2 8
2 9
2 10
2 11
2 30
2 31
2 62
2 63
2 64
2 65
2 66
2 67
2 4338
2 4339
4 20
4 21
4 22
4 23
4 24
4 25
4 26
4 27
4 28
4 29
12 138
12 139
12 168
12 169
12 170
12 171
12 172
12 173
13 48
13 49
13 50
13 51
13 52
13 53
13 720
13 721
13 722
13 723
13 724
13 725
13 726
13 727
13 774...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
777434612360931036

Test #36:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

5
705262511549880222

output:

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

input:

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

output:

6
5000 2562
1 3
1 4
1 5
1 4952
1 4953
1 4954
1 4955
1 4956
1 4957
2 8
6 48
6 49
6 50
6 51
6 52
6 53
7 114
7 115
7 116
7 117
7 118
7 119
7 120
7 121
7 122
7 123
7 124
7 125
7 126
7 127
10 3000
10 3001
11 24
11 25
11 26
11 27
11 28
11 29
11 398
11 399
11 400
11 401
11 3222
11 3223
11 3224
11 3225
11 3...

input:

6
5000 2562
1 3
1 4
1 5
1 4952
1 4953
1 4954
1 4955
1 4956
1 4957
2 8
6 48
6 49
6 50
6 51
6 52
6 53
7 114
7 115
7 116
7 117
7 118
7 119
7 120
7 121
7 122
7 123
7 124
7 125
7 126
7 127
10 3000
10 3001
11 24
11 25
11 26
11 27
11 28
11 29
11 398
11 399
11 400
11 401
11 3222
11 3223
11 3224
11 3225
11 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
705262511549880222

Test #37:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

5
510318082834167951

output:

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

input:

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

output:

6
5000 2658
1 2
1 4
1 8
1 9
1 10
1 11
3 12
3 13
3 192
3 193
6 14
6 15
6 16
6 17
6 1064
6 1065
6 1066
6 1067
6 1068
6 1069
6 2790
6 2791
7 984
7 985
7 986
7 987
7 988
7 989
7 990
7 991
18 72
18 73
19 20
19 21
19 22
19 23
19 104
19 105
19 106
19 107
19 4254
19 4255
19 4256
19 4257
19 4258
19 4259
24 6...

input:

6
5000 2658
1 2
1 4
1 8
1 9
1 10
1 11
3 12
3 13
3 192
3 193
6 14
6 15
6 16
6 17
6 1064
6 1065
6 1066
6 1067
6 1068
6 1069
6 2790
6 2791
7 984
7 985
7 986
7 987
7 988
7 989
7 990
7 991
18 72
18 73
19 20
19 21
19 22
19 23
19 104
19 105
19 106
19 107
19 4254
19 4255
19 4256
19 4257
19 4258
19 4259
24 6...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
510318082834167951

Test #38:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1848kb

input:

5
914858813253258744

output:

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

input:

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

output:

6
5000 2570
1 3
1 4
1 5
1 14
1 15
1 16
1 17
1 140
1 141
1 142
1 143
1 144
1 145
1 146
1 147
1 148
1 149
7 1104
7 1105
7 1106
7 1107
7 1108
7 1109
8 1484
8 1485
8 1486
8 1487
8 1628
8 1629
8 1630
8 1631
8 1632
8 1633
8 1634
8 1635
8 1636
8 1637
9 24
9 25
9 26
9 27
9 28
9 29
9 42
9 43
9 62
9 63
9 64
9...

input:

6
5000 2570
1 3
1 4
1 5
1 14
1 15
1 16
1 17
1 140
1 141
1 142
1 143
1 144
1 145
1 146
1 147
1 148
1 149
7 1104
7 1105
7 1106
7 1107
7 1108
7 1109
8 1484
8 1485
8 1486
8 1487
8 1628
8 1629
8 1630
8 1631
8 1632
8 1633
8 1634
8 1635
8 1636
8 1637
9 24
9 25
9 26
9 27
9 28
9 29
9 42
9 43
9 62
9 63
9 64
9...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
914858813253258744

Test #39:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1856kb

input:

5
659635316746638238

output:

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

input:

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

output:

6
5000 2539
1 2
2 5
2 24
2 25
2 26
2 27
2 28
2 29
2 350
2 351
2 352
2 353
2 1010
2 1011
2 1012
2 1013
3 174
3 175
3 176
3 177
3 178
3 179
4 7
6 1374
6 1375
6 1376
6 1377
6 1378
6 1379
6 1380
6 1381
6 2384
6 2385
6 2386
6 2387
6 2388
6 2389
7 9
7 10
7 11
7 12
7 13
7 14
7 15
7 16
7 17
7 620
7 621
7 62...

input:

6
5000 2539
1 2
2 5
2 24
2 25
2 26
2 27
2 28
2 29
2 350
2 351
2 352
2 353
2 1010
2 1011
2 1012
2 1013
3 174
3 175
3 176
3 177
3 178
3 179
4 7
6 1374
6 1375
6 1376
6 1377
6 1378
6 1379
6 1380
6 1381
6 2384
6 2385
6 2386
6 2387
6 2388
6 2389
7 9
7 10
7 11
7 12
7 13
7 14
7 15
7 16
7 17
7 620
7 621
7 62...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659635316746638238

Test #40:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

7
858490260563149759

output:

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

input:

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

output:

8
5000 2500
5 1622
5 1623
5 1624
5 1626
5 1627
6 360
6 361
6 362
6 363
6 364
6 366
6 367
7 8
7 60
7 72
7 73
11 48
11 51
11 52
11 108
11 440
11 441
11 442
11 443
12 33
12 111
12 113
13 16
13 2714
13 2715
13 2716
13 2717
13 2718
13 2719
14 81
14 82
14 83
14 2244
14 2246
14 2247
14 2248
14 2249
14 2251...

input:

8
5000 2500
5 1622
5 1623
5 1624
5 1626
5 1627
6 360
6 361
6 362
6 363
6 364
6 366
6 367
7 8
7 60
7 72
7 73
11 48
11 51
11 52
11 108
11 440
11 441
11 442
11 443
12 33
12 111
12 113
13 16
13 2714
13 2715
13 2716
13 2717
13 2718
13 2719
14 81
14 82
14 83
14 2244
14 2246
14 2247
14 2248
14 2249
14 2251...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
858490260563149759

Test #41:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1892kb,1848kb

input:

7
860058643727731209

output:

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

input:

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

output:

8
5000 2500
3 2892
5 20
6 25
6 26
6 29
6 30
6 31
6 192
6 193
7 18
7 19
8 908
8 909
8 910
8 2238
8 2239
9 16
9 812
9 813
9 814
9 817
9 818
9 819
9 820
9 821
11 74
11 76
11 78
11 79
13 33
13 34
13 36
17 43
17 390
17 391
17 392
17 393
17 394
17 396
17 397
21 54
22 68
22 69
22 70
22 81
22 82
23 423
23 4...

input:

8
5000 2500
3 2892
5 20
6 25
6 26
6 29
6 30
6 31
6 192
6 193
7 18
7 19
8 908
8 909
8 910
8 2238
8 2239
9 16
9 812
9 813
9 814
9 817
9 818
9 819
9 820
9 821
11 74
11 76
11 78
11 79
13 33
13 34
13 36
17 43
17 390
17 391
17 392
17 393
17 394
17 396
17 397
21 54
22 68
22 69
22 70
22 81
22 82
23 423
23 4...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
860058643727731209

Test #42:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1848kb

input:

7
718861404514377808

output:

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

input:

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

output:

8
5000 2500
2 788
2 789
2 790
2 791
2 794
2 796
6 11
6 140
6 141
6 143
6 144
6 145
6 147
6 148
6 149
7 92
7 97
8 368
8 369
8 370
8 372
13 18
13 19
13 43
13 1095
13 1097
15 80
15 81
15 82
15 108
15 109
21 44
21 74
21 77
21 78
21 79
23 194
23 196
23 197
29 84
29 86
29 87
29 89
30 200
30 202
30 204
30 ...

input:

8
5000 2500
2 788
2 789
2 790
2 791
2 794
2 796
6 11
6 140
6 141
6 143
6 144
6 145
6 147
6 148
6 149
7 92
7 97
8 368
8 369
8 370
8 372
13 18
13 19
13 43
13 1095
13 1097
15 80
15 81
15 82
15 108
15 109
21 44
21 74
21 77
21 78
21 79
23 194
23 196
23 197
29 84
29 86
29 87
29 89
30 200
30 202
30 204
30 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
718861404514377808

Test #43:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

7
659192688464047828

output:

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

input:

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

output:

8
5000 2500
3 433
6 445
6 446
6 448
6 449
6 2310
6 2311
7 10
7 19
7 434
7 436
7 437
7 438
7 439
8 98
8 100
8 101
8 500
8 501
8 502
8 503
8 1118
8 1119
8 1120
8 1121
8 1122
8 1123
9 1734
9 1735
9 1737
9 1738
9 1739
9 1740
9 1741
11 999
11 1000
11 1001
11 1002
11 1003
11 1006
11 1007
11 1008
11 1009
1...

input:

8
5000 2500
3 433
6 445
6 446
6 448
6 449
6 2310
6 2311
7 10
7 19
7 434
7 436
7 437
7 438
7 439
8 98
8 100
8 101
8 500
8 501
8 502
8 503
8 1118
8 1119
8 1120
8 1121
8 1122
8 1123
9 1734
9 1735
9 1737
9 1738
9 1739
9 1740
9 1741
11 999
11 1000
11 1001
11 1002
11 1003
11 1006
11 1007
11 1008
11 1009
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659192688464047828

Test #44:

score: 65
Accepted
time: 2ms = 1ms + 1ms
memory: 1896kb,1852kb

input:

7
685730986714800201

output:

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

input:

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

output:

8
5000 2500
5 80
5 82
5 83
6 152
6 157
9 132
9 133
9 135
9 137
10 38
10 39
10 40
10 41
11 12
11 42
13 25
13 27
13 72
13 73
13 432
14 23
24 1455
24 1456
24 1457
24 1458
24 1459
24 2964
24 2965
24 2966
24 2967
24 2968
24 2969
26 3770
26 3771
26 3772
26 3773
26 3774
26 3775
26 3776
26 3777
26 3778
26 3...

input:

8
5000 2500
5 80
5 82
5 83
6 152
6 157
9 132
9 133
9 135
9 137
10 38
10 39
10 40
10 41
11 12
11 42
13 25
13 27
13 72
13 73
13 432
14 23
24 1455
24 1456
24 1457
24 1458
24 1459
24 2964
24 2965
24 2966
24 2967
24 2968
24 2969
26 3770
26 3771
26 3772
26 3773
26 3774
26 3775
26 3776
26 3777
26 3778
26 3...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
685730986714800201