QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#863827#8117. MostoviUnforgettablepl30 326ms4096kbC++20898b2025-01-19 23:11:442025-01-19 23:11:44

Judging History

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

  • [2025-01-19 23:11:44]
  • 评测
  • 测评结果:30
  • 用时:326ms
  • 内存:4096kb
  • [2025-01-19 23:11:44]
  • 提交

answer

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

#define int long long


const int modulo = 1e9+7;

int32_t main(){
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	int n,m;
	cin >> n >> m;
	vector<vector<int>> adj(n+1);
	vector<pair<int,int>> edges(m);
	for(int i=0;i<m;i++){
		int a,b;
		cin >> a >> b;
		edges[i]={a,b};
		adj[a].emplace_back(b);
		adj[b].emplace_back(a);
	}
	int ans = 0;
	for(int i=0;i<m;i++){
		int avoid_1 = edges[i].first;
		int avoid_2 = edges[i].second;
		int tot = 0;
		vector<bool> visited(n+1);
		function<void(int)> dfs = [&](int x){
			if(x==avoid_1 or x==avoid_2 or visited[x])return;
			visited[x]=true;
			tot++;
			for(int&y:adj[x])dfs(y);
		};
		if(avoid_1!=1 and avoid_2!=1)dfs(1);
		else if(avoid_1!=2 and avoid_2!=2)dfs(2);
		else if(avoid_1!=3 and avoid_2!=3)dfs(3);
		if(tot!=n-2)ans++;
	}
	cout << ans << '\n';
}

详细

Subtask #1:

score: 13
Accepted

Test #1:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 139
65 67
11 10
16 18
13 14
37 39
69 67
7 6
38 41
40 38
22 28
98 94
50 49
73 72
10 12
38 37
75 72
47 43
81 83
66 65
76 72
94 97
76 73
66 64
2 5
91 92
74 73
81 78
33 29
27 23
93 96
31 35
53 55
36 35
7 5
87 90
46 43
34 35
12 13
73 75
39 38
87 91
20 19
30 31
56 50
2 1
1 4
43 42
24 23
76 75
1 3
72 71...

output:

108

result:

ok single line: '108'

Test #2:

score: 13
Accepted
time: 0ms
memory: 3584kb

input:

98 139
8 9
17 19
85 87
65 64
24 23
2 7
34 32
98 94
67 68
24 27
46 45
40 37
51 50
70 71
90 89
29 31
82 78
93 97
13 8
70 68
48 46
17 20
8 10
51 56
94 93
7 5
92 95
72 77
65 67
91 92
7 8
3 1
37 39
24 25
86 89
16 17
28 25
67 69
78 79
26 22
25 27
83 80
61 62
19 18
20 16
84 81
43 42
35 36
31 34
7 6
33 31
4...

output:

95

result:

ok single line: '95'

Test #3:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 139
37 42
48 47
31 29
86 88
22 25
55 54
19 18
28 27
86 89
46 48
51 50
91 92
87 86
89 88
6 2
81 78
96 95
22 26
55 50
23 22
43 44
21 18
8 10
84 85
59 58
15 14
37 40
84 79
2 4
13 14
56 55
21 16
10 13
95 92
72 71
68 66
94 95
35 29
61 58
11 10
15 16
4 7
71 74
46 47
36 35
43 49
15 17
76 71
84 78
23 24
...

output:

103

result:

ok single line: '103'

Test #4:

score: 13
Accepted
time: 1ms
memory: 3584kb

input:

98 139
2 1
8 7
22 25
32 30
19 17
86 90
50 51
63 60
92 94
11 9
92 91
75 73
5 6
93 92
91 87
3 7
29 34
39 37
42 40
58 60
33 32
71 74
55 51
12 14
49 50
48 46
53 51
83 78
75 76
30 31
54 52
75 77
81 83
29 28
58 59
43 42
9 13
65 64
92 96
75 71
51 52
46 47
44 43
6 7
71 70
23 27
35 34
87 89
19 16
66 64
56 53...

output:

104

result:

ok single line: '104'

Test #5:

score: 13
Accepted
time: 0ms
memory: 3712kb

input:

98 139
75 72
2 6
78 82
71 73
76 74
42 43
38 36
1 3
36 35
91 92
61 60
8 14
30 34
28 25
2 7
97 92
21 19
72 71
58 57
93 92
7 8
22 23
64 63
44 48
86 90
57 56
8 12
78 80
59 58
52 56
32 30
3 2
95 97
69 70
65 64
11 9
77 73
23 27
35 32
90 91
43 44
79 81
1 5
15 19
53 56
56 50
45 46
49 47
26 25
16 15
30 33
62...

output:

102

result:

ok single line: '102'

Test #6:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 139
12 10
71 74
94 98
15 18
95 94
13 8
14 9
22 28
71 70
79 82
51 52
42 40
20 15
50 56
23 27
56 55
48 45
8 12
16 21
22 25
8 7
56 57
41 39
1 4
29 31
6 3
70 66
66 64
72 73
68 64
87 89
57 58
66 65
63 57
4 5
60 59
23 22
43 49
78 77
34 35
28 29
35 36
83 80
65 67
30 29
78 82
49 50
64 63
43 42
4 7
33 29
...

output:

103

result:

ok single line: '103'

Test #7:

score: 13
Accepted
time: 0ms
memory: 3712kb

input:

98 139
34 35
65 64
82 80
37 36
92 91
22 23
92 97
38 39
94 96
85 84
7 5
53 50
11 10
78 79
60 59
14 13
7 8
38 36
15 19
51 52
28 22
15 17
72 75
57 56
2 1
2 5
18 19
67 68
45 49
52 53
48 43
43 44
29 28
64 69
36 40
11 8
84 80
33 31
64 67
77 73
36 41
96 97
61 58
48 45
36 42
28 25
79 82
71 74
21 19
82 78
68...

output:

99

result:

ok single line: '99'

Test #8:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 139
95 92
39 42
42 43
85 88
58 60
17 15
15 14
97 92
89 88
29 31
10 8
55 54
28 29
37 39
41 37
59 62
7 2
9 11
50 49
37 36
8 12
57 60
4 7
15 20
22 24
63 58
79 82
6 5
86 85
68 66
82 80
95 93
64 63
19 18
80 79
77 72
35 36
36 40
77 78
32 29
26 23
65 69
31 34
9 12
16 15
8 7
49 46
71 72
79 78
42 38
22 26...

output:

103

result:

ok single line: '103'

Test #9:

score: 13
Accepted
time: 0ms
memory: 3712kb

input:

98 139
16 15
75 76
60 59
10 8
80 78
59 58
1 6
85 89
44 49
2 1
6 5
77 73
30 31
88 91
65 68
79 78
54 56
41 38
47 45
95 94
16 21
77 78
62 60
38 36
47 46
61 63
37 40
19 15
23 22
64 67
10 9
17 15
89 88
43 45
4 2
82 79
57 62
22 21
77 74
32 29
25 26
65 64
81 80
71 74
87 91
51 54
64 63
80 79
96 93
39 42
97 ...

output:

102

result:

ok single line: '102'

Test #10:

score: 13
Accepted
time: 0ms
memory: 3712kb

input:

98 139
73 75
2 6
29 28
36 37
13 10
56 57
81 78
67 66
40 42
86 89
57 58
23 22
96 95
71 70
62 61
63 62
89 88
73 72
80 82
74 76
52 50
76 77
67 70
56 54
95 92
48 46
20 16
1 4
2 1
47 48
14 11
37 38
98 97
65 64
17 15
30 29
27 24
15 14
68 67
14 12
25 28
46 43
21 19
87 89
59 58
8 12
53 51
79 81
70 69
18 16
...

output:

107

result:

ok single line: '107'

Test #11:

score: 13
Accepted
time: 0ms
memory: 3584kb

input:

98 181
75 76
2 3
16 17
61 59
36 38
72 77
14 15
31 34
86 89
77 71
37 40
15 17
92 97
49 47
25 24
74 71
65 67
84 80
32 30
11 14
31 32
93 95
58 60
37 39
16 20
51 53
93 98
13 9
68 69
46 49
19 15
57 62
34 32
1 6
24 26
10 9
83 78
97 95
58 57
47 48
43 46
74 75
56 53
76 74
37 41
76 77
27 24
2 5
58 61
54 56
1...

output:

103

result:

ok single line: '103'

Test #12:

score: 13
Accepted
time: 0ms
memory: 3584kb

input:

98 181
19 17
58 61
17 18
27 28
68 69
57 61
40 39
83 80
97 94
89 90
6 3
81 79
87 89
37 41
27 24
4 6
89 86
85 84
17 20
83 81
70 65
90 87
46 47
77 71
31 29
67 70
13 12
75 74
49 43
8 9
53 52
35 32
22 26
77 78
2 3
35 36
7 6
57 62
63 64
16 15
30 33
93 98
44 45
72 73
37 36
19 20
76 77
56 52
59 63
7 5
96 95...

output:

97

result:

ok single line: '97'

Test #13:

score: 13
Accepted
time: 0ms
memory: 3584kb

input:

98 181
33 31
94 95
29 33
46 44
5 3
91 86
50 51
19 15
57 61
23 22
70 65
83 81
53 50
78 77
76 74
91 89
87 86
92 91
79 81
88 86
21 22
14 10
37 38
85 88
6 4
12 8
38 36
38 40
52 56
58 60
72 76
14 15
20 19
15 16
20 15
83 80
24 23
64 67
75 76
25 26
9 8
1 5
21 19
45 48
73 76
78 79
28 29
82 84
54 52
24 26
4 ...

output:

104

result:

ok single line: '104'

Test #14:

score: 13
Accepted
time: 0ms
memory: 3584kb

input:

98 181
9 10
5 7
53 50
42 43
91 88
47 46
96 97
67 70
69 64
88 87
44 43
17 18
92 94
60 62
8 7
78 84
21 20
21 16
12 11
97 95
63 64
92 93
7 1
26 22
24 27
31 33
29 31
33 34
35 36
23 27
3 6
92 91
61 60
56 50
57 63
3 7
89 88
28 24
74 73
72 75
86 85
30 29
87 89
15 18
84 82
90 89
84 79
84 83
35 34
47 45
45 4...

output:

108

result:

ok single line: '108'

Test #15:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 181
92 95
95 97
93 98
93 96
45 46
74 71
52 54
84 82
38 41
90 86
79 82
64 65
30 33
38 39
36 35
53 56
12 13
77 71
84 85
49 44
31 35
72 73
39 42
63 57
63 61
51 54
22 27
67 64
75 76
22 26
17 18
85 86
9 11
18 16
1 4
94 92
40 36
63 59
15 17
65 67
34 32
13 11
43 44
36 37
50 55
68 65
43 46
78 77
50 54
23...

output:

110

result:

ok single line: '110'

