QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#426551#8726. Magic ShowEndline100 ✓1ms1876kbC++14813b2024-05-31 15:02:312024-05-31 15:02:31

Judging History

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

  • [2024-05-31 15:02:31]
  • 评测
  • 测评结果:100
  • 用时:1ms
  • 内存:1876kb
  • [2024-05-31 15:02:31]
  • 提交

Alice

#include"Alice.h"
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
using ll=long long;
vector<pair<int,int>>g;
vector<pair<int,int>>Alice()
{
    mt19937 rd(20080811);
	int n=5000;
    ll x=setN(n);
	g.push_back({1,2});
	for(int i=3;i<=n;i++)
	{
		int pos=rd()%63;
		int val=(x>>pos)&1,add=rd()&1;
		g.push_back({(val^add)+1,i});
	}
	return g;
}

Bob

#include"Bob.h"
#include<bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__)
using namespace std;
using ll=long long;
int fa[5002];
ll Bob(vector<pair<int,int>>g)
{
    mt19937 rd(20080811);
	int n=5000;
	for(auto i:g)
		fa[i.second]=i.first;
    ll x=0;
	for(int i=3;i<=n;i++)
	{
		ll pos=rd()%63;
		ll val=fa[i]-1,add=rd()&1;
		if(~val)x|=(val^add)<<pos;
	}
	return x;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1872kb,1840kb

input:

1
4005

output:

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

input:

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

output:

2
5000 3293
1 5
1 9
1 10
1 13
1 17
1 18
1 22
1 25
1 28
1 29
1 30
1 33
1 34
1 42
1 46
1 49
1 52
1 53
1 56
1 57
1 62
1 65
1 71
1 75
1 79
1 83
1 94
1 98
1 102
1 103
1 108
1 113
1 118
1 120
1 121
1 129
1 137
1 145
1 146
1 149
1 152
1 154
1 155
1 159
1 161
1 163
1 164
1 166
1 173
1 175
1 176
1 178
1 181
...

input:

2
5000 3293
1 5
1 9
1 10
1 13
1 17
1 18
1 22
1 25
1 28
1 29
1 30
1 33
1 34
1 42
1 46
1 49
1 52
1 53
1 56
1 57
1 62
1 65
1 71
1 75
1 79
1 83
1 94
1 98
1 102
1 103
1 108
1 113
1 118
1 120
1 121
1 129
1 137
1 145
1 146
1 149
1 152
1 154
1 155
1 159
1 161
1 163
1 164
1 166
1 173
1 175
1 176
1 178
1 181
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4005

Test #2:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1872kb,1836kb

input:

1
459

output:

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

input:

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

output:

2
5000 3293
1 5
1 8
1 9
1 13
1 17
1 18
1 22
1 25
1 29
1 30
1 33
1 34
1 42
1 45
1 46
1 49
1 52
1 53
1 56
1 57
1 62
1 65
1 71
1 75
1 76
1 79
1 94
1 98
1 102
1 103
1 108
1 113
1 115
1 118
1 120
1 121
1 128
1 129
1 130
1 137
1 145
1 146
1 149
1 151
1 152
1 154
1 155
1 159
1 161
1 163
1 164
1 166
1 173
1...

input:

2
5000 3293
1 5
1 8
1 9
1 13
1 17
1 18
1 22
1 25
1 29
1 30
1 33
1 34
1 42
1 45
1 46
1 49
1 52
1 53
1 56
1 57
1 62
1 65
1 71
1 75
1 76
1 79
1 94
1 98
1 102
1 103
1 108
1 113
1 115
1 118
1 120
1 121
1 128
1 129
1 130
1 137
1 145
1 146
1 149
1 151
1 152
1 154
1 155
1 159
1 161
1 163
1 164
1 166
1 173
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
459

Test #3:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1836kb

input:

1
2495

output:

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

input:

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

output:

2
5000 3293
1 5
1 8
1 9
1 13
1 17
1 18
1 22
1 25
1 29
1 30
1 33
1 34
1 42
1 46
1 49
1 52
1 53
1 56
1 57
1 62
1 65
1 71
1 75
1 79
1 83
1 94
1 98
1 102
1 103
1 108
1 113
1 118
1 120
1 121
1 129
1 137
1 145
1 146
1 149
1 152
1 154
1 155
1 159
1 161
1 164
1 166
1 173
1 175
1 176
1 178
1 181
1 186
1 187
...

input:

2
5000 3293
1 5
1 8
1 9
1 13
1 17
1 18
1 22
1 25
1 29
1 30
1 33
1 34
1 42
1 46
1 49
1 52
1 53
1 56
1 57
1 62
1 65
1 71
1 75
1 79
1 83
1 94
1 98
1 102
1 103
1 108
1 113
1 118
1 120
1 121
1 129
1 137
1 145
1 146
1 149
1 152
1 154
1 155
1 159
1 161
1 164
1 166
1 173
1 175
1 176
1 178
1 181
1 186
1 187
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
2495

Test #4:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1868kb,1824kb

input:

3
1560

output:

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

input:

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

output:

4
5000 2550
1 2
1 3
1 5
1 9
1 10
1 13
1 17
1 18
1 21
1 22
1 24
1 28
1 30
1 31
1 33
1 34
1 38
1 43
1 44
1 45
1 46
1 49
1 52
1 55
1 56
1 57
1 62
1 65
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 118
1 120
1 121
1 123
1 125
1 128...

input:

4
5000 2550
1 2
1 3
1 5
1 9
1 10
1 13
1 17
1 18
1 21
1 22
1 24
1 28
1 30
1 31
1 33
1 34
1 38
1 43
1 44
1 45
1 46
1 49
1 52
1 55
1 56
1 57
1 62
1 65
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 118
1 120
1 121
1 123
1 125
1 128...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1560

Test #5:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1824kb

input:

3
3594

output:

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

input:

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

output:

4
5000 2535
1 2
1 3
1 5
1 9
1 10
1 13
1 17
1 18
1 22
1 24
1 30
1 31
1 33
1 34
1 38
1 43
1 44
1 45
1 46
1 49
1 52
1 55
1 56
1 57
1 59
1 62
1 65
1 71
1 75
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 118
1 120
1 121
1 123
1 125
1 129
1 133
1 1...

input:

4
5000 2535
1 2
1 3
1 5
1 9
1 10
1 13
1 17
1 18
1 22
1 24
1 30
1 31
1 33
1 34
1 38
1 43
1 44
1 45
1 46
1 49
1 52
1 55
1 56
1 57
1 59
1 62
1 65
1 71
1 75
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 118
1 120
1 121
1 123
1 125
1 129
1 133
1 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
3594

Test #6:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1824kb

input:

3
1750

output:

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

input:

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

output:

4
5000 2503
1 2
1 3
1 5
1 9
1 10
1 13
1 17
1 18
1 21
1 22
1 30
1 31
1 33
1 34
1 38
1 40
1 42
1 43
1 44
1 46
1 49
1 52
1 55
1 56
1 57
1 62
1 65
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 87
1 90
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 113
1 115
1 116
1 118
1 120
1 121
1 123
1 125
1 128
1 129
1 130
1 ...

input:

4
5000 2503
1 2
1 3
1 5
1 9
1 10
1 13
1 17
1 18
1 21
1 22
1 30
1 31
1 33
1 34
1 38
1 40
1 42
1 43
1 44
1 46
1 49
1 52
1 55
1 56
1 57
1 62
1 65
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 87
1 90
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 113
1 115
1 116
1 118
1 120
1 121
1 123
1 125
1 128
1 129
1 130
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1750

Test #7:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1824kb

input:

5
4878

output:

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

input:

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

output:

6
5000 2522
1 2
1 5
1 9
1 10
1 13
1 17
1 18
1 22
1 29
1 30
1 31
1 33
1 34
1 38
1 43
1 44
1 49
1 52
1 55
1 56
1 57
1 62
1 65
1 69
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 118
1 120
1 121
1 125
1 128
1 129
1 133
1 135
1 137
...

input:

6
5000 2522
1 2
1 5
1 9
1 10
1 13
1 17
1 18
1 22
1 29
1 30
1 31
1 33
1 34
1 38
1 43
1 44
1 49
1 52
1 55
1 56
1 57
1 62
1 65
1 69
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 118
1 120
1 121
1 125
1 128
1 129
1 133
1 135
1 137
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4878

Test #8:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1824kb

input:

5
1223

output:

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

input:

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

output:

6
5000 2506
1 3
2 4
2 6
2 7
2 10
2 11
2 12
2 14
2 15
2 16
2 19
2 20
2 21
2 23
2 24
2 26
2 27
2 28
2 29
2 32
2 35
2 36
2 37
2 39
2 41
2 45
2 47
2 48
2 50
2 51
2 54
2 58
2 59
2 60
2 61
2 63
2 64
2 66
2 67
2 68
2 69
2 70
2 72
2 73
2 74
2 77
2 82
2 83
2 84
2 85
2 86
2 88
2 89
2 91
2 92
2 95
2 96
2 97
2 ...

input:

6
5000 2506
1 3
2 4
2 6
2 7
2 10
2 11
2 12
2 14
2 15
2 16
2 19
2 20
2 21
2 23
2 24
2 26
2 27
2 28
2 29
2 32
2 35
2 36
2 37
2 39
2 41
2 45
2 47
2 48
2 50
2 51
2 54
2 58
2 59
2 60
2 61
2 63
2 64
2 66
2 67
2 68
2 69
2 70
2 72
2 73
2 74
2 77
2 82
2 83
2 84
2 85
2 86
2 88
2 89
2 91
2 92
2 95
2 96
2 97
2 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1223

Test #9:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1828kb

input:

5
648

output:

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

input:

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

output:

6
5000 2557
1 2
1 5
1 9
1 10
1 13
1 17
1 18
1 22
1 24
1 28
1 30
1 31
1 33
1 34
1 38
1 42
1 43
1 44
1 45
1 46
1 49
1 52
1 55
1 56
1 57
1 62
1 65
1 69
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 113
1 116
1 118
1 120
1 121
1 123
1 125
1 128
1 12...

input:

6
5000 2557
1 2
1 5
1 9
1 10
1 13
1 17
1 18
1 22
1 24
1 28
1 30
1 31
1 33
1 34
1 38
1 42
1 43
1 44
1 45
1 46
1 49
1 52
1 55
1 56
1 57
1 62
1 65
1 69
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 113
1 116
1 118
1 120
1 121
1 123
1 125
1 128
1 12...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
648

Test #10:

score: 5
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1824kb

input:

7
4475

output:

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

input:

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

output:

8
5000 2500
1 3
1 5
1 8
1 9
1 13
1 17
1 18
1 21
1 22
1 24
1 25
1 29
1 30
1 31
1 33
1 34
1 38
1 40
1 43
1 44
1 45
1 49
1 52
1 53
1 55
1 56
1 57
1 62
1 65
1 69
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 87
1 90
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 115
1 116
1 118
1 120
1 121
1 125
1 128
1 12...

input:

8
5000 2500
1 3
1 5
1 8
1 9
1 13
1 17
1 18
1 21
1 22
1 24
1 25
1 29
1 30
1 31
1 33
1 34
1 38
1 40
1 43
1 44
1 45
1 49
1 52
1 53
1 55
1 56
1 57
1 62
1 65
1 69
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 87
1 90
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 115
1 116
1 118
1 120
1 121
1 125
1 128
1 12...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4475

Test #11:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1868kb,1824kb

input:

7
4240

output:

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

input:

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

output:

8
5000 2500
1 3
1 5
1 8
1 9
1 13
1 17
1 18
1 21
1 22
1 24
1 28
1 30
1 31
1 33
1 34
1 38
1 42
1 43
1 44
1 45
1 49
1 52
1 55
1 56
1 57
1 62
1 65
1 69
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 113
1 116
1 118
1 120
1 121
1 125
1 128
1 129
1 133
1 13...

input:

8
5000 2500
1 3
1 5
1 8
1 9
1 13
1 17
1 18
1 21
1 22
1 24
1 28
1 30
1 31
1 33
1 34
1 38
1 42
1 43
1 44
1 45
1 49
1 52
1 55
1 56
1 57
1 62
1 65
1 69
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 113
1 116
1 118
1 120
1 121
1 125
1 128
1 129
1 133
1 13...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
4240

Test #12:

score: 5
Accepted
time: 1ms = 1ms + 0ms
memory: 1872kb,1824kb

input:

7
1291

output:

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

input:

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

output:

8
5000 2500
1 3
1 8
1 9
1 13
1 17
1 18
1 22
1 24
1 25
1 29
1 30
1 31
1 34
1 38
1 43
1 44
1 45
1 46
1 49
1 52
1 53
1 55
1 56
1 57
1 62
1 65
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 118
1 120
1 121
1 123
1 125
1 128
1 129
1 133
1...

input:

8
5000 2500
1 3
1 8
1 9
1 13
1 17
1 18
1 22
1 24
1 25
1 29
1 30
1 31
1 34
1 38
1 43
1 44
1 45
1 46
1 49
1 52
1 53
1 55
1 56
1 57
1 62
1 65
1 71
1 75
1 76
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 90
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 118
1 120
1 121
1 123
1 125
1 128
1 129
1 133
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
1291

Subtask #2:

score: 30
Accepted

Test #13:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1836kb

input:

1
17476204

output:

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

input:

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

output:

2
5000 3293
1 5
1 9
1 10
1 13
1 15
1 17
1 18
1 22
1 23
1 28
1 30
1 33
1 46
1 48
1 49
1 52
1 56
1 57
1 60
1 62
1 71
1 75
1 79
1 94
1 98
1 100
1 102
1 103
1 113
1 115
1 120
1 121
1 129
1 130
1 137
1 139
1 146
1 149
1 152
1 154
1 155
1 159
1 161
1 163
1 164
1 166
1 173
1 175
1 176
1 182
1 186
1 189
1 1...

input:

2
5000 3293
1 5
1 9
1 10
1 13
1 15
1 17
1 18
1 22
1 23
1 28
1 30
1 33
1 46
1 48
1 49
1 52
1 56
1 57
1 60
1 62
1 71
1 75
1 79
1 94
1 98
1 100
1 102
1 103
1 113
1 115
1 120
1 121
1 129
1 130
1 137
1 139
1 146
1 149
1 152
1 154
1 155
1 159
1 161
1 163
1 164
1 166
1 173
1 175
1 176
1 182
1 186
1 189
1 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
17476204

Test #14:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1836kb

input:

1
11926600

output:

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

input:

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

output:

2
5000 3293
1 5
1 8
1 9
1 13
1 15
1 17
1 18
1 22
1 26
1 28
1 32
1 33
1 34
1 45
1 49
1 52
1 56
1 57
1 60
1 62
1 71
1 75
1 77
1 79
1 94
1 102
1 103
1 108
1 113
1 115
1 118
1 121
1 129
1 130
1 131
1 136
1 137
1 139
1 145
1 146
1 147
1 149
1 151
1 152
1 154
1 155
1 159
1 161
1 163
1 164
1 166
1 171
1 17...

input:

2
5000 3293
1 5
1 8
1 9
1 13
1 15
1 17
1 18
1 22
1 26
1 28
1 32
1 33
1 34
1 45
1 49
1 52
1 56
1 57
1 60
1 62
1 71
1 75
1 77
1 79
1 94
1 102
1 103
1 108
1 113
1 115
1 118
1 121
1 129
1 130
1 131
1 136
1 137
1 139
1 145
1 146
1 147
1 149
1 151
1 152
1 154
1 155
1 159
1 161
1 163
1 164
1 166
1 171
1 17...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
11926600

Test #15:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1868kb,1840kb

input:

1
16602378

output:

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

input:

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

output:

2
5000 3293
1 5
1 8
1 9
1 13
1 17
1 22
1 26
1 29
1 32
1 33
1 34
1 35
1 45
1 49
1 52
1 54
1 56
1 57
1 62
1 64
1 65
1 71
1 76
1 77
1 79
1 83
1 94
1 102
1 103
1 108
1 113
1 121
1 128
1 129
1 131
1 136
1 137
1 139
1 146
1 147
1 149
1 151
1 152
1 154
1 155
1 159
1 161
1 162
1 163
1 164
1 166
1 171
1 173
...

input:

2
5000 3293
1 5
1 8
1 9
1 13
1 17
1 22
1 26
1 29
1 32
1 33
1 34
1 35
1 45
1 49
1 52
1 54
1 56
1 57
1 62
1 64
1 65
1 71
1 76
1 77
1 79
1 83
1 94
1 102
1 103
1 108
1 113
1 121
1 128
1 129
1 131
1 136
1 137
1 139
1 146
1 147
1 149
1 151
1 152
1 154
1 155
1 159
1 161
1 162
1 163
1 164
1 166
1 171
1 173
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
16602378

Test #16:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1824kb

input:

3
13129243

output:

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

input:

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

output:

4
5000 2507
1 2
1 3
1 5
1 9
1 10
1 13
1 17
1 21
1 22
1 24
1 25
1 30
1 31
1 32
1 33
1 34
1 35
1 38
1 43
1 44
1 45
1 49
1 52
1 53
1 54
1 55
1 56
1 57
1 62
1 64
1 65
1 71
1 76
1 77
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 88
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 121
1 125
1 128
1 ...

input:

4
5000 2507
1 2
1 3
1 5
1 9
1 10
1 13
1 17
1 21
1 22
1 24
1 25
1 30
1 31
1 32
1 33
1 34
1 35
1 38
1 43
1 44
1 45
1 49
1 52
1 53
1 54
1 55
1 56
1 57
1 62
1 64
1 65
1 71
1 76
1 77
1 78
1 79
1 80
1 81
1 83
1 85
1 87
1 88
1 92
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 121
1 125
1 128
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
13129243

Test #17:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1824kb

input:

3
7892141

output:

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

input:

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

output:

4
5000 2513
1 2
1 3
1 5
1 8
1 9
1 13
1 15
1 17
1 22
1 25
1 26
1 28
1 30
1 31
1 33
1 34
1 35
1 38
1 42
1 43
1 44
1 46
1 47
1 49
1 52
1 53
1 54
1 55
1 56
1 57
1 59
1 60
1 62
1 64
1 65
1 71
1 77
1 78
1 79
1 80
1 81
1 83
1 84
1 85
1 87
1 88
1 93
1 94
1 102
1 103
1 108
1 109
1 113
1 116
1 121
1 123
1 125...

input:

4
5000 2513
1 2
1 3
1 5
1 8
1 9
1 13
1 15
1 17
1 22
1 25
1 26
1 28
1 30
1 31
1 33
1 34
1 35
1 38
1 42
1 43
1 44
1 46
1 47
1 49
1 52
1 53
1 54
1 55
1 56
1 57
1 59
1 60
1 62
1 64
1 65
1 71
1 77
1 78
1 79
1 80
1 81
1 83
1 84
1 85
1 87
1 88
1 93
1 94
1 102
1 103
1 108
1 109
1 113
1 116
1 121
1 123
1 125...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
7892141

Test #18:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1828kb

input:

3
21314775

output:

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

input:

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

output:

4
5000 2508
1 2
1 3
1 5
1 8
1 9
1 13
1 15
1 17
1 21
1 22
1 25
1 31
1 33
1 34
1 35
1 38
1 40
1 42
1 43
1 44
1 47
1 49
1 52
1 53
1 54
1 56
1 57
1 59
1 60
1 62
1 64
1 65
1 68
1 71
1 78
1 79
1 80
1 81
1 87
1 89
1 90
1 93
1 94
1 96
1 98
1 100
1 102
1 103
1 109
1 113
1 115
1 116
1 118
1 120
1 121
1 125
1 ...

input:

4
5000 2508
1 2
1 3
1 5
1 8
1 9
1 13
1 15
1 17
1 21
1 22
1 25
1 31
1 33
1 34
1 35
1 38
1 40
1 42
1 43
1 44
1 47
1 49
1 52
1 53
1 54
1 56
1 57
1 59
1 60
1 62
1 64
1 65
1 68
1 71
1 78
1 79
1 80
1 81
1 87
1 89
1 90
1 93
1 94
1 96
1 98
1 100
1 102
1 103
1 109
1 113
1 115
1 116
1 118
1 120
1 121
1 125
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
21314775

Test #19:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1828kb

input:

5
5559540

output:

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

input:

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

output:

6
5000 2504
1 3
2 4
2 6
2 7
2 10
2 11
2 12
2 15
2 16
2 18
2 19
2 20
2 23
2 24
2 25
2 27
2 29
2 30
2 32
2 36
2 37
2 39
2 41
2 45
2 46
2 47
2 48
2 50
2 51
2 53
2 58
2 59
2 60
2 61
2 63
2 65
2 66
2 67
2 68
2 69
2 70
2 72
2 74
2 75
2 82
2 83
2 84
2 85
2 86
2 89
2 90
2 91
2 92
2 95
2 96
2 97
2 99
2 100
2...

input:

6
5000 2504
1 3
2 4
2 6
2 7
2 10
2 11
2 12
2 15
2 16
2 18
2 19
2 20
2 23
2 24
2 25
2 27
2 29
2 30
2 32
2 36
2 37
2 39
2 41
2 45
2 46
2 47
2 48
2 50
2 51
2 53
2 58
2 59
2 60
2 61
2 63
2 65
2 66
2 67
2 68
2 69
2 70
2 72
2 74
2 75
2 82
2 83
2 84
2 85
2 86
2 89
2 90
2 91
2 92
2 95
2 96
2 97
2 99
2 100
2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5559540

Test #20:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1876kb,1824kb

input:

5
9424319

output:

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

input:

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

output:

6
5000 2507
1 2
1 5
1 8
1 9
1 13
1 14
1 17
1 18
1 21
1 22
1 23
1 25
1 29
1 31
1 32
1 33
1 38
1 42
1 43
1 44
1 46
1 48
1 49
1 52
1 53
1 55
1 56
1 57
1 59
1 62
1 71
1 73
1 75
1 77
1 79
1 80
1 81
1 83
1 85
1 87
1 88
1 93
1 94
1 96
1 98
1 102
1 103
1 108
1 109
1 113
1 116
1 121
1 123
1 125
1 129
1 131
1...

input:

6
5000 2507
1 2
1 5
1 8
1 9
1 13
1 14
1 17
1 18
1 21
1 22
1 23
1 25
1 29
1 31
1 32
1 33
1 38
1 42
1 43
1 44
1 46
1 48
1 49
1 52
1 53
1 55
1 56
1 57
1 59
1 62
1 71
1 73
1 75
1 77
1 79
1 80
1 81
1 83
1 85
1 87
1 88
1 93
1 94
1 96
1 98
1 102
1 103
1 108
1 109
1 113
1 116
1 121
1 123
1 125
1 129
1 131
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
9424319

Test #21:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1824kb

input:

5
10955780

output:

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

input:

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

output:

6
5000 2501
1 3
2 4
2 6
2 7
2 10
2 11
2 12
2 14
2 16
2 19
2 20
2 21
2 24
2 25
2 26
2 27
2 29
2 30
2 34
2 35
2 36
2 37
2 39
2 40
2 41
2 42
2 45
2 50
2 51
2 53
2 54
2 58
2 61
2 63
2 64
2 66
2 67
2 68
2 69
2 70
2 72
2 73
2 74
2 76
2 77
2 78
2 82
2 86
2 88
2 89
2 91
2 92
2 95
2 97
2 98
2 99
2 100
2 101
...

input:

6
5000 2501
1 3
2 4
2 6
2 7
2 10
2 11
2 12
2 14
2 16
2 19
2 20
2 21
2 24
2 25
2 26
2 27
2 29
2 30
2 34
2 35
2 36
2 37
2 39
2 40
2 41
2 42
2 45
2 50
2 51
2 53
2 54
2 58
2 61
2 63
2 64
2 66
2 67
2 68
2 69
2 70
2 72
2 73
2 74
2 76
2 77
2 78
2 82
2 86
2 88
2 89
2 91
2 92
2 95
2 97
2 98
2 99
2 100
2 101
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
10955780

Test #22:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1824kb

input:

7
19938721

output:

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

input:

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

output:

8
5000 2500
1 3
1 5
1 8
1 9
1 13
1 15
1 17
1 18
1 22
1 24
1 25
1 26
1 28
1 29
1 30
1 31
1 33
1 34
1 38
1 42
1 43
1 44
1 45
1 47
1 49
1 52
1 53
1 56
1 57
1 59
1 60
1 62
1 65
1 68
1 71
1 75
1 78
1 79
1 80
1 81
1 83
1 84
1 85
1 87
1 89
1 90
1 93
1 94
1 100
1 102
1 103
1 113
1 116
1 118
1 120
1 121
1 12...

input:

8
5000 2500
1 3
1 5
1 8
1 9
1 13
1 15
1 17
1 18
1 22
1 24
1 25
1 26
1 28
1 29
1 30
1 31
1 33
1 34
1 38
1 42
1 43
1 44
1 45
1 47
1 49
1 52
1 53
1 56
1 57
1 59
1 60
1 62
1 65
1 68
1 71
1 75
1 78
1 79
1 80
1 81
1 83
1 84
1 85
1 87
1 89
1 90
1 93
1 94
1 100
1 102
1 103
1 113
1 116
1 118
1 120
1 121
1 12...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
19938721

Test #23:

score: 30
Accepted
time: 0ms = 0ms + 0ms
memory: 1872kb,1824kb

input:

7
5129508

output:

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

input:

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

output:

8
5000 2500
1 3
1 5
1 8
1 9
1 13
1 17
1 22
1 23
1 28
1 29
1 31
1 33
1 35
1 38
1 43
1 44
1 46
1 48
1 49
1 52
1 54
1 55
1 56
1 57
1 62
1 64
1 65
1 71
1 76
1 77
1 79
1 80
1 81
1 83
1 85
1 87
1 88
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 121
1 123
1 125
1 128
1 133
1 135
1 137
1 139
1 ...

input:

8
5000 2500
1 3
1 5
1 8
1 9
1 13
1 17
1 22
1 23
1 28
1 29
1 31
1 33
1 35
1 38
1 43
1 44
1 46
1 48
1 49
1 52
1 54
1 55
1 56
1 57
1 62
1 64
1 65
1 71
1 76
1 77
1 79
1 80
1 81
1 83
1 85
1 87
1 88
1 93
1 94
1 98
1 102
1 103
1 108
1 109
1 111
1 113
1 116
1 121
1 123
1 125
1 128
1 133
1 135
1 137
1 139
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
5129508

Test #24:

score: 30
Accepted
time: 1ms = 1ms + 0ms
memory: 1872kb,1828kb

input:

7
15332941

output:

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

input:

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

output:

8
5000 2500
2 4
2 6
2 7
2 8
2 11
2 12
2 16
2 18
2 19
2 20
2 21
2 23
2 24
2 26
2 27
2 29
2 36
2 37
2 39
2 41
2 42
2 45
2 46
2 48
2 50
2 51
2 58
2 59
2 61
2 63
2 65
2 66
2 67
2 68
2 69
2 70
2 72
2 74
2 75
2 82
2 83
2 85
2 86
2 89
2 90
2 91
2 95
2 97
2 98
2 99
2 100
2 101
2 104
2 105
2 106
2 107
2 110
...

input:

8
5000 2500
2 4
2 6
2 7
2 8
2 11
2 12
2 16
2 18
2 19
2 20
2 21
2 23
2 24
2 26
2 27
2 29
2 36
2 37
2 39
2 41
2 42
2 45
2 46
2 48
2 50
2 51
2 58
2 59
2 61
2 63
2 65
2 66
2 67
2 68
2 69
2 70
2 72
2 74
2 75
2 82
2 83
2 85
2 86
2 89
2 90
2 91
2 95
2 97
2 98
2 99
2 100
2 101
2 104
2 105
2 106
2 107
2 110
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
15332941

Subtask #3:

score: 65
Accepted

Test #25:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1836kb

input:

1
355365355024496523

output:

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

input:

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

output:

2
5000 3293
1 4
1 5
1 6
1 9
1 10
1 15
1 16
1 18
1 19
1 23
1 25
1 26
1 29
1 32
1 33
1 42
1 45
1 48
1 50
1 53
1 60
1 61
1 62
1 63
1 65
1 71
1 75
1 76
1 79
1 83
1 91
1 94
1 99
1 100
1 101
1 102
1 103
1 105
1 106
1 110
1 112
1 114
1 118
1 120
1 121
1 126
1 128
1 129
1 131
1 136
1 137
1 138
1 145
1 147
1...

input:

2
5000 3293
1 4
1 5
1 6
1 9
1 10
1 15
1 16
1 18
1 19
1 23
1 25
1 26
1 29
1 32
1 33
1 42
1 45
1 48
1 50
1 53
1 60
1 61
1 62
1 63
1 65
1 71
1 75
1 76
1 79
1 83
1 91
1 94
1 99
1 100
1 101
1 102
1 103
1 105
1 106
1 110
1 112
1 114
1 118
1 120
1 121
1 126
1 128
1 129
1 131
1 136
1 137
1 138
1 145
1 147
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
355365355024496523

Test #26:

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

input:

1
727827999106414164

output:

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

input:

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

output:

2
5000 3293
1 10
1 15
1 19
1 22
1 23
1 26
1 28
1 30
1 35
1 48
1 49
1 52
1 54
1 56
1 57
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 71
1 72
1 76
1 79
1 82
1 98
1 99
1 103
1 105
1 106
1 108
1 113
1 115
1 118
1 120
1 128
1 129
1 130
1 134
1 136
1 137
1 139
1 145
1 146
1 152
1 161
1 162
1 166
1 169
1 171
1 172...

input:

2
5000 3293
1 10
1 15
1 19
1 22
1 23
1 26
1 28
1 30
1 35
1 48
1 49
1 52
1 54
1 56
1 57
1 60
1 61
1 62
1 63
1 64
1 65
1 66
1 71
1 72
1 76
1 79
1 82
1 98
1 99
1 103
1 105
1 106
1 108
1 113
1 115
1 118
1 120
1 128
1 129
1 130
1 134
1 136
1 137
1 139
1 145
1 146
1 152
1 161
1 162
1 166
1 169
1 171
1 172...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
727827999106414164

Test #27:

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

input:

1
656410143989222955

output:

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

input:

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

output:

2
5000 3293
1 5
1 10
1 13
1 16
1 22
1 25
1 26
1 30
1 33
1 34
1 35
1 45
1 46
1 49
1 52
1 53
1 54
1 56
1 57
1 61
1 62
1 63
1 64
1 71
1 77
1 79
1 83
1 94
1 99
1 100
1 103
1 107
1 110
1 114
1 118
1 121
1 122
1 129
1 134
1 136
1 137
1 145
1 146
1 149
1 151
1 152
1 155
1 159
1 162
1 163
1 164
1 171
1 176
...

input:

2
5000 3293
1 5
1 10
1 13
1 16
1 22
1 25
1 26
1 30
1 33
1 34
1 35
1 45
1 46
1 49
1 52
1 53
1 54
1 56
1 57
1 61
1 62
1 63
1 64
1 71
1 77
1 79
1 83
1 94
1 99
1 100
1 103
1 107
1 110
1 114
1 118
1 121
1 122
1 129
1 134
1 136
1 137
1 145
1 146
1 149
1 151
1 152
1 155
1 159
1 162
1 163
1 164
1 171
1 176
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
656410143989222955

Test #28:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1836kb

input:

1
410366615149657534

output:

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

input:

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

output:

2
5000 3293
1 4
1 5
1 8
1 9
1 15
1 16
1 17
1 18
1 19
1 22
1 29
1 32
1 33
1 34
1 42
1 49
1 56
1 60
1 62
1 66
1 70
1 71
1 75
1 79
1 83
1 91
1 94
1 100
1 101
1 102
1 103
1 106
1 107
1 112
1 113
1 120
1 122
1 126
1 127
1 131
1 137
1 139
1 147
1 149
1 154
1 159
1 161
1 164
1 168
1 169
1 175
1 177
1 178
1...

input:

2
5000 3293
1 4
1 5
1 8
1 9
1 15
1 16
1 17
1 18
1 19
1 22
1 29
1 32
1 33
1 34
1 42
1 49
1 56
1 60
1 62
1 66
1 70
1 71
1 75
1 79
1 83
1 91
1 94
1 100
1 101
1 102
1 103
1 106
1 107
1 112
1 113
1 120
1 122
1 126
1 127
1 131
1 137
1 139
1 147
1 149
1 154
1 159
1 161
1 164
1 168
1 169
1 175
1 177
1 178
1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
410366615149657534

Test #29:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1868kb,1840kb

input:

1
298090682780948428

output:

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

input:

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

output:

2
5000 3293
1 4
1 10
1 13
1 16
1 17
1 18
1 19
1 20
1 22
1 23
1 28
1 29
1 30
1 42
1 48
1 49
1 62
1 63
1 65
1 66
1 72
1 75
1 76
1 79
1 82
1 94
1 98
1 99
1 101
1 102
1 103
1 105
1 106
1 108
1 112
1 113
1 115
1 118
1 120
1 121
1 126
1 128
1 129
1 130
1 134
1 137
1 139
1 145
1 149
1 152
1 153
1 158
1 161...

input:

2
5000 3293
1 4
1 10
1 13
1 16
1 17
1 18
1 19
1 20
1 22
1 23
1 28
1 29
1 30
1 42
1 48
1 49
1 62
1 63
1 65
1 66
1 72
1 75
1 76
1 79
1 82
1 94
1 98
1 99
1 101
1 102
1 103
1 105
1 106
1 108
1 112
1 113
1 115
1 118
1 120
1 121
1 126
1 128
1 129
1 130
1 134
1 137
1 139
1 145
1 149
1 152
1 153
1 158
1 161...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
298090682780948428

Test #30:

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

input:

3
969441916331132577

output:

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

input:

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

output:

4
5000 2559
1 2
1 4
1 5
1 6
1 9
1 10
1 12
1 13
1 14
1 17
1 19
1 20
1 23
1 24
1 25
1 27
1 28
1 30
1 31
1 33
1 35
1 37
1 41
1 42
1 43
1 45
1 46
1 48
1 50
1 53
1 54
1 56
1 58
1 62
1 64
1 68
1 73
1 76
1 79
1 83
1 85
1 86
1 87
1 89
1 90
1 92
1 94
1 95
1 98
1 100
1 101
1 103
1 106
1 107
1 109
1 110
1 112
...

input:

4
5000 2559
1 2
1 4
1 5
1 6
1 9
1 10
1 12
1 13
1 14
1 17
1 19
1 20
1 23
1 24
1 25
1 27
1 28
1 30
1 31
1 33
1 35
1 37
1 41
1 42
1 43
1 45
1 46
1 48
1 50
1 53
1 54
1 56
1 58
1 62
1 64
1 68
1 73
1 76
1 79
1 83
1 85
1 86
1 87
1 89
1 90
1 92
1 94
1 95
1 98
1 100
1 101
1 103
1 106
1 107
1 109
1 110
1 112
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
969441916331132577

Test #31:

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

input:

3
929489812741933634

output:

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

input:

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

output:

4
5000 2527
1 2
1 5
1 6
1 10
1 12
1 13
1 14
1 16
1 17
1 19
1 20
1 23
1 24
1 26
1 27
1 30
1 32
1 33
1 35
1 36
1 38
1 40
1 41
1 43
1 44
1 45
1 46
1 48
1 50
1 51
1 52
1 54
1 55
1 58
1 59
1 64
1 69
1 73
1 74
1 77
1 79
1 80
1 86
1 87
1 88
1 91
1 92
1 93
1 94
1 95
1 96
1 97
1 98
1 101
1 103
1 104
1 106
1 ...

input:

4
5000 2527
1 2
1 5
1 6
1 10
1 12
1 13
1 14
1 16
1 17
1 19
1 20
1 23
1 24
1 26
1 27
1 30
1 32
1 33
1 35
1 36
1 38
1 40
1 41
1 43
1 44
1 45
1 46
1 48
1 50
1 51
1 52
1 54
1 55
1 58
1 59
1 64
1 69
1 73
1 74
1 77
1 79
1 80
1 86
1 87
1 88
1 91
1 92
1 93
1 94
1 95
1 96
1 97
1 98
1 101
1 103
1 104
1 106
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
929489812741933634

Test #32:

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

input:

3
144032041325838295

output:

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

input:

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

output:

4
5000 2508
1 2
1 4
1 6
1 7
1 9
1 10
1 12
1 15
1 16
1 18
1 21
1 22
1 25
1 27
1 29
1 30
1 32
1 34
1 36
1 37
1 40
1 41
1 42
1 43
1 47
1 50
1 53
1 57
1 59
1 60
1 61
1 65
1 66
1 67
1 68
1 70
1 72
1 75
1 78
1 79
1 81
1 82
1 86
1 87
1 89
1 90
1 91
1 92
1 94
1 95
1 97
1 98
1 100
1 102
1 103
1 104
1 105
1 1...

input:

4
5000 2508
1 2
1 4
1 6
1 7
1 9
1 10
1 12
1 15
1 16
1 18
1 21
1 22
1 25
1 27
1 29
1 30
1 32
1 34
1 36
1 37
1 40
1 41
1 42
1 43
1 47
1 50
1 53
1 57
1 59
1 60
1 61
1 65
1 66
1 67
1 68
1 70
1 72
1 75
1 78
1 79
1 81
1 82
1 86
1 87
1 89
1 90
1 91
1 92
1 94
1 95
1 97
1 98
1 100
1 102
1 103
1 104
1 105
1 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
144032041325838295

Test #33:

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

input:

3
832110946250826180

output:

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

input:

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

output:

4
5000 2539
1 2
2 6
2 9
2 10
2 11
2 12
2 16
2 17
2 18
2 19
2 20
2 21
2 22
2 24
2 25
2 30
2 34
2 36
2 37
2 38
2 39
2 44
2 45
2 50
2 52
2 53
2 59
2 63
2 65
2 66
2 68
2 72
2 75
2 77
2 78
2 80
2 81
2 82
2 83
2 85
2 86
2 87
2 88
2 89
2 92
2 93
2 94
2 95
2 96
2 97
2 98
2 99
2 100
2 101
2 102
2 104
2 106
2...

input:

4
5000 2539
1 2
2 6
2 9
2 10
2 11
2 12
2 16
2 17
2 18
2 19
2 20
2 21
2 22
2 24
2 25
2 30
2 34
2 36
2 37
2 38
2 39
2 44
2 45
2 50
2 52
2 53
2 59
2 63
2 65
2 66
2 68
2 72
2 75
2 77
2 78
2 80
2 81
2 82
2 83
2 85
2 86
2 87
2 88
2 89
2 92
2 93
2 94
2 95
2 96
2 97
2 98
2 99
2 100
2 101
2 102
2 104
2 106
2...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
832110946250826180

Test #34:

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

input:

3
85728715707691821

output:

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

input:

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

output:

4
5000 2511
1 2
1 3
1 4
1 5
1 9
1 10
1 14
1 15
1 16
1 17
1 20
1 23
1 25
1 28
1 29
1 32
1 33
1 35
1 36
1 37
1 43
1 47
1 48
1 49
1 53
1 54
1 55
1 56
1 57
1 58
1 60
1 63
1 64
1 69
1 71
1 73
1 76
1 79
1 81
1 83
1 85
1 86
1 90
1 92
1 94
1 97
1 98
1 99
1 102
1 103
1 104
1 107
1 108
1 109
1 111
1 113
1 120...

input:

4
5000 2511
1 2
1 3
1 4
1 5
1 9
1 10
1 14
1 15
1 16
1 17
1 20
1 23
1 25
1 28
1 29
1 32
1 33
1 35
1 36
1 37
1 43
1 47
1 48
1 49
1 53
1 54
1 55
1 56
1 57
1 58
1 60
1 63
1 64
1 69
1 71
1 73
1 76
1 79
1 81
1 83
1 85
1 86
1 90
1 92
1 94
1 97
1 98
1 99
1 102
1 103
1 104
1 107
1 108
1 109
1 111
1 113
1 120...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
85728715707691821

Test #35:

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

input:

5
777434612360931036

output:

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

input:

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

output:

6
5000 2500
1 3
2 4
2 8
2 11
2 12
2 16
2 17
2 18
2 19
2 20
2 23
2 24
2 25
2 27
2 29
2 30
2 36
2 37
2 39
2 41
2 45
2 48
2 49
2 51
2 53
2 55
2 56
2 58
2 59
2 65
2 66
2 69
2 72
2 74
2 75
2 81
2 82
2 83
2 84
2 85
2 86
2 90
2 94
2 95
2 97
2 101
2 102
2 104
2 106
2 107
2 108
2 111
2 112
2 113
2 114
2 117
...

input:

6
5000 2500
1 3
2 4
2 8
2 11
2 12
2 16
2 17
2 18
2 19
2 20
2 23
2 24
2 25
2 27
2 29
2 30
2 36
2 37
2 39
2 41
2 45
2 48
2 49
2 51
2 53
2 55
2 56
2 58
2 59
2 65
2 66
2 69
2 72
2 74
2 75
2 81
2 82
2 83
2 84
2 85
2 86
2 90
2 94
2 95
2 97
2 101
2 102
2 104
2 106
2 107
2 108
2 111
2 112
2 113
2 114
2 117
...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
777434612360931036

Test #36:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1876kb,1824kb

input:

5
705262511549880222

output:

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

input:

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

output:

6
5000 2511
1 2
1 6
1 7
1 10
1 14
1 16
1 21
1 22
1 26
1 29
1 34
1 35
1 36
1 42
1 43
1 44
1 50
1 52
1 54
1 55
1 56
1 57
1 61
1 63
1 64
1 66
1 67
1 71
1 72
1 73
1 76
1 78
1 79
1 80
1 81
1 82
1 83
1 85
1 87
1 90
1 91
1 92
1 93
1 94
1 97
1 98
1 99
1 103
1 104
1 107
1 108
1 113
1 116
1 117
1 118
1 119
1 ...

input:

6
5000 2511
1 2
1 6
1 7
1 10
1 14
1 16
1 21
1 22
1 26
1 29
1 34
1 35
1 36
1 42
1 43
1 44
1 50
1 52
1 54
1 55
1 56
1 57
1 61
1 63
1 64
1 66
1 67
1 71
1 72
1 73
1 76
1 78
1 79
1 80
1 81
1 82
1 83
1 85
1 87
1 90
1 91
1 92
1 93
1 94
1 97
1 98
1 99
1 103
1 104
1 107
1 108
1 113
1 116
1 117
1 118
1 119
1 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
705262511549880222

Test #37:

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

input:

5
510318082834167951

output:

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

input:

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

output:

6
5000 2541
1 3
2 4
2 5
2 6
2 7
2 9
2 10
2 11
2 12
2 16
2 18
2 20
2 21
2 23
2 24
2 26
2 28
2 29
2 33
2 36
2 38
2 39
2 40
2 45
2 46
2 48
2 50
2 55
2 57
2 58
2 61
2 65
2 67
2 75
2 76
2 84
2 86
2 87
2 90
2 91
2 92
2 94
2 95
2 97
2 104
2 105
2 108
2 109
2 111
2 115
2 117
2 118
2 119
2 120
2 122
2 123
2 ...

input:

6
5000 2541
1 3
2 4
2 5
2 6
2 7
2 9
2 10
2 11
2 12
2 16
2 18
2 20
2 21
2 23
2 24
2 26
2 28
2 29
2 33
2 36
2 38
2 39
2 40
2 45
2 46
2 48
2 50
2 55
2 57
2 58
2 61
2 65
2 67
2 75
2 76
2 84
2 86
2 87
2 90
2 91
2 92
2 94
2 95
2 97
2 104
2 105
2 108
2 109
2 111
2 115
2 117
2 118
2 119
2 120
2 122
2 123
2 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
510318082834167951

Test #38:

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

input:

5
914858813253258744

output:

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

input:

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

output:

6
5000 2548
1 5
1 8
1 12
1 13
1 14
1 16
1 17
1 18
1 19
1 21
1 24
1 26
1 28
1 29
1 30
1 32
1 33
1 34
1 36
1 37
1 38
1 40
1 42
1 43
1 44
1 45
1 46
1 49
1 51
1 52
1 58
1 59
1 68
1 71
1 73
1 74
1 75
1 78
1 79
1 80
1 86
1 89
1 90
1 91
1 93
1 94
1 95
1 97
1 98
1 100
1 101
1 103
1 104
1 105
1 106
1 109
1 1...

input:

6
5000 2548
1 5
1 8
1 12
1 13
1 14
1 16
1 17
1 18
1 19
1 21
1 24
1 26
1 28
1 29
1 30
1 32
1 33
1 34
1 36
1 37
1 38
1 40
1 42
1 43
1 44
1 45
1 46
1 49
1 51
1 52
1 58
1 59
1 68
1 71
1 73
1 74
1 75
1 78
1 79
1 80
1 86
1 89
1 90
1 91
1 93
1 94
1 95
1 97
1 98
1 100
1 101
1 103
1 104
1 105
1 106
1 109
1 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
914858813253258744

Test #39:

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

input:

5
659635316746638238

output:

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

input:

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

output:

6
5000 2502
1 2
2 6
2 7
2 8
2 11
2 14
2 15
2 18
2 22
2 23
2 24
2 25
2 28
2 30
2 31
2 37
2 38
2 39
2 40
2 44
2 45
2 46
2 47
2 48
2 50
2 52
2 53
2 55
2 56
2 59
2 60
2 61
2 62
2 67
2 70
2 71
2 72
2 73
2 75
2 80
2 82
2 87
2 90
2 91
2 93
2 96
2 98
2 101
2 102
2 105
2 108
2 109
2 111
2 112
2 115
2 116
2 1...

input:

6
5000 2502
1 2
2 6
2 7
2 8
2 11
2 14
2 15
2 18
2 22
2 23
2 24
2 25
2 28
2 30
2 31
2 37
2 38
2 39
2 40
2 44
2 45
2 46
2 47
2 48
2 50
2 52
2 53
2 55
2 56
2 59
2 60
2 61
2 62
2 67
2 70
2 71
2 72
2 73
2 75
2 80
2 82
2 87
2 90
2 91
2 93
2 96
2 98
2 101
2 102
2 105
2 108
2 109
2 111
2 112
2 115
2 116
2 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659635316746638238

Test #40:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1868kb,1828kb

input:

7
858490260563149759

output:

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

input:

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

output:

8
5000 2500
1 4
1 6
1 7
1 10
1 12
1 14
1 16
1 20
1 21
1 23
1 25
1 26
1 29
1 32
1 35
1 36
1 42
1 43
1 46
1 48
1 50
1 51
1 53
1 54
1 56
1 57
1 58
1 61
1 64
1 66
1 67
1 68
1 69
1 70
1 71
1 72
1 73
1 74
1 76
1 77
1 79
1 81
1 82
1 83
1 84
1 85
1 86
1 88
1 89
1 91
1 92
1 95
1 96
1 97
1 100
1 103
1 104
1 1...

input:

8
5000 2500
1 4
1 6
1 7
1 10
1 12
1 14
1 16
1 20
1 21
1 23
1 25
1 26
1 29
1 32
1 35
1 36
1 42
1 43
1 46
1 48
1 50
1 51
1 53
1 54
1 56
1 57
1 58
1 61
1 64
1 66
1 67
1 68
1 69
1 70
1 71
1 72
1 73
1 74
1 76
1 77
1 79
1 81
1 82
1 83
1 84
1 85
1 86
1 88
1 89
1 91
1 92
1 95
1 96
1 97
1 100
1 103
1 104
1 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
858490260563149759

Test #41:

score: 65
Accepted
time: 0ms = 0ms + 0ms
memory: 1876kb,1828kb

input:

7
860058643727731209

output:

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

input:

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

output:

8
5000 2500
1 3
1 4
1 6
1 7
1 10
1 19
1 20
1 22
1 24
1 25
1 27
1 28
1 31
1 34
1 35
1 41
1 43
1 45
1 46
1 50
1 51
1 53
1 54
1 57
1 59
1 61
1 62
1 63
1 64
1 65
1 66
1 67
1 68
1 69
1 71
1 72
1 74
1 77
1 78
1 79
1 81
1 82
1 83
1 84
1 85
1 86
1 87
1 88
1 89
1 91
1 92
1 96
1 99
1 100
1 103
1 106
1 107
1 1...

input:

8
5000 2500
1 3
1 4
1 6
1 7
1 10
1 19
1 20
1 22
1 24
1 25
1 27
1 28
1 31
1 34
1 35
1 41
1 43
1 45
1 46
1 50
1 51
1 53
1 54
1 57
1 59
1 61
1 62
1 63
1 64
1 65
1 66
1 67
1 68
1 69
1 71
1 72
1 74
1 77
1 78
1 79
1 81
1 82
1 83
1 84
1 85
1 86
1 87
1 88
1 89
1 91
1 92
1 96
1 99
1 100
1 103
1 106
1 107
1 1...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
860058643727731209

Test #42:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1868kb,1824kb

input:

7
718861404514377808

output:

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

input:

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

output:

8
5000 2500
2 4
2 5
2 10
2 11
2 13
2 14
2 17
2 18
2 19
2 20
2 23
2 25
2 27
2 29
2 31
2 33
2 38
2 39
2 41
2 42
2 48
2 49
2 53
2 58
2 59
2 68
2 70
2 73
2 75
2 83
2 84
2 85
2 89
2 90
2 92
2 97
2 100
2 101
2 102
2 106
2 109
2 110
2 112
2 114
2 120
2 121
2 124
2 125
2 126
2 129
2 134
2 140
2 141
2 143
2 ...

input:

8
5000 2500
2 4
2 5
2 10
2 11
2 13
2 14
2 17
2 18
2 19
2 20
2 23
2 25
2 27
2 29
2 31
2 33
2 38
2 39
2 41
2 42
2 48
2 49
2 53
2 58
2 59
2 68
2 70
2 73
2 75
2 83
2 84
2 85
2 89
2 90
2 92
2 97
2 100
2 101
2 102
2 106
2 109
2 110
2 112
2 114
2 120
2 121
2 124
2 125
2 126
2 129
2 134
2 140
2 141
2 143
2 ...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
718861404514377808

Test #43:

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

input:

7
659192688464047828

output:

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

input:

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

output:

8
5000 2500
1 4
1 9
1 10
1 12
1 15
1 16
1 17
1 21
1 22
1 23
1 27
1 28
1 35
1 36
1 40
1 41
1 42
1 43
1 46
1 47
1 48
1 49
1 54
1 55
1 56
1 57
1 59
1 60
1 62
1 64
1 65
1 66
1 70
1 72
1 79
1 81
1 82
1 84
1 86
1 87
1 90
1 92
1 94
1 95
1 103
1 104
1 107
1 108
1 110
1 113
1 114
1 115
1 116
1 117
1 119
1 12...

input:

8
5000 2500
1 4
1 9
1 10
1 12
1 15
1 16
1 17
1 21
1 22
1 23
1 27
1 28
1 35
1 36
1 40
1 41
1 42
1 43
1 46
1 47
1 48
1 49
1 54
1 55
1 56
1 57
1 59
1 60
1 62
1 64
1 65
1 66
1 70
1 72
1 79
1 81
1 82
1 84
1 86
1 87
1 90
1 92
1 94
1 95
1 103
1 104
1 107
1 108
1 110
1 113
1 114
1 115
1 116
1 117
1 119
1 12...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
659192688464047828

Test #44:

score: 65
Accepted
time: 1ms = 1ms + 0ms
memory: 1868kb,1828kb

input:

7
685730986714800201

output:

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

input:

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

output:

8
5000 2500
1 3
1 5
1 8
1 9
1 12
1 13
1 15
1 16
1 17
1 18
1 22
1 24
1 25
1 26
1 27
1 28
1 32
1 33
1 34
1 36
1 40
1 41
1 43
1 44
1 45
1 46
1 47
1 49
1 51
1 52
1 53
1 55
1 56
1 57
1 60
1 63
1 65
1 69
1 74
1 75
1 76
1 78
1 79
1 80
1 81
1 90
1 91
1 93
1 94
1 95
1 96
1 97
1 98
1 99
1 103
1 104
1 105
1 10...

input:

8
5000 2500
1 3
1 5
1 8
1 9
1 12
1 13
1 15
1 16
1 17
1 18
1 22
1 24
1 25
1 26
1 27
1 28
1 32
1 33
1 34
1 36
1 40
1 41
1 43
1 44
1 45
1 46
1 47
1 49
1 51
1 52
1 53
1 55
1 56
1 57
1 60
1 63
1 65
1 69
1 74
1 75
1 76
1 78
1 79
1 80
1 81
1 90
1 91
1 93
1 94
1 95
1 96
1 97
1 98
1 99
1 103
1 104
1 105
1 10...

output:

08e2277017156c65e2df558ef1d27eae814767ea6a771d5be687d4040371b97399dd6bd28d5207cce21e4e205ea711c730f7ccf85a21af8c41bab7c037b89e9e
685730986714800201