Test #16:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 181
11 9
93 92
88 91
74 77
46 47
2 1
81 83
56 57
55 54
7 5
64 63
85 86
48 47
58 59
24 25
34 30
88 86
5 6
32 35
22 24
91 92
60 61
72 76
78 82
71 75
80 79
79 78
37 36
82 84
34 31
58 62
94 92
38 40
32 33
59 63
37 38
38 36
24 23
67 64
27 28
68 65
65 64
24 28
54 53
17 18
69 67
84 79
70 68
80 84
48 49
...

output:

111

result:

ok single line: '111'

Test #17:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 181
43 42
7 1
48 47
5 2
22 27
19 17
64 63
37 42
81 79
78 84
12 8
61 58
94 93
38 37
90 86
33 32
22 23
58 59
60 59
64 68
6 4
65 64
21 19
79 80
51 55
65 66
87 89
17 16
85 88
52 53
46 49
71 73
52 51
26 28
14 9
14 10
51 53
2 4
64 70
21 16
1 6
69 70
90 91
12 10
45 47
60 62
22 21
8 10
91 87
97 94
95 97
...

output:

103

result:

ok single line: '103'

Test #18:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 181
3 4
83 82
50 55
96 98
58 60
22 23
4 5
64 67
45 46
44 47
59 62
43 44
17 15
8 7
90 88
62 57
19 18
90 89
89 88
13 10
71 72
26 22
20 21
40 42
33 32
2 3
64 70
96 93
9 12
31 30
79 81
37 38
95 96
10 8
33 30
16 15
57 56
69 64
38 41
91 85
50 51
66 65
2 1
86 87
85 86
25 24
13 9
64 65
45 43
12 10
36 42
...

output:

107

result:

ok single line: '107'

Test #19:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 181
63 64
95 97
35 32
73 76
56 50
67 69
23 25
26 22
86 91
47 49
59 60
20 17
24 25
48 47
20 19
35 30
75 71
36 41
98 93
1 4
78 79
42 38
45 49
84 78
17 19
89 85
72 71
63 60
68 65
58 61
7 3
65 66
72 77
72 74
33 32
50 54
85 84
27 26
39 37
70 71
62 57
82 78
52 51
24 23
26 24
62 63
91 85
9 8
92 93
7 8
8...

output:

113

result:

ok single line: '113'

Test #20:

score: 13
Accepted
time: 0ms
memory: 3584kb

input:

98 181
88 89
18 15
67 70
41 42
30 34
37 39
88 87
32 29
15 21
80 84
77 73
42 43
72 71
4 5
79 81
91 86
25 23
43 44
37 40
54 50
67 66
67 68
84 85
63 57
14 15
61 60
69 68
43 46
55 54
34 32
12 11
29 30
11 10
32 33
63 58
87 85
87 91
56 52
96 94
10 8
6 4
58 60
33 30
25 26
37 36
22 26
70 71
75 74
51 53
67 6...

output:

103

result:

ok single line: '103'

Test #21:

score: 13
Accepted
time: 1ms
memory: 3584kb

input:

98 293
45 46
21 22
34 30
38 41
98 97
79 81
85 89
35 34
19 20
80 79
77 78
25 23
95 92
42 38
65 66
1 6
74 75
70 69
57 56
40 42
61 63
21 20
8 12
20 16
17 16
82 78
63 60
60 61
40 39
81 83
59 60
43 44
63 64
41 42
56 53
36 40
98 95
1 2
68 69
38 36
70 67
72 76
4 7
5 1
28 29
24 27
1 7
90 88
56 52
98 93
67 6...

output:

152

result:

ok single line: '152'

Test #22:

score: 13
Accepted
time: 1ms
memory: 3584kb

input:

98 293
6 4
47 48
44 49
96 95
73 71
55 50
58 57
25 23
34 33
32 29
42 43
43 45
74 77
89 90
98 93
14 10
4 1
12 8
43 49
25 26
52 51
19 18
61 59
42 39
64 69
81 84
89 85
34 31
76 72
62 61
78 77
14 11
53 50
18 16
86 87
93 95
69 70
41 36
3 6
17 19
41 40
3 7
92 91
18 15
27 23
49 47
40 36
35 34
51 55
24 23
85...

output:

149

result:

ok single line: '149'

Test #23:

score: 13
Accepted
time: 1ms
memory: 3584kb

input:

98 293
16 19
11 13
3 2
70 68
26 28
38 37
25 27
22 25
95 94
69 66
31 35
39 38
40 37
24 25
72 74
43 47
84 82
79 83
4 6
53 56
33 32
62 57
82 78
46 43
90 85
19 20
95 97
16 18
73 75
1 2
54 56
86 85
49 50
71 77
2 7
45 46
31 32
6 3
28 29
18 19
52 54
63 58
8 10
3 4
80 78
61 62
75 72
54 50
69 65
93 96
98 94
...

output:

149

result:

ok single line: '149'

Test #24:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 293
41 39
69 66
29 34
38 40
84 78
27 23
64 66
98 94
85 88
65 70
2 6
12 14
74 72
57 62
88 87
71 77
61 63
71 70
31 35
15 18
79 78
32 30
22 23
9 12
41 37
57 56
14 15
96 97
28 25
33 35
49 48
2 5
47 48
47 43
30 34
66 70
77 75
44 46
30 35
77 78
71 73
90 85
48 43
8 11
93 97
84 79
17 19
21 19
89 90
57 63...

output:

149

result:

ok single line: '149'

Test #25:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 293
92 98
78 77
6 5
53 51
56 57
2 1
63 62
7 4
47 44
88 91
85 86
15 14
28 23
68 70
95 98
31 30
47 43
91 92
63 64
10 12
11 12
40 37
83 78
70 69
29 28
92 96
56 52
23 26
66 69
7 6
69 64
80 81
28 25
25 26
11 8
84 79
5 4
65 70
1 6
85 87
72 71
9 8
10 9
53 50
59 62
85 90
91 89
71 74
20 15
37 41
13 14
36 ...

output:

151

result:

ok single line: '151'

Test #26:

score: 13
Accepted
time: 0ms
memory: 3712kb

input:

98 293
31 33
27 22
94 98
27 26
39 40
23 26
67 68
79 78
69 67
15 21
80 78
14 8
71 76
32 33
82 81
81 80
2 5
96 97
19 15
40 37
97 94
28 26
46 48
92 93
21 16
92 98
39 41
41 37
69 65
30 33
13 8
7 2
18 21
44 47
60 61
75 77
43 48
22 21
17 20
84 85
52 50
4 5
56 52
32 29
1 2
62 63
38 37
25 24
62 61
35 32
21 ...

output:

151

result:

ok single line: '151'

Test #27:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 293
48 45
6 2
45 49
3 1
40 37
83 81
94 97
54 52
90 91
64 63
72 74
2 1
4 7
90 88
97 95
69 66
68 65
13 11
13 14
67 64
77 78
94 96
43 46
89 90
35 32
93 98
75 71
62 59
89 86
87 85
28 25
11 14
51 50
75 77
64 66
15 20
57 59
76 75
72 71
71 74
24 22
17 16
10 14
93 95
34 30
41 42
23 22
17 20
76 73
16 21
1...

output:

147

result:

ok single line: '147'

Test #28:

score: 13
Accepted
time: 0ms
memory: 3712kb

input:

98 293
43 44
74 76
42 40
57 58
51 55
14 8
74 73
19 15
40 37
8 13
28 22
91 89
71 70
37 38
15 16
32 33
31 33
37 36
22 27
80 79
66 69
51 50
89 88
84 80
1 7
50 49
35 30
20 19
45 46
68 64
91 88
12 14
57 56
22 25
65 68
80 81
1 3
73 75
28 29
50 53
98 92
75 77
12 13
49 48
29 31
89 90
52 51
11 10
71 73
3 4
9...

output:

151

result:

ok single line: '151'

Test #29:

score: 13
Accepted
time: 0ms
memory: 3712kb

input:

98 293
16 21
95 96
14 12
75 72
93 95
44 46
57 61
51 54
34 31
25 22
50 51
89 85
10 12
63 58
25 24
25 26
52 54
24 27
17 18
62 61
10 11
9 8
57 58
74 72
25 23
35 33
22 28
79 83
64 65
68 69
62 63
91 92
2 3
38 36
36 39
11 14
35 29
42 40
32 31
70 64
20 19
70 68
85 91
35 36
70 71
75 73
77 72
34 33
98 93
93 ...

output:

152

result:

ok single line: '152'

Test #30:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

98 293
54 50
69 64
62 60
78 83
5 2
18 20
69 70
7 1
72 76
83 80
61 57
30 34
3 4
28 24
53 51
82 83
54 51
63 61
18 15
53 50
45 49
16 19
10 11
81 82
59 61
31 29
36 37
65 67
6 1
49 44
36 39
8 10
56 57
32 35
84 80
23 26
90 86
10 14
85 88
94 98
4 7
93 92
51 52
91 88
79 78
45 46
67 69
83 79
90 87
96 93
4 2
...

output:

150

result:

ok single line: '150'

Test #31:

score: 13
Accepted
time: 2ms
memory: 3712kb

input:

100 300
97 95
67 18
91 29
44 75
14 1
1 75
35 11
11 16
67 36
61 5
21 85
87 95
99 30
55 21
14 84
62 41
21 86
7 49
67 74
67 80
27 75
63 91
91 20
1 18
93 88
76 62
44 52
21 71
67 82
65 21
69 41
57 21
62 34
35 28
40 91
74 69
58 93
62 57
93 6
73 4
96 45
24 7
71 93
46 14
95 13
93 26
63 30
53 5
35 33
2 23
83...

output:

30

result:

ok single line: '30'

Test #32:

score: 13
Accepted
time: 0ms
memory: 3584kb

input:

100 300
60 55
35 4
73 49
30 63
10 84
68 29
35 27
9 21
43 28
3 4
32 22
35 54
43 52
70 21
7 30
3 9
21 28
64 21
15 21
92 30
55 83
67 29
35 81
4 8
43 38
16 5
43 45
68 10
2 29
80 15
43 35
29 44
4 17
70 55
34 12
85 55
49 58
63 41
39 31
42 48
3 5
29 8
53 75
5 51
55 59
21 75
22 30
88 46
67 31
83 58
27 90
4 ...

output:

39

result:

ok single line: '39'

Test #33:

score: 13
Accepted
time: 2ms
memory: 3712kb

input:

100 300
42 72
51 50
93 5
83 87
10 87
22 13
3 9
4 27
40 38
82 5
65 8
60 16
82 71
67 7
68 8
6 88
53 93
93 74
20 8
64 39
22 95
16 46
77 55
11 72
11 64
24 16
8 22
1 16
79 50
50 97
9 55
7 50
79 71
72 41
93 65
19 87
82 32
16 84
64 48
64 92
13 87
36 6
24 8
49 94
14 64
23 64
82 90
16 62
50 53
87 20
7 8
46 1...

output:

9

result:

ok single line: '9'

Test #34:

score: 13
Accepted
time: 2ms
memory: 3584kb

input:

100 300
41 83
10 6
15 73
23 22
29 55
24 29
2 3
55 58
27 75
84 95
57 68
21 18
68 82
77 84
77 93
33 84
4 6
48 58
22 75
78 92
21 26
58 1
82 13
78 41
32 58
36 22
2 46
84 50
58 71
9 66
33 6
91 36
38 43
74 76
62 23
36 4
20 24
78 23
35 1
98 60
84 98
65 13
44 78
38 84
69 99
75 40
17 16
84 83
41 95
31 6
78 4...

output:

27

result:

ok single line: '27'

Test #35:

score: 13
Accepted
time: 2ms
memory: 3584kb

input:

100 300
6 7
58 35
30 35
69 43
53 41
100 5
8 70
4 93
69 2
41 55
67 62
39 95
69 94
62 44
18 4
56 4
55 4
4 92
14 18
70 77
78 76
45 36
58 29
84 80
91 62
62 97
59 97
96 69
100 31
100 85
12 7
79 44
65 13
41 9
38 71
33 13
58 44
91 58
9 8
11 77
1 5
59 58
36 30
73 69
18 13
46 18
66 55
11 1
15 28
100 52
58 79...

output:

37

result:

ok single line: '37'

Test #36:

score: 13
Accepted
time: 1ms
memory: 3712kb

input:

100 300
4 83
5 78
26 98
34 5
94 70
25 58
24 40
84 78
42 89
90 64
80 11
1 55
17 25
66 35
71 86
29 52
67 75
63 75
3 54
75 26
70 34
96 50
87 65
98 32
72 18
34 43
6 27
30 18
25 44
74 88
37 12
85 13
41 90
79 9
76 96
86 70
62 74
26 70
21 7
18 17
30 91
79 44
83 76
4 96
48 76
83 19
7 5
5 6
4 5
68 36
59 74
8...

output:

7

result:

ok single line: '7'

Test #37:

score: 13
Accepted
time: 0ms
memory: 3584kb

input:

100 300
1 67
50 77
92 73
86 13
21 41
48 21
66 67
80 51
14 53
64 45
82 43
55 52
87 53
31 43
96 39
83 52
15 48
89 17
16 22
64 24
90 20
2 8
5 90
37 30
80 18
82 64
45 5
6 3
50 11
38 12
56 13
9 5
47 61
84 28
94 88
9 10
15 10
58 2
94 68
96 86
6 39
81 78
32 25
5 87
76 5
70 12
16 59
87 42
40 98
90 95
9 19
5...

output:

0

result:

ok single line: '0'

Test #38:

score: 13
Accepted
time: 2ms
memory: 3712kb

input:

100 300
21 80
49 42
50 76
89 35
78 72
32 52
16 17
87 90
63 75
20 58
92 84
40 74
6 60
53 37
84 93
22 87
33 75
16 71
99 18
44 15
91 63
82 93
30 22
23 92
87 6
88 100
46 79
58 54
90 4
56 14
41 13
24 12
4 25
96 38
70 83
84 26
4 10
12 60
58 76
65 28
24 18
23 8
88 87
19 15
77 45
57 30
83 35
5 3
4 42
21 64
...

output:

0

result:

ok single line: '0'

Test #39:

score: 13
Accepted
time: 2ms
memory: 3584kb

input:

100 300
39 75
13 81
21 60
44 53
6 89
60 44
60 55
1 92
100 30
53 50
24 84
9 73
100 67
42 16
7 34
17 18
13 21
100 52
66 50
49 66
32 39
26 3
27 38
53 16
35 76
8 36
29 49
97 28
65 62
75 28
80 15
20 10
60 54
74 86
81 46
20 33
84 55
41 10
72 25
21 78
17 40
29 93
95 58
79 45
46 58
97 48
24 3
97 75
97 38
17...

output:

9

result:

ok single line: '9'

Test #40:

score: 13
Accepted
time: 2ms
memory: 3712kb

input:

100 300
22 86
1 65
85 96
27 21
41 50
65 44
82 25
58 23
97 80
15 67
41 24
3 1
37 24
3 13
14 89
38 42
35 70
69 38
52 8
48 59
73 84
61 16
55 85
19 9
58 50
21 92
53 86
39 3
28 10
8 20
35 43
10 73
27 38
12 33
81 59
89 67
2 21
90 75
60 22
32 35
12 45
85 12
96 80
63 9
43 74
17 39
93 42
18 38
32 71
7 6
91 7...

output:

1

result:

ok single line: '1'

Test #41:

score: 13
Accepted
time: 0ms
memory: 3712kb

input:

7 12
7 1
2 1
5 6
3 4
3 6
7 3
7 4
5 3
7 6
4 1
3 2
7 2

output:

2

result:

ok single line: '2'

Test #42:

score: 13
Accepted
time: 0ms
memory: 3584kb

input:

7 12
1 5
4 2
4 7
2 1
3 1
7 2
6 7
2 5
5 7
2 6
4 6
3 5

output:

3

result:

ok single line: '3'

Subtask #2:

score: 17
Accepted

Test #43:

score: 17
Accepted
time: 18ms
memory: 3840kb

input:

994 1419
470 469
910 911
428 434
622 623
574 570
661 665
437 438
857 858
863 862
637 633
222 219
796 794
294 295
182 183
234 237
279 280
361 364
1 2
96 92
199 203
735 736
968 967
936 934
680 681
414 418
784 785
508 510
589 594
584 586
225 228
88 91
971 969
827 829
301 302
662 664
344 350
917 913
3 6...

output:

1076

result:

ok single line: '1076'

Test #44:

score: 17
Accepted
time: 17ms
memory: 3712kb

input:

994 1419
252 247
744 743
269 267
59 60
210 208
840 841
498 500
243 245
215 211
382 379
409 407
46 43
504 505
498 497
470 475
700 695
809 812
653 652
46 44
275 277
561 567
429 433
929 926
176 178
620 621
167 168
546 542
838 836
155 158
678 679
132 127
599 597
23 28
54 51
414 419
694 696
143 145
808 8...

output:

1072

result:

ok single line: '1072'

Test #45:

score: 17
Accepted
time: 17ms
memory: 3840kb

input:

994 1419
426 427
522 520
807 806
457 461
407 408
80 83
444 443
721 718
49 50
304 303
187 184
806 805
763 757
423 424
19 16
41 38
443 448
860 858
655 656
610 613
235 238
595 593
812 811
224 222
873 869
7 8
742 743
404 402
568 569
541 540
666 667
707 703
276 274
883 889
890 895
295 299
470 469
650 651...

output:

1084

result:

ok single line: '1084'

Test #46:

score: 17
Accepted
time: 17ms
memory: 3712kb

input:

994 1419
312 311
304 307
216 217
221 218
591 590
280 276
9 11
570 573
536 533
613 610
842 846
745 747
948 952
499 500
876 879
129 133
431 428
197 201
23 28
164 165
533 534
817 815
798 796
413 414
924 921
478 479
347 345
197 196
59 58
510 509
381 379
753 752
679 680
76 71
655 654
611 615
689 691
580 ...

output:

1048

result:

ok single line: '1048'

Test #47:

score: 17
Accepted
time: 18ms
memory: 3712kb

input:

994 1419
931 927
494 493
753 750
642 638
186 188
708 709
961 963
821 822
965 961
262 261
403 402
312 310
328 326
505 511
784 785
508 506
495 497
877 880
952 953
185 186
251 252
277 278
851 854
570 571
371 372
5 4
722 724
201 203
26 28
381 382
178 180
496 497
218 220
466 467
232 237
850 852
837 835
3...

output:

1072

result:

ok single line: '1072'

Test #48:

score: 17
Accepted
time: 19ms
memory: 3712kb

input:

994 1419
309 308
4 1
209 204
682 681
715 716
666 665
507 511
66 67
915 917
185 188
456 458
926 925
784 783
555 558
11 10
191 190
419 415
599 598
83 84
699 694
86 85
191 193
452 453
123 122
208 207
223 221
109 106
64 69
557 555
158 159
533 536
915 914
120 122
351 356
115 113
498 499
723 722
708 709
6...

output:

1057

result:

ok single line: '1057'

Test #49:

score: 17
Accepted
time: 16ms
memory: 3840kb

input:

994 1419
696 698
555 558
584 585
750 753
359 358
188 184
722 721
914 916
902 901
334 336
196 197
247 252
845 842
386 388
717 718
333 331
723 722
53 51
787 785
944 943
458 460
955 953
106 108
806 807
128 129
329 327
674 673
415 416
234 233
362 363
866 864
163 168
479 482
236 234
64 63
135 138
266 260...

output:

1091

result:

ok single line: '1091'

Test #50:

score: 17
Accepted
time: 17ms
memory: 3712kb

input:

994 1419
921 919
650 649
433 431
967 968
438 440
361 358
130 128
401 405
982 987
723 725
331 333
469 464
681 683
874 871
835 837
16 15
970 969
323 325
943 942
779 780
729 730
11 13
339 337
944 943
325 326
554 553
753 751
993 991
948 947
19 15
121 125
718 720
92 93
542 540
560 557
327 323
413 412
103...

output:

1079

result:

ok single line: '1079'

Test #51:

score: 17
Accepted
time: 17ms
memory: 3840kb

input:

994 1419
378 379
760 758
906 909
510 511
81 82
888 889
99 102
65 66
465 464
544 545
592 593
544 542
441 437
58 59
476 474
823 826
344 346
298 295
897 896
122 124
948 949
659 665
688 689
405 404
692 693
67 68
21 22
873 871
962 965
336 335
858 859
470 474
6 5
521 522
770 766
392 389
540 541
37 39
642 ...

output:

1080

result:

ok single line: '1080'

Test #52:

score: 17
Accepted
time: 17ms
memory: 3840kb

input:

994 1419
398 399
905 904
530 528
92 91
78 84
271 273
145 143
223 218
824 823
617 622
410 407
977 979
904 906
281 286
30 29
282 281
6 2
85 86
317 318
379 378
225 226
9 12
191 196
505 507
497 494
789 790
526 525
372 371
207 206
484 483
56 57
827 826
904 908
593 590
410 411
496 491
670 667
400 399
346 ...

output:

1077

result:

ok single line: '1077'

Test #53:

score: 17
Accepted
time: 29ms
memory: 3840kb

input:

994 1845
478 483
587 582
23 25
308 304
290 289
890 893
941 944
798 799
746 745
511 506
868 869
317 321
870 875
185 186
111 107
257 258
42 38
682 686
724 722
34 33
532 530
598 596
283 286
180 177
530 526
649 645
83 81
276 278
714 715
981 980
33 31
793 794
706 704
336 332
189 185
609 610
468 464
921 9...

output:

1134

result:

ok single line: '1134'

Test #54:

score: 17
Accepted
time: 30ms
memory: 3712kb

input:

994 1845
729 730
513 514
912 911
621 619
886 888
444 447
322 317
40 36
37 36
396 397
883 889
349 347
586 582
728 722
464 469
557 560
457 459
207 208
455 450
180 178
264 260
266 267
337 340
52 53
428 427
597 601
889 887
807 812
809 810
936 935
102 101
311 314
606 604
460 461
835 838
149 150
792 794
1...

output:

1136

result:

ok single line: '1136'

Test #55:

score: 17
Accepted
time: 30ms
memory: 3840kb

input:

994 1845
778 781
701 703
315 314
514 516
97 94
170 174
725 726
992 994
577 580
199 202
955 958
177 178
716 717
434 435
462 461
518 515
917 918
210 206
513 517
208 210
610 612
393 395
361 362
305 303
832 833
557 555
466 469
857 856
791 792
464 466
31 34
849 854
416 414
627 629
242 244
785 786
842 844...

output:

1131

result:

ok single line: '1131'

Test #56:

score: 17
Accepted
time: 30ms
memory: 3840kb

input:

994 1845
292 294
333 332
721 722
155 154
528 530
823 821
844 842
277 274
895 890
855 854
908 904
141 142
49 46
288 293
696 695
777 772
427 428
700 696
700 694
495 491
577 578
552 550
701 700
631 634
657 653
173 174
239 240
32 29
690 687
91 86
128 127
337 338
856 861
662 660
651 649
71 73
185 184
889...

output:

1135

result:

ok single line: '1135'

Test #57:

score: 17
Accepted
time: 31ms
memory: 3712kb

input:

994 1845
266 260
332 331
822 824
273 270
627 625
71 70
337 336
864 868
891 892
663 664
195 191
6 3
89 86
161 160
514 513
500 499
830 828
485 489
547 550
12 9
924 925
143 146
901 903
869 873
524 519
730 733
390 392
278 275
114 113
44 47
96 93
415 414
968 972
642 640
457 460
518 519
392 391
280 277
96...

output:

1120

result:

ok single line: '1120'

Test #58:

score: 17
Accepted
time: 29ms
memory: 3712kb

input:

994 1845
750 751
435 437
101 99
149 148
58 63
859 856
117 115
299 297
773 772
704 703
154 149
379 381
626 628
806 805
345 348
821 823
4 6
601 599
670 668
37 36
485 490
620 623
407 408
448 449
554 553
971 969
462 463
956 957
644 645
489 486
736 740
8 7
763 764
415 416
21 18
932 931
598 596
640 641
65...

output:

1137

result:

ok single line: '1137'

Test #59:

score: 17
Accepted
time: 31ms
memory: 3840kb

input:

994 1845
498 499
778 784
775 772
803 802
496 494
103 101
622 618
774 771
142 143
960 961
239 238
43 48
791 785
102 99
657 655
564 562
839 838
621 622
491 492
174 170
199 201
386 387
870 875
405 402
212 211
696 700
708 713
379 384
242 244
676 677
258 259
933 934
440 435
754 755
795 797
882 879
165 16...

output:

1143

result:

ok single line: '1143'

Test #60:

score: 17
Accepted
time: 30ms
memory: 3840kb

input:

994 1845
332 334
456 462
77 78
211 213
805 806
858 860
693 690
398 394
638 640
378 379
299 300
225 229
21 22
85 88
438 439
576 581
679 674
290 289
320 322
513 514
400 402
660 664
630 631
265 264
582 587
719 716
404 406
965 964
934 933
56 53
175 172
586 588
314 312
333 330
750 752
820 819
976 975
449...

output:

1125

result:

ok single line: '1125'

Test #61:

score: 17
Accepted
time: 30ms
memory: 3712kb

input:

994 1845
506 509
447 448
316 319
622 620
993 991
861 862
585 583
207 206
201 198
816 813
914 915
38 39
740 739
913 916
86 87
987 988
724 723
580 578
20 21
41 39
932 934
974 980
973 971
833 828
467 464
666 665
672 673
440 436
334 333
731 730
210 205
870 874
427 428
350 351
980 978
759 761
168 165
969...

output:

1125

result:

ok single line: '1125'

Test #62:

score: 17
Accepted
time: 30ms
memory: 3712kb

input:

994 1845
186 187
26 24
390 389
752 753
383 382
941 943
717 718
475 476
907 905
911 910
58 57
741 739
725 724
404 401
336 337
355 351
170 171
15 16
466 465
311 310
333 334
669 666
19 18
369 366
364 360
589 593
518 513
258 254
939 945
698 694
645 646
396 398
638 641
969 967
218 217
958 957
689 693
270...

output:

1140

result:

ok single line: '1140'

Test #63:

score: 17
Accepted
time: 70ms
memory: 3840kb

input:

994 2981
922 923
528 529
339 343
503 500
479 482
28 22
909 904
599 600
88 89
195 191
684 685
586 588
451 455
980 976
94 98
994 991
144 145
293 294
14 10
966 962
160 161
432 430
69 68
703 704
648 645
641 642
310 311
816 819
463 464
102 103
658 654
128 127
741 740
927 931
597 599
868 865
979 977
163 1...

output:

1611

result:

ok single line: '1611'

Test #64:

score: 17
Accepted
time: 72ms
memory: 3840kb

input:

994 2981
721 717
961 962
452 450
396 395
321 322
944 942
354 357
13 14
921 924
343 340
580 577
41 42
794 795
65 67
285 282
727 728
673 678
153 148
965 961
581 580
127 126
493 492
393 396
129 131
890 895
245 243
248 249
112 109
428 433
975 974
569 570
222 220
984 986
862 866
274 276
407 410
83 79
707...

output:

1616

result:

ok single line: '1616'

Test #65:

score: 17
Accepted
time: 71ms
memory: 3968kb

input:

994 2981
80 79
458 460
306 302
672 666
886 889
143 147
162 166
566 562
966 964
348 350
88 90
630 629
358 360
822 824
886 884
290 292
81 82
809 807
584 587
636 637
952 948
911 914
150 153
169 175
92 97
160 159
423 426
478 479
368 367
129 130
643 642
115 119
687 693
270 273
940 939
27 22
821 825
539 5...

output:

1622

result:

ok single line: '1622'

Test #66:

score: 17
Accepted
time: 71ms
memory: 3840kb

input:

994 2981
609 607
91 86
879 880
119 117
371 372
875 871
123 122
410 407
258 259
297 299
705 704
420 416
516 515
756 752
898 902
805 799
703 707
426 424
914 913
127 130
819 816
771 774
588 584
981 980
609 608
176 175
363 362
692 687
85 88
590 594
611 612
566 565
144 146
391 389
441 436
822 823
921 920...

output:

1624

result:

ok single line: '1624'

Test #67:

score: 17
Accepted
time: 72ms
memory: 3840kb

input:

994 2981
490 489
516 514
317 320
255 257
935 932
134 140
285 282
499 502
774 772
348 344
609 603
966 967
398 396
451 455
862 868
683 685
722 721
183 188
736 742
648 651
589 588
863 865
58 57
984 981
352 354
718 715
217 214
54 51
241 244
903 898
131 129
947 951
636 635
52 55
428 433
732 735
74 76
257...

output:

1618

result:

ok single line: '1618'

Test #68:

score: 17
Accepted
time: 72ms
memory: 3840kb

input:

994 2981
294 295
771 776
250 247
436 437
462 463
897 901
955 953
472 470
394 395
564 566
204 208
12 11
894 892
440 438
948 949
766 764
348 347
62 61
929 930
639 644
548 553
959 956
523 525
253 254
179 181
211 214
834 833
615 611
368 371
161 157
662 664
236 238
495 497
343 344
827 828
770 766
349 350...

output:

1620

result:

ok single line: '1620'

Test #69:

score: 17
Accepted
time: 72ms
memory: 3712kb

input:

994 2981
638 644
525 524
812 809
334 332
287 285
350 351
789 785
445 447
285 284
520 525
64 67
772 773
246 249
988 989
2 7
855 858
436 435
514 518
189 190
89 85
805 800
643 641
127 128
552 548
555 560
511 505
925 924
280 279
658 655
477 480
314 309
873 872
472 473
882 880
442 443
392 387
549 553
92 ...

output:

1619

result:

ok single line: '1619'

Test #70:

score: 17
Accepted
time: 72ms
memory: 3840kb

input:

994 2981
398 395
680 681
769 765
548 551
509 510
570 568
317 319
948 952
575 579
667 670
199 197
638 644
403 401
850 852
329 328
145 142
125 126
704 707
229 231
18 16
423 424
506 505
235 237
667 671
203 197
23 27
545 546
344 350
152 154
446 444
660 661
121 120
85 88
795 794
186 184
137 138
984 985
6...

output:

1618

result:

ok single line: '1618'

Test #71:

score: 17
Accepted
time: 70ms
memory: 3840kb

input:

994 2981
230 231
374 373
212 213
314 309
662 663
164 165
49 46
99 102
411 409
91 88
358 361
241 239
352 354
904 905
797 795
46 44
773 772
763 759
174 169
94 97
10 14
779 782
163 168
78 84
80 82
535 536
862 863
408 410
187 185
611 613
647 646
964 962
159 158
320 317
240 245
238 233
127 130
530 527
82...

output:

1628

result:

ok single line: '1628'

Test #72:

score: 17
Accepted
time: 70ms
memory: 3968kb

input:

994 2981
992 991
932 933
4 6
111 106
230 225
278 275
259 257
155 161
489 488
103 100
851 848
565 566
577 575
607 603
491 496
887 885
966 964
615 611
721 715
69 64
100 99
743 746
836 840
442 441
433 428
261 263
346 349
602 599
837 834
222 221
560 558
719 715
239 238
522 524
288 292
67 66
762 760
822 ...

output:

1624

result:

ok single line: '1624'

Test #73:

score: 17
Accepted
time: 127ms
memory: 3840kb

input:

1000 3000
947 996
43 9
196 238
502 517
584 569
998 961
592 595
271 221
70 86
425 474
353 396
736 759
867 855
27 1
355 390
941 984
563 528
297 249
113 90
1 14
961 994
37 73
503 534
376 386
653 618
528 509
652 640
974 926
638 676
401 392
934 967
773 792
819 782
983 993
75 122
590 591
131 143
71 98
121...

output:

63

result:

ok single line: '63'

Test #74:

score: 17
Accepted
time: 134ms
memory: 3968kb

input:

1000 3000
999 969
98 81
411 511
714 807
57 100
619 545
834 871
229 198
367 437
717 763
803 848
933 996
797 778
475 445
693 600
845 889
145 101
830 825
458 468
678 753
901 934
938 899
876 814
146 112
535 546
927 967
219 123
622 564
151 110
872 926
654 668
627 558
183 122
136 121
831 904
28 89
571 484...

output:

54

result:

ok single line: '54'

Test #75:

score: 17
Accepted
time: 139ms
memory: 3840kb

input:

1000 3000
600 744
864 814
342 292
421 344
203 215
130 190
485 447
132 196
329 229
178 63
890 746
513 415
980 952
14 9
893 850
837 857
978 872
1000 873
739 786
81 136
143 131
902 781
42 90
717 824
449 420
209 173
38 44
587 572
166 199
684 639
788 694
160 72
213 243
909 900
413 285
603 704
287 208
646...

output:

56

result:

ok single line: '56'

Test #76:

score: 17
Accepted
time: 140ms
memory: 3968kb

input:

1000 3000
483 480
641 716
206 8
680 542
245 157
330 241
108 148
152 146
718 558
334 423
608 416
582 723
833 829
735 561
551 659
69 41
253 238
609 710
639 504
64 102
533 661
585 622
806 742
803 887
528 678
953 992
860 869
95 233
990 980
38 75
12 18
159 224
427 277
421 316
617 815
475 281
633 765
138 ...

output:

44

result:

ok single line: '44'

Test #77:

score: 17
Accepted
time: 138ms
memory: 3968kb

input:

1000 3000
455 619
978 894
672 892
245 470
143 23
331 96
712 601
667 878
975 880
149 97
506 416
213 456
585 635
411 239
708 926
90 61
413 235
237 186
204 342
92 137
210 240
518 586
826 607
978 945
238 381
37 124
141 2
373 485
871 999
159 106
230 11
401 163
179 392
863 882
856 959
786 750
896 937
472 ...

output:

38

result:

ok single line: '38'

Test #78:

score: 17
Accepted
time: 145ms
memory: 3968kb

input:

1000 3000
647 303
910 947
81 12
306 313
593 79
984 561
139 172
796 191
264 8
569 730
361 375
465 956
702 716
326 329
539 688
396 85
809 785
187 82
327 605
494 768
250 298
284 262
382 969
240 815
967 930
461 648
404 625
692 369
463 449
38 8
590 656
223 49
452 555
926 246
601 993
886 353
726 755
876 5...

output:

52

result:

ok single line: '52'

Test #79:

score: 17
Accepted
time: 139ms
memory: 3712kb

input:

1000 3000
568 488
742 567
333 354
830 766
52 955
878 424
334 468
879 21
694 768
896 929
916 928
918 845
129 153
998 826
281 336
650 491
951 955
362 583
663 661
417 355
537 793
721 242
779 790
658 730
774 776
118 552
763 678
977 767
43 981
768 161
453 931
928 1
929 428
653 472
759 803
76 900
315 367
...

output:

51

result:

ok single line: '51'

Test #80:

score: 17
Accepted
time: 138ms
memory: 3968kb

input:

1000 3000
781 92
866 457
740 485
277 157
995 169
133 562
845 778
38 468
23 15
341 774
137 299
444 521
581 719
968 316
175 717
50 37
626 726
134 413
125 215
737 946
672 881
493 379
823 689
745 844
347 376
542 492
626 774
751 74
208 106
179 180
977 357
251 393
967 914
777 682
560 147
75 913
216 351
19...

output:

53

result:

ok single line: '53'

Test #81:

score: 17
Accepted
time: 140ms
memory: 3840kb

input:

1000 3000
254 311
386 441
212 199
286 219
191 908
577 435
197 527
265 669
264 159
152 764
344 586
177 198
818 612
185 279
220 766
588 455
640 22
320 407
337 358
85 696
644 731
817 619
95 624
904 601
801 888
599 711
47 411
954 343
178 991
806 661
35 196
87 222
966 413
189 401
285 900
211 509
871 694
...

output:

20

result:

ok single line: '20'

Test #82:

score: 17
Accepted
time: 138ms
memory: 3712kb

input:

1000 3000
504 107
9 717
266 300
238 631
20 17
944 694
300 439
597 869
189 216
71 158
758 665
796 958
857 494
910 559
937 837
336 508
964 639
426 336
240 276
934 905
839 81
929 725
525 646
976 977
840 134
432 282
983 822
121 599
568 890
869 265
361 464
170 112
484 547
669 196
474 556
774 416
365 546
...

output:

49

result:

ok single line: '49'

Test #83:

score: 17
Accepted
time: 119ms
memory: 3968kb

input:

1000 3000
714 487
692 348
747 696
647 707
876 777
50 53
985 116
795 833
945 868
934 827
856 884
707 937
855 692
687 836
463 516
985 757
283 288
112 487
205 140
544 487
951 915
181 985
875 56
139 466
475 560
707 747
704 698
8 707
836 448
496 139
827 584
966 56
237 453
29 32
369 237
836 795
287 190
23...

output:

173

result:

ok single line: '173'

Test #84:

score: 17
Accepted
time: 119ms
memory: 3968kb

input:

1000 3000
829 348
343 771
353 115
185 192
987 914
353 323
549 430
183 265
67 50
916 771
556 348
914 549
711 900
202 766
771 84
834 348
66 453
827 900
453 338
348 390
984 549
878 349
669 589
724 667
533 768
975 420
420 545
348 480
202 953
349 674
424 366
878 964
134 197
353 655
768 887
118 768
492 20...

output:

179

result:

ok single line: '179'

Test #85:

score: 17
Accepted
time: 118ms
memory: 3840kb

input:

1000 3000
896 983
687 672
621 528
310 369
711 726
115 81
257 290
978 444
724 786
939 873
552 653
495 331
983 461
509 483
557 259
848 904
756 742
920 983
420 369
694 730
275 312
32 5
701 486
486 119
983 574
983 986
264 983
486 360
374 350
653 193
653 843
420 589
513 440
345 383
816 983
24 52
494 520
...

output:

237

result:

ok single line: '237'

Test #86:

score: 17
Accepted
time: 118ms
memory: 3840kb

input:

1000 3000
214 142
441 639
264 199
598 198
185 252
587 441
890 278
720 550
757 724
51 199
551 598
199 519
905 934
582 594
911 550
442 517
832 828
321 374
278 124
198 463
820 273
895 626
637 58
757 950
42 499
775 550
42 686
798 716
786 626
42 518
335 626
118 42
547 553
441 544
958 42
599 579
637 805
6...

output:

328

result:

ok single line: '328'

Test #87:

score: 17
Accepted
time: 118ms
memory: 3968kb

input:

1000 3000
571 532
14 29
572 582
86 100
761 693
64 55
454 426
555 95
196 323
836 64
701 709
601 532
737 742
636 616
506 803
236 629
837 870
693 704
98 64
77 803
535 576
138 219
88 64
852 454
995 909
803 996
803 740
616 852
64 112
553 556
504 481
196 994
625 575
693 175
879 573
250 241
803 644
254 573...

output:

168

result:

ok single line: '168'

Test #88:

score: 17
Accepted
time: 121ms
memory: 3968kb

input:

1000 3000
22 361
105 525
4 1
555 544
277 77
694 855
404 490
12 359
10 337
636 396
335 473
794 833
790 82
123 145
821 813
547 421
924 72
177 269
427 828
396 339
197 281
657 846
878 32
613 579
30 61
948 32
651 864
600 515
378 277
780 765
870 507
728 183
172 665
758 270
393 455
470 535
226 151
885 614
...

output:

244

result:

ok single line: '244'

Test #89:

score: 17
Accepted
time: 123ms
memory: 3968kb

input:

1000 3000
873 792
551 530
949 154
975 952
123 117
165 394
40 29
756 588
978 412
611 692
272 16
955 857
711 254
532 427
362 441
804 357
857 41
116 454
925 874
288 464
639 517
664 723
798 815
944 910
82 859
908 181
367 335
69 28
161 82
754 165
327 373
642 604
378 162
849 425
29 32
254 920
137 542
857 ...

output:

223

result:

ok single line: '223'

Test #90:

score: 17
Accepted
time: 125ms
memory: 3968kb

input:

1000 3000
48 482
97 621
154 13
715 750
418 366
233 236
347 410
706 568
283 216
734 40
120 194
259 196
808 375
165 202
404 620
517 590
511 480
109 513
509 301
404 85
389 973
210 925
657 615
732 48
884 404
930 734
937 410
8 839
977 586
534 198
216 211
913 322
775 904
660 134
787 828
983 931
117 551
93...

output:

229

result:

ok single line: '229'

Test #91:

score: 17
Accepted
time: 122ms
memory: 3968kb

input:

1000 3000
745 665
469 672
315 682
57 142
889 941
595 636
800 467
860 766
355 416
40 17
560 208
241 819
735 521
611 686
134 770
41 560
986 251
815 775
857 551
77 846
559 474
124 161
240 913
980 999
338 10
193 469
644 647
463 825
800 727
643 819
238 172
740 811
274 360
176 34
293 242
508 353
158 134
5...

output:

269

result:

ok single line: '269'

Test #92:

score: 17
Accepted
time: 122ms
memory: 3968kb

input:

1000 3000
560 641
224 154
63 340
681 69
324 781
880 915
702 704
608 212
869 789
816 810
579 578
564 238
830 145
553 14
349 427
821 170
124 823
427 56
21 686
354 945
48 105
565 973
826 911
198 145
727 661
977 880
485 465
716 855
387 288
394 112
27 564
984 575
354 261
291 976
211 813
682 388
460 837
1...

output:

203

result:

ok single line: '203'

Test #93:

score: 17
Accepted
time: 1ms
memory: 3584kb

input:

7 12
7 1
2 1
5 6
3 4
3 6
7 3
7 4
5 3
7 6
4 1
3 2
7 2

output:

2

result:

ok single line: '2'

Test #94:

score: 17
Accepted
time: 0ms
memory: 3584kb

input:

7 12
1 5
4 2
4 7
2 1
3 1
7 2
6 7
2 5
5 7
2 6
4 6
3 5

output:

3

result:

ok single line: '3'

Subtask #3:

score: 0
Time Limit Exceeded

Test #95:

score: 25
Accepted
time: 17ms
memory: 3840kb

input:

994 1419
240 241
162 161
330 335
575 576
216 215
385 379
230 231
951 948
677 674
223 222
932 938
743 748
241 244
141 146
249 246
624 630
771 777
95 92
19 16
178 179
246 247
457 456
902 898
988 987
677 673
463 465
448 445
778 779
65 70
813 815
160 161
273 274
778 777
153 150
634 637
101 103
989 988
4...

output:

1044

result:

ok single line: '1044'

Test #96:

score: 25
Accepted
time: 18ms
memory: 3712kb

input:

994 1419
1 2
936 938
781 780
869 874
935 936
913 916
861 857
715 716
911 913
577 578
705 707
347 349
244 245
732 729
849 853
815 819
228 229
454 449
438 437
759 762
674 679
331 330
340 339
98 96
684 681
765 769
572 569
602 597
241 243
947 946
59 58
4 1
582 585
673 675
18 16
395 393
794 795
88 86
848...

output:

1068

result:

ok single line: '1068'

Test #97:

score: 25
Accepted
time: 18ms
memory: 3840kb

input:

994 1419
54 52
523 520
429 434
887 888
229 228
765 766
93 94
663 665
71 72
343 342
876 878
886 888
389 392
959 955
358 361
590 589
8 10
7 1
189 190
657 656
218 217
981 985
834 833
339 342
239 241
921 919
667 671
519 523
728 722
532 533
854 855
133 131
53 51
303 302
891 896
108 109
989 990
954 953
97...

output:

1079

result:

ok single line: '1079'

Test #98:

score: 25
Accepted
time: 18ms
memory: 3840kb

input:

994 1419
157 161
2 3
43 49
535 534
729 733
505 508
389 386
632 631
8 7
441 436
206 205
921 918
289 291
199 200
988 987
218 220
134 135
276 274
366 365
880 877
939 938
710 714
191 192
243 240
596 595
564 562
725 724
576 575
917 918
95 92
799 804
513 517
38 41
634 637
433 431
592 594
544 541
753 752
7...

output:

1064

result:

ok single line: '1064'

Test #99:

score: 25
Accepted
time: 17ms
memory: 3840kb

input:

994 1419
75 71
159 156
969 971
299 295
198 201
226 228
776 775
250 248
386 385
500 503
549 547
335 336
327 325
545 543
573 574
716 717
897 898
276 274
496 497
903 897
269 268
105 100
962 961
842 845
359 358
534 535
67 65
851 849
629 627
931 928
794 792
91 92
718 716
636 632
826 827
467 465
605 603
8...

output:

1052

result:

ok single line: '1052'

Test #100:

score: 25
Accepted
time: 19ms
memory: 3840kb

input:

994 1419
675 674
510 508
546 543
887 883
870 869
791 792
950 948
416 417
869 875
12 8
501 504
897 896
474 473
520 525
512 511
494 497
159 161
751 755
271 268
660 659
505 508
616 617
389 387
361 358
345 344
609 603
734 735
36 42
645 651
268 270
553 552
603 608
890 889
522 523
823 826
428 432
392 386
...

output:

1048

result:

ok single line: '1048'

Test #101:

score: 25
Accepted
time: 18ms
memory: 3712kb

input:

994 1419
367 371
211 217
589 595
724 727
649 650
544 541
198 200
935 933
378 372
979 977
201 203
513 516
905 904
538 533
555 557
419 417
662 664
732 731
584 586
229 228
308 309
386 388
314 311
948 946
279 274
14 11
420 416
375 374
234 233
358 360
991 994
597 598
828 827
662 660
688 687
715 717
952 9...

output:

1085

result:

ok single line: '1085'

Test #102:

score: 25
Accepted
time: 19ms
memory: 3712kb

input:

994 1419
935 938
597 596
976 979
700 698
183 184
458 459
748 746
86 90
323 322
397 399
596 598
553 548
650 649
477 481
790 791
539 533
84 79
824 822
386 385
710 712
256 259
449 451
824 821
168 169
541 540
584 588
992 991
38 40
310 312
817 813
818 816
212 214
106 107
482 479
952 953
393 398
166 162
6...

output:

1065

result:

ok single line: '1065'

Test #103:

score: 25
Accepted
time: 17ms
memory: 3712kb

input:

994 1419
631 635
177 181
323 329
766 769
576 575
373 372
511 512
165 163
19 20
170 174
648 647
973 968
57 56
928 925
842 841
180 177
78 79
547 548
560 557
617 618
236 237
984 982
512 514
922 921
849 850
674 677
714 713
196 191
655 653
209 207
224 225
476 477
305 307
261 266
864 867
792 794
102 100
7...

output:

1061

result:

ok single line: '1061'

Test #104:

score: 25
Accepted
time: 17ms
memory: 3840kb

input:

994 1419
369 368
640 638
346 347
150 151
903 904
226 225
10 13
642 638
144 141
163 162
254 253
239 238
720 718
603 605
806 812
631 630
404 402
960 961
889 886
515 518
371 372
108 111
772 776
748 746
876 875
559 554
293 288
236 237
169 170
605 604
63 64
627 629
53 52
332 333
204 209
324 323
154 155
3...

output:

1068

result:

ok single line: '1068'

Test #105:

score: 25
Accepted
time: 29ms
memory: 3712kb

input:

994 1845
53 54
271 268
715 716
95 94
201 198
167 168
642 638
46 44
457 458
814 815
834 835
211 216
888 887
880 878
546 544
847 842
831 833
646 650
132 127
861 862
266 265
5 3
269 268
555 554
11 14
451 454
589 591
266 262
543 545
854 849
26 24
680 681
113 112
154 155
667 672
769 765
204 205
780 778
9...

output:

1121

result:

ok single line: '1121'

Test #106:

score: 25
Accepted
time: 29ms
memory: 3712kb

input:

994 1845
509 508
788 789
201 202
358 363
561 562
556 555
372 378
962 966
345 347
221 219
529 526
470 475
873 871
942 939
401 404
910 904
823 825
94 92
924 923
329 330
833 832
178 181
30 35
387 388
725 728
6 7
944 941
806 811
983 982
254 255
465 466
772 773
726 724
495 493
490 486
903 901
256 253
845...

output:

1133

result:

ok single line: '1133'

Test #107:

score: 25
Accepted
time: 31ms
memory: 3712kb

input:

994 1845
70 66
43 45
198 202
99 104
45 49
617 619
781 778
856 858
24 23
935 938
956 955
475 472
449 452
481 483
232 235
508 507
383 379
38 39
106 110
372 371
633 631
329 323
550 551
113 112
179 176
441 439
992 993
445 444
491 492
368 369
918 919
940 943
514 517
181 176
470 471
453 451
442 444
511 50...

output:

1136

result:

ok single line: '1136'

Test #108:

score: 25
Accepted
time: 30ms
memory: 3840kb

input:

994 1845
169 172
86 87
26 22
921 920
507 505
234 235
394 396
687 690
733 729
97 98
594 589
20 17
914 917
52 53
747 749
863 865
103 100
855 856
788 785
572 574
969 970
460 456
882 876
606 609
830 828
796 793
715 716
170 169
793 794
257 256
207 208
696 698
954 955
558 560
269 267
357 352
51 53
17 16
5...

output:

1128

result:

ok single line: '1128'

Test #109:

score: 25
Accepted
time: 31ms
memory: 3712kb

input:

994 1845
46 47
164 166
942 939
293 289
297 301
910 906
918 924
194 196
901 903
408 409
616 614
660 662
333 331
673 672
231 225
349 346
709 713
745 746
389 386
157 158
191 194
774 775
252 250
381 379
436 439
635 632
985 981
175 176
708 710
584 586
683 685
698 695
776 775
402 400
363 362
750 751
666 6...

output:

1137

result:

ok single line: '1137'

Test #110:

score: 25
Accepted
time: 31ms
memory: 3712kb

input:

994 1845
427 428
484 490
28 26
478 483
353 351
335 331
344 343
464 467
476 475
746 749
617 623
74 73
631 637
498 504
177 176
390 391
932 933
991 994
960 963
218 223
275 280
59 62
917 918
339 343
209 204
910 911
815 819
969 972
668 667
644 638
162 163
847 843
281 280
596 601
33 30
736 737
37 42
582 5...

output:

1141

result:

ok single line: '1141'

Test #111:

score: 25
Accepted
time: 30ms
memory: 3712kb

input:

994 1845
400 401
989 990
674 673
267 266
764 769
380 381
226 225
875 873
244 243
699 695
819 820
231 230
767 766
485 489
112 107
684 685
708 713
627 626
690 688
811 810
485 484
618 622
319 317
572 570
706 707
220 223
398 397
710 712
338 339
48 45
875 871
212 216
616 615
977 975
940 942
1 3
925 926
1...

output:

1151

result:

ok single line: '1151'

Test #112:

score: 25
Accepted
time: 31ms
memory: 3712kb

input:

994 1845
296 298
584 583
822 821
806 807
511 507
861 860
979 978
521 523
349 345
212 216
292 291
876 877
86 85
237 235
788 786
441 439
150 151
967 966
323 327
133 130
628 627
215 216
236 235
563 566
232 231
746 745
387 388
490 489
735 736
921 923
100 103
579 580
609 607
946 945
918 917
21 22
693 694...

output:

1133

result:

ok single line: '1133'

Test #113:

score: 25
Accepted
time: 30ms
memory: 3840kb

input:

994 1845
410 412
188 184
121 120
483 482
20 18
925 929
946 948
74 76
742 743
100 99
868 863
778 783
193 194
484 483
695 698
242 245
748 749
632 635
194 190
364 365
102 100
567 565
67 70
210 207
853 854
713 708
327 325
806 808
28 26
191 195
297 295
790 787
983 981
61 59
316 317
765 770
107 109
5 4
20...

output:

1127

result:

ok single line: '1127'

Test #114:

score: 25
Accepted
time: 30ms
memory: 3840kb

input:

994 1845
308 304
890 894
433 428
218 224
274 278
886 883
989 988
709 708
793 797
767 768
134 140
794 798
617 623
358 357
9 10
890 896
593 591
560 556
113 114
125 121
138 139
810 811
527 530
718 715
333 335
46 44
687 691
225 226
378 377
524 521
287 286
931 927
602 597
119 120
360 359
230 226
676 678
...

output:

1145

result:

ok single line: '1145'

Test #115:

score: 25
Accepted
time: 72ms
memory: 3968kb

input:

994 2981
605 606
542 544
871 872
552 553
881 880
394 395
674 676
283 286
712 713
503 500
748 747
127 129
564 562
85 89
302 305
963 962
687 691
854 851
413 409
568 567
891 892
478 477
140 137
421 427
488 486
300 298
734 731
438 437
324 323
422 423
366 369
90 89
80 83
884 886
161 162
241 245
632 637
6...

output:

1620

result:

ok single line: '1620'

Test #116:

score: 25
Accepted
time: 71ms
memory: 3840kb

input:

994 2981
923 921
896 895
976 979
341 340
744 743
147 144
789 786
472 473
783 779
749 743
316 322
315 314
623 621
504 498
949 946
876 879
704 706
233 236
257 253
429 432
582 585
295 297
245 239
328 325
80 84
796 792
691 692
483 479
839 837
877 882
496 491
793 797
345 347
736 740
750 749
473 474
96 97...

output:

1619

result:

ok single line: '1619'

Test #117:

score: 25
Accepted
time: 71ms
memory: 3968kb

input:

994 2981
98 92
741 740
796 792
111 106
343 338
782 779
805 799
915 917
573 574
315 310
291 293
382 385
49 45
899 903
217 213
684 685
164 166
299 296
627 624
372 374
693 694
903 900
81 82
452 451
273 274
724 723
866 865
61 60
4 1
417 420
803 805
495 496
21 17
969 971
162 163
178 179
501 499
941 942
7...

output:

1621

result:

ok single line: '1621'

Test #118:

score: 25
Accepted
time: 72ms
memory: 3968kb

input:

994 2981
512 518
453 451
167 165
904 910
639 641
833 830
105 104
464 469
71 72
341 339
58 57
890 889
374 377
103 100
579 577
339 337
758 762
888 889
342 343
491 497
385 386
384 385
49 50
346 344
528 531
41 39
363 364
608 607
972 973
203 202
119 116
957 953
498 501
281 280
353 356
276 275
436 440
845...

output:

1622

result:

ok single line: '1622'

Test #119:

score: 25
Accepted
time: 69ms
memory: 3968kb

input:

994 2981
858 855
985 987
266 261
687 689
393 394
234 236
370 368
25 23
745 749
410 409
203 199
703 707
401 405
560 555
630 626
152 151
772 773
98 96
847 842
870 872
352 357
287 288
516 515
409 407
309 313
641 640
921 924
870 869
34 32
672 667
413 407
841 847
518 519
389 391
678 679
692 693
808 810
5...

output:

1629

result:

ok single line: '1629'

Test #120:

score: 25
Accepted
time: 72ms
memory: 3968kb

input:

994 2981
261 265
793 792
175 171
24 23
533 534
796 794
635 637
842 846
676 675
557 558
646 648
222 218
181 176
409 411
948 949
761 762
963 962
154 153
896 894
671 668
601 602
839 835
281 286
970 972
88 90
44 47
191 196
219 221
267 273
852 848
711 714
706 702
467 463
13 10
204 210
224 225
754 752
11 ...

output:

1618

result:

ok single line: '1618'

Test #121:

score: 25
Accepted
time: 73ms
memory: 3968kb

input:

994 2981
715 720
895 892
463 468
462 459
758 763
5 7
461 458
595 596
930 927
627 625
317 321
169 175
689 690
661 664
731 729
709 708
890 894
787 790
741 737
491 493
873 872
608 609
770 764
746 747
658 657
725 722
282 284
966 964
45 44
154 150
88 86
498 499
324 327
799 805
802 801
128 131
118 116
839...

output:

1620

result:

ok single line: '1620'

Test #122:

score: 25
Accepted
time: 73ms
memory: 3840kb

input:

994 2981
454 452
278 279
55 56
324 326
745 743
629 625
630 627
342 338
970 967
586 583
178 182
486 485
751 756
348 349
431 432
800 799
488 487
737 736
695 698
282 283
764 763
692 689
111 109
444 447
139 135
379 383
781 782
347 348
919 918
166 168
387 391
260 264
89 85
737 738
929 925
786 787
355 356...

output:

1621

result:

ok single line: '1621'

Test #123:

score: 25
Accepted
time: 74ms
memory: 3840kb

input:

994 2981
232 235
481 477
487 484
283 284
496 491
388 389
303 307
138 137
697 696
262 264
504 505
413 407
316 318
258 259
659 662
531 530
417 418
729 728
492 491
489 487
577 580
337 338
6 3
136 140
702 704
46 45
494 495
954 956
186 185
474 471
665 661
961 965
986 981
839 836
606 609
582 588
759 762
1...

output:

1616

result:

ok single line: '1616'

Test #124:

score: 25
Accepted
time: 72ms
memory: 3968kb

input:

994 2981
115 119
217 215
8 14
726 722
696 700
696 694
330 333
483 484
347 350
521 519
742 741
676 673
800 802
282 281
287 288
353 354
622 618
679 674
42 36
659 658
943 942
859 858
99 98
554 557
85 88
475 476
113 115
165 166
641 643
688 693
512 514
46 49
100 99
613 612
365 368
643 642
418 415
248 250...

output:

1619

result:

ok single line: '1619'

Test #125:

score: 25
Accepted
time: 322ms
memory: 3968kb

input:

1000 5999
808 809
931 924
90 88
410 418
768 763
820 804
593 586
754 752
359 360
773 766
460 446
629 625
235 222
859 855
70 72
583 598
712 720
196 182
967 971
59 44
415 404
365 368
460 458
9 20
967 978
815 809
616 613
541 542
781 786
698 699
611 601
640 631
304 311
979 975
838 840
945 959
943 949
131...

output:

1177

result:

ok single line: '1177'

Test #126:

score: 25
Accepted
time: 316ms
memory: 4096kb

input:

1000 5999
930 934
949 953
382 390
795 796
581 596
403 401
65 62
58 55
258 257
866 868
802 818
452 441
453 449
273 272
350 355
931 927
919 910
596 590
812 805
161 172
976 964
210 215
46 56
150 147
513 503
924 940
230 222
841 842
197 189
31 22
241 240
88 89
872 861
523 535
257 252
993 983
487 500
889 ...

output:

1214

result:

ok single line: '1214'

Test #127:

score: 25
Accepted
time: 318ms
memory: 4096kb

input:

1000 5999
493 485
157 152
549 551
12 2
935 925
235 222
537 535
951 955
303 308
339 325
815 802
120 121
201 202
245 259
733 725
388 381
260 259
641 644
147 154
727 721
882 890
194 188
818 811
674 663
929 928
117 114
349 344
591 593
645 658
590 586
314 312
957 958
821 822
604 618
519 511
580 567
135 1...

output:

1207

result:

ok single line: '1207'

Test #128:

score: 25
Accepted
time: 321ms
memory: 3968kb

input:

1000 5999
918 901
956 953
63 70
418 407
680 672
105 104
749 742
304 317
190 188
437 433
383 399
220 201
679 680
296 288
28 32
66 62
74 78
428 437
433 434
110 108
731 722
686 693
786 797
927 935
526 540
924 925
838 823
111 113
177 173
302 301
262 263
210 207
40 26
329 340
394 383
968 965
435 434
63 7...

output:

1185

result:

ok single line: '1185'

Test #129:

score: 25
Accepted
time: 326ms
memory: 4096kb

input:

1000 5999
22 21
928 940
901 902
610 615
141 144
821 832
387 396
832 836
957 960
661 678
757 756
930 932
553 544
598 595
34 28
825 838
414 409
886 882
138 133
395 390
805 801
545 553
95 93
462 477
154 149
26 38
68 69
296 294
980 962
526 538
857 859
624 621
249 244
443 453
240 226
764 774
334 338
842 ...

output:

1200

result:

ok single line: '1200'

Test #130:

score: 25
Accepted
time: 121ms
memory: 3840kb

input:

1000 3000
761 809
393 344
990 984
821 842
232 238
37 27
694 718
587 631
390 422
532 544
715 718
56 36
454 466
146 131
457 463
489 449
630 589
573 591
958 948
645 678
959 919
74 28
251 247
894 871
70 25
870 835
702 656
362 330
549 540
591 622
610 578
411 441
781 803
1000 975
161 139
82 113
187 199
64...

output:

20

result:

ok single line: '20'

Test #131:

score: 25
Accepted
time: 129ms
memory: 3968kb

input:

1000 3000
48 133
703 606
838 930
987 991
708 787
834 912
642 668
408 405
20 72
362 345
863 894
912 989
119 50
130 100
978 982
598 687
643 712
732 781
971 982
62 133
143 110
252 303
421 321
656 641
78 82
86 20
10 99
232 143
24 23
915 868
579 503
746 679
122 119
816 745
934 986
243 327
664 681
230 207...

output:

64

result:

ok single line: '64'

Test #132:

score: 25
Accepted
time: 138ms
memory: 3840kb

input:

1000 3000
343 154
995 120
881 888
658 902
869 860
299 868
540 559
879 584
797 682
699 669
238 681
441 812
464 641
614 20
639 702
613 615
790 794
298 272
492 615
515 498
995 965
636 607
432 407
45 582
729 699
887 879
214 68
741 793
757 712
784 795
71 99
872 492
458 274
247 724
219 318
737 102
664 623...

output:

56

result:

ok single line: '56'

Test #133:

score: 25
Accepted
time: 145ms
memory: 3968kb

input:

1000 3000
326 296
21 156
381 283
424 21
43 836
726 671
499 467
135 295
774 142
150 451
679 883
8 38
216 365
83 144
189 470
595 669
89 361
210 134
805 994
880 756
193 639
682 573
806 943
818 851
4 366
885 982
402 967
539 772
930 907
819 916
294 301
434 272
727 408
835 793
971 63
456 475
98 53
722 328...

output:

20

result:

ok single line: '20'

Test #134:

score: 25
Accepted
time: 116ms
memory: 3840kb

input:

1000 3000
116 369
377 610
455 604
298 521
379 525
62 65
17 32
88 237
32 304
65 717
61 882
403 88
252 93
83 207
61 779
293 65
18 488
200 698
729 983
721 612
61 529
200 239
693 612
337 799
344 85
914 827
299 345
19 913
932 913
277 61
730 923
488 302
65 128
65 1
880 252
496 213
983 88
389 420
88 150
25...

output:

192

result:

ok single line: '192'

Test #135:

score: 25
Accepted
time: 118ms
memory: 3968kb

input:

1000 3000
756 870
608 186
959 934
684 586
301 315
906 92
450 361
453 580
958 962
12 186
45 301
172 186
82 27
361 522
203 92
93 220
490 14
179 123
754 472
370 254
499 301
301 740
785 751
819 490
769 565
331 228
938 26
53 186
186 360
220 248
589 490
104 472
962 745
414 346
962 451
318 163
763 651
220 ...

output:

211

result:

ok single line: '211'

Test #136:

score: 0
Time Limit Exceeded

input:

1000 300000
461 720
920 231
167 154
705 389
116 909
878 677
625 38
443 831
928 394
680 95
290 166
311 826
754 38
497 405
939 224
837 336
491 749
759 698
452 290
86 705
235 331
94 350
84 626
626 535
192 997
490 916
446 274
512 705
917 32
865 460
666 5
569 453
309 748
949 922
145 43
670 523
925 106
21...

output:


result:


Subtask #4:

score: 0
Time Limit Exceeded

Test #154:

score: 12
Accepted
time: 1ms
memory: 3584kb

input:

21 38
2 7
8 9
14 12
7 8
17 16
16 20
18 20
6 4
20 15
1 6
15 16
11 13
17 18
10 11
15 17
13 9
2 1
15 14
4 1
18 19
13 14
10 8
3 1
15 21
14 11
2 6
19 20
12 11
5 7
2 5
2 3
21 17
8 12
11 8
4 7
14 10
21 18
5 1

output:

19

result:

ok single line: '19'

Test #155:

score: 12
Accepted
time: 1ms
memory: 3712kb

input:

21 38
7 5
20 18
6 3
8 9
16 17
3 5
5 6
18 19
17 19
10 11
17 15
4 2
4 3
1 4
3 2
2 6
15 21
11 14
16 21
9 10
1 7
8 14
6 4
13 10
9 11
8 12
9 14
16 15
14 13
8 7
21 18
13 9
21 20
17 21
18 15
15 14
1 2
13 11

output:

15

result:

ok single line: '15'

Test #156:

score: 12
Accepted
time: 0ms
memory: 3712kb

input:

21 38
21 18
21 19
10 11
2 1
10 8
16 15
10 12
14 8
3 6
17 20
2 3
1 3
9 13
7 2
1 6
5 1
16 18
20 16
11 8
21 16
11 12
6 7
15 21
12 14
8 7
16 17
10 14
16 19
6 2
8 12
15 14
3 4
15 18
9 8
1 7
17 21
4 7
8 13

output:

22

result:

ok single line: '22'

Test #157:

score: 12
Accepted
time: 0ms
memory: 3712kb

input:

21 38
16 21
6 2
16 19
6 1
20 19
11 8
10 11
2 7
5 1
5 6
10 13
20 17
10 14
17 18
1 2
7 8
15 20
9 12
17 21
8 10
10 9
21 20
14 15
14 13
8 9
9 11
19 17
3 1
10 12
7 1
6 4
18 20
6 7
15 16
4 1
5 7
17 15
11 13

output:

22

result:

ok single line: '22'

Test #158:

score: 12
Accepted
time: 1ms
memory: 3712kb

input:

21 38
5 7
8 10
12 8
8 11
21 18
2 7
7 3
1 4
17 15
13 10
8 14
3 6
4 3
9 14
16 15
18 20
2 3
6 7
16 17
15 14
11 14
18 15
5 6
16 20
20 21
12 9
18 16
21 15
8 7
2 1
19 17
9 10
18 17
2 6
5 2
8 9
10 12
13 8

output:

21

result:

ok single line: '21'

Test #159:

score: 12
Accepted
time: 0ms
memory: 3584kb

input:

21 38
17 20
15 21
10 13
5 7
9 8
5 4
7 8
5 6
10 12
7 2
1 7
16 17
14 10
20 15
17 18
15 14
12 8
9 14
18 21
21 16
20 18
11 9
4 3
3 1
1 2
5 3
11 10
2 3
10 8
11 8
14 8
4 6
19 21
12 11
1 4
16 19
15 16
15 18

output:

20

result:

ok single line: '20'

Test #160:

score: 12
Accepted
time: 0ms
memory: 3712kb

input:

21 38
17 19
16 19
20 21
13 14
4 1
21 16
9 14
11 12
8 7
6 7
7 2
3 7
10 11
8 9
15 17
12 10
7 1
1 2
19 21
20 15
20 18
15 16
4 5
9 12
17 16
11 9
1 6
5 1
5 6
11 8
9 10
15 18
11 13
14 15
17 18
2 3
7 5
10 8

output:

18

result:

ok single line: '18'

Test #161:

score: 12
Accepted
time: 1ms
memory: 3712kb

input:

21 38
21 18
20 19
3 6
17 18
10 11
20 15
3 2
18 19
2 1
15 16
18 20
13 11
10 13
20 21
8 9
14 15
4 6
12 9
8 12
11 14
14 13
1 3
9 13
21 19
17 15
7 8
7 4
4 2
7 6
4 1
19 17
9 10
3 5
1 6
9 11
12 10
3 4
15 19

output:

20

result:

ok single line: '20'

Test #162:

score: 12
Accepted
time: 1ms
memory: 3584kb

input:

21 38
7 8
9 10
10 8
20 16
10 14
17 15
9 11
3 4
16 15
3 5
21 18
15 19
15 14
4 1
21 17
8 11
18 19
12 11
8 12
18 16
1 3
15 20
5 1
10 13
17 19
20 17
5 7
13 9
7 6
2 4
3 2
11 10
12 10
1 6
9 8
5 4
1 2
18 15

output:

19

result:

ok single line: '19'

Test #163:

score: 12
Accepted
time: 1ms
memory: 3712kb

input:

21 38
3 1
14 12
9 14
5 3
4 3
15 20
19 15
18 21
10 8
20 16
11 10
11 12
17 21
5 6
17 18
10 14
11 8
14 15
16 15
2 1
4 5
8 13
1 7
7 8
19 21
7 4
15 21
1 4
11 14
16 17
6 3
2 4
15 18
7 6
11 9
9 10
9 8
18 19

output:

19

result:

ok single line: '19'

Test #164:

score: 12
Accepted
time: 0ms
memory: 3712kb

input:

21 38
19 21
10 12
10 14
12 11
11 13
15 18
8 13
15 17
3 2
9 11
13 10
15 16
14 9
2 4
16 21
1 2
7 2
8 7
4 1
4 6
7 1
13 12
20 15
1 5
10 11
4 3
3 7
5 6
20 21
20 18
19 15
15 14
20 19
16 17
8 10
5 4
15 21
8 9

output:

18

result:

ok single line: '18'

Test #165:

score: 12
Accepted
time: 1ms
memory: 3584kb

input:

21 38
21 17
2 7
14 12
16 17
11 10
6 3
9 11
20 16
5 3
4 1
6 1
7 8
10 8
4 3
18 16
8 13
5 2
17 18
15 16
16 21
21 18
1 5
1 2
13 11
12 11
15 14
12 13
2 3
20 17
19 16
12 10
6 4
11 8
19 18
6 2
8 9
21 20
13 9

output:

21

result:

ok single line: '21'

Test #166:

score: 12
Accepted
time: 1ms
memory: 3712kb

input:

21 38
16 17
14 12
14 11
10 9
1 5
14 10
2 6
7 2
4 1
17 19
3 4
8 12
10 8
11 13
15 14
15 17
9 11
6 5
7 5
20 17
11 10
5 2
1 2
9 8
8 14
16 18
17 18
8 7
3 1
15 18
1 6
1 7
21 16
20 16
10 13
16 15
17 21
16 19

output:

22

result:

ok single line: '22'

Test #167:

score: 12
Accepted
time: 0ms
memory: 3584kb

input:

21 38
12 10
19 16
11 13
3 1
6 4
15 16
20 16
12 11
18 16
4 3
10 9
15 17
1 6
9 14
20 19
1 4
1 2
15 21
7 5
11 8
16 17
21 18
15 14
2 4
1 5
15 20
9 13
8 9
12 9
7 8
12 14
3 5
6 5
17 18
21 20
14 10
11 10
2 6

output:

16

result:

ok single line: '16'

Test #168:

score: 12
Accepted
time: 0ms
memory: 3584kb

input:

21 38
7 8
8 11
9 13
5 2
6 2
3 4
9 11
14 15
14 8
9 8
21 19
2 3
13 12
10 12
6 5
12 14
5 4
20 16
4 6
7 3
6 7
10 14
11 14
19 18
15 21
19 16
17 21
1 2
16 15
1 3
18 17
20 15
19 17
12 11
20 19
10 8
7 5
17 16

output:

17

result:

ok single line: '17'

Test #169:

score: 12
Accepted
time: 0ms
memory: 3712kb

input:

21 38
4 6
8 9
18 21
10 13
3 2
1 4
13 11
14 15
1 2
6 5
7 3
16 15
18 17
12 11
19 18
16 20
7 1
17 19
9 14
5 1
7 6
19 20
11 10
10 14
21 16
20 15
3 6
5 2
13 12
14 12
15 17
21 17
7 8
6 2
12 10
19 16
8 10
11 9

output:

13

result:

ok single line: '13'

Test #170:

score: 12
Accepted
time: 0ms
memory: 3712kb

input:

21 38
1 6
2 4
15 21
11 13
15 19
15 17
11 14
2 1
17 18
12 10
12 14
7 8
6 2
20 21
19 16
10 8
8 12
2 3
19 18
14 15
13 10
19 20
3 4
6 7
20 17
4 6
11 12
18 15
9 8
5 3
9 11
16 17
7 1
6 3
2 7
14 13
16 15
10 14

output:

21

result:

ok single line: '21'

Test #171:

score: 12
Accepted
time: 0ms
memory: 3584kb

input:

21 38
4 6
17 18
15 14
15 16
12 11
9 10
15 20
1 4
13 11
1 6
2 4
18 21
16 17
16 20
9 8
6 7
1 2
7 4
20 17
18 15
8 7
9 12
2 6
15 21
3 5
10 13
21 19
11 9
5 6
7 1
20 18
10 14
13 14
18 19
11 14
12 8
3 2
13 8

output:

17

result:

ok single line: '17'

Test #172:

score: 12
Accepted
time: 1ms
memory: 3712kb

input:

21 38
5 2
14 8
19 21
12 10
1 7
12 11
15 18
14 10
9 14
7 5
10 8
6 7
16 15
2 6
3 7
14 15
9 10
4 6
15 19
19 17
19 18
4 5
4 2
7 8
2 7
16 20
14 11
9 8
18 20
20 15
1 3
15 21
17 20
13 9
1 2
15 17
13 8
11 9

output:

20

result:

ok single line: '20'

Test #173:

score: 12
Accepted
time: 0ms
memory: 3584kb

input:

21 38
1 4
3 1
10 9
4 7
19 20
8 11
16 15
6 4
14 13
21 16
18 17
10 11
3 4
19 21
3 7
21 17
19 15
20 18
11 13
12 11
15 20
5 4
3 5
2 7
2 5
14 15
8 9
11 9
14 8
2 1
11 14
14 10
21 15
18 15
17 16
8 7
6 5
13 12

output:

18

result:

ok single line: '18'

Test #174:

score: 0
Time Limit Exceeded

input:

100000 100020
52486 52500
60412 60386
71616 71614
21331 21301
29761 29751
19918 19961
63344 63308
14702 14678
93252 93257
87794 87758
91233 91229
91271 91279
25325 25297
7349 7384
18064 18072
64537 64488
73977 73982
80541 80499
88880 88865
17060 17068
87125 87132
86957 86995
39590 39600
95225 95246
...

output:


result:


Subtask #5:

score: 0
Time Limit Exceeded

Test #216:

score: 0
Time Limit Exceeded

input:

99995 142849
3388 3385
1883 1884
60752 60750
24094 24093
97084 97083
81408 81404
79388 79387
90741 90739
74918 74921
7354 7355
64236 64234
98928 98927
69618 69621
34595 34597
14050 14055
76055 76056
63593 63592
17507 17503
87218 87216
83931 83930
25805 25807
21744 21743
71708 71709
92053 92052
8830 ...

output:


result: