QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#555421#8117. MostoviZi_Gao110 ✓495ms99020kbC++234.5kb2024-09-09 23:01:372024-09-09 23:01:38

Judging History

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

  • [2024-09-09 23:01:38]
  • 评测
  • 测评结果:110
  • 用时:495ms
  • 内存:99020kb
  • [2024-09-09 23:01:37]
  • 提交

answer

//-DYUNQIAN -std=c++14 -O2 -Wall
#include<bits/stdc++.h>

#define ll long long
#define fi first
#define se second
#define mk make_pair

using namespace std;

inline int read(){
    int x=0,f=1;char c=getchar();
    for(;(c<'0'||c>'9');c=getchar()){if(c=='-')f=-1;}
    for(;(c>='0'&&c<='9');c=getchar())x=x*10+(c&15);
    return x*f;
}

void cmax(int &x,int v){x=max(x,v);}
void cmin(int &x,int v){x=min(x,v);}

const int N=3e5+5;
vector<int>G[N],adj[N];
vector<int>R[N];
set<int>S[N];
int n,m;

struct SegTree{
	int M,k,d[N<<2];
	void upd(int p){d[p]=min(d[p<<1],d[p<<1|1]);}
	void build(int n,vector<int>A){
		k=0,M=1;while(M<n)M<<=1,k++;
		for(int i=1;i<=M+M;i++)d[i]=n+1;
		for(int i=1;i<=n;i++)d[i+M-1]=A[i];
		for(int i=M-1;i>=1;i--)upd(i);
	}
	int qmin(int l,int r){
		int res=n+1;
		for(l+=M-1,r+=M;l<r;l>>=1,r>>=1){
			if(l&1)cmin(res,d[l++]);
			if(r&1)cmin(res,d[--r]);
		}
		return res;
	}
}T;

int dep[N],fa[N],sz[N],dfn[N],top[N],hson[N],dfc,pos[N],id[N];
void dfs1(int u,int de){
	dep[u]=de,sz[u]=1;
	for(int v:G[u]){
		if(v==fa[u])continue;
		fa[v]=u,dfs1(v,de+1),sz[u]+=sz[v];
		if(sz[v]>sz[hson[u]])hson[u]=v;
	}
}
void dfs2(int u,int tp){
	top[u]=tp,dfn[u]=++dfc,id[dfc]=u;
	if(hson[u])dfs2(hson[u],tp);
	for(int v:G[u]){
		if(v==fa[u]||v==hson[u])continue;
		dfs2(v,v);
	}
}
int getnode(int u,int v){
	assert(dfn[v]>=dfn[u]&&dfn[v]<=dfn[u]+sz[u]-1);
	int de=dep[u]+1;
	while(dep[top[v]]>de)v=fa[top[v]];
	int dis=dep[v]-de;
	return id[dfn[v]-dis];
}

struct BIT{
	int c[N];
	void clear(){memset(c,0,sizeof(c));}
	int lowbit(int x){return x&(-x);}
	void Add(int x,int v){for(int i=x;i<=n;i+=lowbit(i))c[i]+=v;}
	int sum(int x){int res=0;for(int i=x;i;i-=lowbit(i))res+=c[i];return res;}
	void add(int l,int r,int v){if(l<=r)Add(r+1,-v),Add(l,v);}
	int qval(int x){return sum(x);}
}W;

signed main(void){

#ifdef YUNQIAN
    freopen("in.in","r",stdin);
//    freopen("out.out","w",stdout);
#endif
	
	n=read(),m=read();
	vector<pair<int,int> >E;vector<int>deg(n+1,0);
	for(int i=1;i<=m;i++){
		int u=read(),v=read();E.emplace_back(mk(u,v));
		adj[u].emplace_back(v),adj[v].emplace_back(u),deg[u]++,deg[v]++;
	}
	
	vector<bool>vis(n+1,0);
	function<void(int,int)>buildtree=[&](int u,int fa){
		vis[u]=1;
		for(int v:adj[u]){
			if(!vis[v])dep[v]=dep[u]+1,buildtree(v,u),G[u].emplace_back(v);
			else if(dep[v]<dep[u]&&v!=fa)R[u].emplace_back(v);
		}
	};
	dep[1]=1,buildtree(1,0);
	dfs1(1,1),dfs2(1,1);
	
	vector<int>val(n+1,n+1);
	for(int i=1;i<=n;i++){
		for(int j:R[i])cmin(val[dfn[i]],dep[j]);
	}
	T.build(n,val);
	
	auto Merge=[&](set<int>&A,set<int>&B){
		if(A.size()<B.size())swap(A,B);
		for(int x:B)A.insert(x);B.clear();
	};
	
	vector<int>mxlow(n+1,0),mnlow(n+1,0);// max/min low
	function<void(int)>getlow=[&](int u){
		for(int v:G[u])getlow(v),Merge(S[u],S[v]);
		for(int j:R[u])S[u].insert(dep[j]);
		S[u].erase(S[u].lower_bound(dep[u]-1),S[u].end());
		if(S[u].size())mxlow[u]=*--S[u].end(),mnlow[u]=*S[u].begin();
		else mxlow[u]=0,mnlow[u]=n+1;
	};
	getlow(1);
	
	W.clear();vector<int>cut(n+1,0);
	
	fill(vis.begin(),vis.end(),0);
	map<pair<int,int>,bool>Ans;
	
	auto addres=[&](int u,int v){Ans[mk(u,v)]=Ans[mk(v,u)]=1;};
	auto getans=[&](int u){
		// (u,son[u]) | (anc[u],u)
		if(u==1){
			if(G[u].size()>=3)return ;
			if(G[u].size()==2){
				for(int v:G[u])if(sz[v]==1)addres(u,v);
			}
			if(G[u].size()==1){
				int v=G[u][0];
				if(G[v].size()<=1)addres(u,v);
			}
			return ;
		}
		for(int v:G[u]){
			if(mnlow[v]==mxlow[v])vis[mnlow[v]]=1;
			W.add(mnlow[v]+1,mxlow[v]-1,1);
		}
		for(int v:G[u]){
			if(mnlow[v]>=dep[u])cut[u]--;
			if(cut[u]==0){
				bool chk=1;
				for(int j:G[v])if(mnlow[j]>=dep[u])chk=0;
				if(chk)addres(u,v);
			}
			if(mnlow[v]>=dep[u])cut[u]++;
		}
		
		if(cut[u]>=1)goto ED2;
		for(int j:R[u]){
			int x=getnode(j,u);
			if(mnlow[x]>=dep[j])cut[j]--;
			if(cut[j]==0){
				if(vis[dep[j]])goto ED;
				if(W.qval(dep[j])>=1){addres(u,j);goto ED;}
				if(j==1){addres(u,j);goto ED;}
				if(T.qmin(dfn[x],dfn[u]-1)<dep[j]||T.qmin(dfn[u]+sz[u],dfn[x]+sz[x]-1)<dep[j])addres(u,j);
			}
			ED:if(mnlow[x]>=dep[j])cut[j]++;
		}
		
		ED2:for(int v:G[u]){
			if(mnlow[v]==mxlow[v])vis[mnlow[v]]=0;
			W.add(mnlow[v]+1,mxlow[v]-1,-1);
		}
	};
	
	for(int i=1;i<=n;i++)for(int j:G[i])cut[i]+=(mnlow[j]>=dep[i]);
	for(int i=1;i<=n;i++)getans(i);
	int res=0;for(auto e:E)res+=(Ans[mk(e.fi,e.se)]==0);cout<<res<<endl;

    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 13
Accepted

Test #1:

score: 13
Accepted
time: 6ms
memory: 27300kb

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: 27132kb

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: 0ms
memory: 27320kb

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: 0ms
memory: 28460kb

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: 7ms
memory: 28600kb

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: 0ms
memory: 30516kb

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: 3ms
memory: 27176kb

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: 0ms
memory: 27284kb

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: 28660kb

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: 29564kb

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: 29376kb

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: 28636kb

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: 7ms
memory: 30316kb

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: 6ms
memory: 27272kb

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: 3ms
memory: 30564kb

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: 0ms
memory: 28656kb

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: 3ms
memory: 28744kb

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: 0ms
memory: 30704kb

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: 6ms
memory: 30300kb

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: 5ms
memory: 27324kb

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: 5ms
memory: 30520kb

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: 2ms
memory: 26924kb

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: 0ms
memory: 30704kb

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: 0ms
memory: 29416kb

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: 0ms
memory: 29412kb

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: 29552kb

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: 3ms
memory: 27572kb

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: 27120kb

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: 6ms
memory: 27284kb

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: 0ms
memory: 30360kb

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: 0ms
memory: 27272kb

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: 29632kb

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: 0ms
memory: 27588kb

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: 0ms
memory: 27364kb

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: 0ms
memory: 27512kb

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: 3ms
memory: 30296kb

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: 6ms
memory: 29628kb

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: 0ms
memory: 27240kb

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: 0ms
memory: 28432kb

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: 3ms
memory: 29636kb

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: 3ms
memory: 29352kb

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: 7ms
memory: 29356kb

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: 6ms
memory: 27340kb

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: 3ms
memory: 27832kb

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: 0ms
memory: 25604kb

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: 0ms
memory: 27884kb

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: 8ms
memory: 29920kb

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: 0ms
memory: 29040kb

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: 3ms
memory: 28832kb

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: 3ms
memory: 28852kb

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: 4ms
memory: 29700kb

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: 3ms
memory: 30584kb

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: 0ms
memory: 27868kb

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: 3ms
memory: 27648kb

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: 0ms
memory: 29016kb

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: 3ms
memory: 27140kb

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: 0ms
memory: 27716kb

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: 4ms
memory: 28912kb

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: 4ms
memory: 29692kb

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: 0ms
memory: 30876kb

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: 0ms
memory: 29592kb

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: 3ms
memory: 29756kb

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: 7ms
memory: 29924kb

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: 4ms
memory: 27728kb

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: 0ms
memory: 27644kb

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: 6ms
memory: 30872kb

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: 3ms
memory: 27380kb

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: 3ms
memory: 28084kb

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: 3ms
memory: 27748kb

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: 6ms
memory: 27804kb

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: 3ms
memory: 31004kb

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: 3ms
memory: 27744kb

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: 4ms
memory: 27452kb

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: 8ms
memory: 27932kb

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: 3ms
memory: 27576kb

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: 0ms
memory: 27408kb

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: 0ms
memory: 27736kb

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: 4ms
memory: 27972kb

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: 4ms
memory: 30028kb

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: 3ms
memory: 28200kb

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: 6ms
memory: 31440kb

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: 5ms
memory: 29232kb

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: 0ms
memory: 27808kb

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: 0ms
memory: 29932kb

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: 4ms
memory: 27796kb

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: 7ms
memory: 27716kb

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: 6ms
memory: 27792kb

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: 9ms
memory: 28124kb

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: 8ms
memory: 27912kb

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: 4ms
memory: 29968kb

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: 3ms
memory: 29900kb

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: 4ms
memory: 27932kb

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: 0ms
memory: 29280kb

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: 29300kb

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: 25
Accepted

Test #95:

score: 25
Accepted
time: 2ms
memory: 27552kb

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: 2ms
memory: 30464kb

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: 2ms
memory: 27464kb

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: 2ms
memory: 27572kb

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: 5ms
memory: 27396kb

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: 0ms
memory: 27304kb

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: 2ms
memory: 30572kb

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: 2ms
memory: 29048kb

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: 2ms
memory: 30544kb

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: 3ms
memory: 30848kb

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: 7ms
memory: 27432kb

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: 0ms
memory: 27532kb

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: 3ms
memory: 31048kb

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: 0ms
memory: 29920kb

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: 0ms
memory: 30672kb

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: 0ms
memory: 27668kb

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: 3ms
memory: 28976kb

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: 6ms
memory: 27364kb

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: 3ms
memory: 29764kb

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: 4ms
memory: 30744kb

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: 5ms
memory: 30120kb

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: 0ms
memory: 27888kb

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: 3ms
memory: 30796kb

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: 0ms
memory: 28972kb

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: 3ms
memory: 30056kb

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: 4ms
memory: 28048kb

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: 8ms
memory: 29900kb

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: 0ms
memory: 27708kb

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: 0ms
memory: 27872kb

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: 4ms
memory: 27796kb

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: 5ms
memory: 31496kb

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: 3ms
memory: 29804kb

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: 5ms
memory: 30476kb

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: 10ms
memory: 30396kb

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: 7ms
memory: 31452kb

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: 4ms
memory: 27652kb

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: 3ms
memory: 27596kb

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: 7ms
memory: 27772kb

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: 0ms
memory: 30188kb

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: 3ms
memory: 27376kb

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: 6ms
memory: 27448kb

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: 25
Accepted
time: 366ms
memory: 75932kb

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:

0

result:

ok single line: '0'

Test #137:

score: 25
Accepted
time: 359ms
memory: 76272kb

input:

1000 300000
797 992
693 369
271 232
950 854
238 527
339 921
699 80
454 359
394 292
289 574
644 774
967 315
989 582
325 542
796 674
341 52
141 110
879 415
102 320
564 757
259 665
812 402
642 928
913 791
11 801
741 73
654 937
740 286
695 754
333 609
800 289
148 618
8 940
630 792
223 768
650 518
938 11...

output:

0

result:

ok single line: '0'

Test #138:

score: 25
Accepted
time: 328ms
memory: 77512kb

input:

1000 300000
547 60
136 671
578 538
349 89
487 869
958 370
319 276
406 99
339 437
753 238
905 924
301 997
944 791
414 152
385 372
76 421
308 45
960 421
737 420
78 465
461 592
501 404
711 25
522 847
123 497
561 798
244 524
229 511
46 172
471 3
567 972
898 20
871 275
279 32
843 869
780 325
30 160
929 4...

output:

0

result:

ok single line: '0'

Test #139:

score: 25
Accepted
time: 350ms
memory: 75884kb

input:

1000 300000
646 169
510 645
199 395
473 32
908 332
134 848
71 961
829 447
879 71
657 448
175 48
554 831
456 223
661 754
2 681
90 805
960 212
836 781
143 402
445 508
96 95
823 415
558 702
518 71
524 664
359 480
830 541
284 331
273 905
563 298
505 246
460 688
90 308
306 495
116 935
851 989
469 316
955...

output:

0

result:

ok single line: '0'

Test #140:

score: 25
Accepted
time: 349ms
memory: 74928kb

input:

1000 300000
309 151
861 204
350 728
921 807
394 669
915 239
612 88
47 337
223 46
900 27
252 37
585 3
526 423
696 301
378 938
608 515
190 2
677 23
82 548
136 958
593 226
43 839
63 386
764 69
707 134
411 966
130 718
333 447
290 158
914 84
175 33
292 312
900 892
528 480
793 6
69 662
467 184
728 465
762...

output:

0

result:

ok single line: '0'

Test #141:

score: 25
Accepted
time: 329ms
memory: 75176kb

input:

1000 300000
821 59
980 149
99 958
184 763
163 422
334 151
408 310
961 142
768 189
966 859
163 372
811 639
295 481
132 803
77 884
208 767
560 950
979 6
631 613
553 211
843 128
466 998
231 456
939 342
625 739
539 807
340 2
49 72
82 772
238 688
734 455
123 641
166 888
602 986
407 135
814 79
19 817
673 ...

output:

0

result:

ok single line: '0'

Test #142:

score: 25
Accepted
time: 314ms
memory: 74776kb

input:

1000 300000
396 803
163 150
474 538
515 207
723 703
64 206
777 282
638 506
341 617
172 242
235 245
122 728
607 825
398 476
820 998
180 926
30 120
320 654
620 142
89 186
516 390
966 820
25 176
245 723
261 587
679 870
537 640
16 203
706 185
299 35
872 306
271 750
113 589
501 216
396 650
894 423
486 19...

output:

0

result:

ok single line: '0'

Test #143:

score: 25
Accepted
time: 367ms
memory: 73204kb

input:

1000 300000
492 618
85 301
217 659
571 38
89 305
251 646
609 770
736 979
408 201
642 636
360 610
414 895
128 710
29 995
333 453
996 612
337 462
336 967
986 725
441 737
868 895
859 30
65 502
28 582
108 652
440 698
356 481
263 426
391 657
515 294
841 452
289 848
435 546
724 446
408 287
271 526
874 219...

output:

0

result:

ok single line: '0'

Test #144:

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

input:

1000 30000
679 680
798 628
930 391
393 690
686 184
690 33
943 319
267 323
181 288
430 781
25 859
184 832
391 502
83 582
284 905
684 893
389 704
448 680
290 44
302 407
760 630
743 311
319 620
816 184
663 577
768 73
258 181
688 27
25 542
486 325
839 391
470 687
25 851
557 449
598 325
60 12
212 798
709...

output:

0

result:

ok single line: '0'

Test #145:

score: 25
Accepted
time: 26ms
memory: 31428kb

input:

1000 30000
896 75
851 664
318 840
359 494
528 739
790 497
473 959
975 941
853 352
538 910
146 325
704 14
664 911
804 869
344 371
63 852
959 733
21 622
982 686
747 509
508 445
65 324
425 686
22 959
881 790
782 504
878 975
859 528
372 441
747 202
664 365
404 135
910 61
309 352
64 325
112 318
835 982
1...

output:

0

result:

ok single line: '0'

Test #146:

score: 25
Accepted
time: 32ms
memory: 33208kb

input:

1000 30000
204 970
210 871
141 924
124 382
73 171
187 267
920 708
920 299
634 932
873 454
77 340
493 238
31 34
550 49
420 430
426 550
424 273
144 29
904 735
147 753
276 606
606 781
352 931
570 673
851 1000
135 772
724 750
626 517
772 404
279 584
436 602
641 270
913 660
34 266
871 833
559 204
705 187...

output:

0

result:

ok single line: '0'

Test #147:

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

input:

1000 30000
528 647
998 158
65 221
356 312
281 785
285 625
857 143
767 339
592 355
172 206
377 498
498 520
470 219
317 785
527 291
164 859
951 226
502 498
109 636
245 48
926 998
291 955
151 454
330 544
600 745
923 544
544 402
188 460
206 481
619 847
243 13
206 862
825 16
847 742
739 41
931 67
510 951...

output:

0

result:

ok single line: '0'

Test #148:

score: 25
Accepted
time: 3ms
memory: 29980kb

input:

1000 6000
25 77
530 313
586 936
395 126
47 243
106 740
434 849
299 630
372 52
116 219
294 377
190 91
811 492
43 599
51 959
136 760
981 351
176 569
98 569
923 835
372 387
981 534
100 750
817 875
47 271
374 135
151 174
65 188
66 901
235 787
480 723
593 707
875 806
109 773
850 876
682 585
579 697
955 4...

output:

24

result:

ok single line: '24'

Test #149:

score: 25
Accepted
time: 5ms
memory: 30404kb

input:

1000 6000
28 674
148 322
469 195
916 264
916 684
137 695
782 251
189 336
513 984
359 354
121 411
519 887
257 335
363 137
800 475
456 206
705 190
91 475
622 297
365 158
299 741
246 687
389 163
489 219
909 631
361 208
449 195
353 916
175 513
276 224
738 843
889 343
762 881
13 3
615 518
619 747
10 20
2...

output:

25

result:

ok single line: '25'

Test #150:

score: 25
Accepted
time: 3ms
memory: 28148kb

input:

1000 6000
49 565
219 125
876 226
23 206
579 452
709 780
826 205
14 147
478 514
668 446
675 914
782 302
981 982
801 821
204 580
223 187
603 455
225 193
730 226
691 245
729 252
391 35
374 382
147 860
268 357
55 19
330 841
239 275
497 824
252 245
713 75
962 515
934 268
238 474
226 6
771 577
61 552
342 ...

output:

16

result:

ok single line: '16'

Test #151:

score: 25
Accepted
time: 3ms
memory: 28368kb

input:

1000 6000
55 911
86 191
528 800
46 522
817 388
546 563
508 418
431 817
82 85
717 258
244 909
428 751
971 146
360 440
357 201
913 33
518 521
579 469
80 628
584 594
268 887
566 58
830 35
625 542
226 913
369 165
584 617
616 564
435 206
488 202
494 659
591 257
323 730
348 407
26 565
556 19
350 716
886 6...

output:

104

result:

ok single line: '104'

Test #152:

score: 25
Accepted
time: 0ms
memory: 27172kb

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 #153:

score: 25
Accepted
time: 3ms
memory: 27088kb

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 #4:

score: 12
Accepted

Test #154:

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

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: 2ms
memory: 27272kb

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: 2ms
memory: 30640kb

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: 26988kb

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: 3ms
memory: 29352kb

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: 29540kb

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: 5ms
memory: 29364kb

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: 0ms
memory: 29364kb

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: 6ms
memory: 27380kb

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: 5ms
memory: 27200kb

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: 3ms
memory: 27192kb

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: 3ms
memory: 27324kb

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: 0ms
memory: 29292kb

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: 28508kb

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: 30240kb

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: 2ms
memory: 28556kb

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: 2ms
memory: 28732kb

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: 3ms
memory: 27232kb

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: 0ms
memory: 29284kb

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: 29376kb

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: 12
Accepted
time: 60ms
memory: 48448kb

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:

86482

result:

ok single line: '86482'

Test #175:

score: 12
Accepted
time: 79ms
memory: 50132kb

input:

100000 100020
5665 4937
20655 20864
85198 84872
32939 33228
3499 3778
77378 76809
13145 12604
6 25
37070 37173
46518 46463
72553 72155
79478 80508
2247 3158
28336 28256
22619 22331
46494 46195
83180 83960
31007 32005
31717 31340
82153 82613
72271 73265
19802 20425
96834 97239
29178 29731
53123 53298...

output:

85665

result:

ok single line: '85665'

Test #176:

score: 12
Accepted
time: 75ms
memory: 49440kb

input:

100000 100020
78697 78431
52881 54606
33627 33657
8339 8769
37447 35933
48278 49153
10560 11954
10681 11169
10286 11325
42303 42606
52493 50486
40825 41877
16133 15437
3856 5822
90006 90605
9400 10458
80688 79130
10153 12043
19652 20701
88350 86547
84199 83674
62288 61281
45125 45992
18364 16539
518...

output:

86013

result:

ok single line: '86013'

Test #177:

score: 12
Accepted
time: 74ms
memory: 47552kb

input:

100000 100020
22415 23043
31329 29387
89655 92291
3905 1002
53527 53972
77986 80807
16025 14884
85162 85620
68408 67326
3490 729
97831 95495
23966 25392
85442 87764
85203 82617
21335 21361
7050 6662
51483 53005
69036 66675
9707 7553
76938 79394
84669 86326
86472 86647
16149 18957
21062 19891
7952 92...

output:

85941

result:

ok single line: '85941'

Test #178:

score: 12
Accepted
time: 81ms
memory: 47700kb

input:

100000 100020
94335 93949
12697 14450
77512 81520
28593 28283
73025 72184
59083 62698
69014 66004
23524 22063
40499 38286
3020 1150
25921 24485
72899 70649
86774 82978
7373 8556
30247 32105
76950 73505
87440 85194
9266 9002
67298 70042
35506 36928
30006 27611
30716 26743
51669 51816
57001 54025
7771...

output:

86021

result:

ok single line: '86021'

Test #179:

score: 12
Accepted
time: 71ms
memory: 50136kb

input:

100000 100020
36927 35813
56875 56912
9758 6194
74944 71410
33355 33358
96250 93389
64756 66272
84591 86229
19598 16367
17837 22366
89509 90408
84775 86491
21319 16479
52176 52279
43033 40727
62694 58193
42132 46584
75315 73485
46585 50985
39127 37750
91793 90941
73371 74514
9416 10125
29833 31853
9...

output:

86036

result:

ok single line: '86036'

Test #180:

score: 12
Accepted
time: 73ms
memory: 50120kb

input:

100000 100020
33012 37858
29484 30901
11035 5874
95721 96744
48578 47223
3431 6586
71087 71065
32781 28349
6437 11159
25867 23221
88722 85514
80211 80528
93441 87482
6508 12296
80141 80589
42724 48591
23933 22875
50508 49269
14129 10699
27225 21287
71044 67802
50942 53979
14034 11386
43698 47221
761...

output:

85902

result:

ok single line: '85902'

Test #181:

score: 12
Accepted
time: 75ms
memory: 49940kb

input:

100000 100020
82589 78779
29506 33747
72259 68466
45875 45454
22576 16421
67713 64260
98532 93202
2461 2620
16876 10437
91103 88601
80997 80229
28276 33404
67454 61953
45698 46787
89851 91881
46526 41199
36134 42589
61481 59002
58604 56799
3496 9518
45933 44238
76902 82219
93952 95588
62003 68512
73...

output:

85712

result:

ok single line: '85712'

Test #182:

score: 12
Accepted
time: 75ms
memory: 49908kb

input:

100000 100020
96678 98778
24637 23606
19947 17518
30099 30946
41380 38886
8187 4307
45352 47626
56266 54258
67335 70674
29647 37245
200 749
53744 48585
75751 78347
41600 33871
53120 55610
48010 53620
78013 71745
20972 28889
82634 81519
36677 42892
27667 28194
53843 48298
51117 47274
15665 19265
4562...

output:

85620

result:

ok single line: '85620'

Test #183:

score: 12
Accepted
time: 82ms
memory: 47700kb

input:

100000 100020
288 495
19711 17939
76418 79736
93281 93747
57119 61753
22059 17643
87279 87609
74822 69867
70224 67426
67979 59980
7444 3974
10710 1745
89746 83458
54297 46775
1127 2434
1029 5528
91896 97532
715 7092
73628 76787
87337 81065
48754 47595
17674 20938
30063 35931
13906 7585
11468 16164
5...

output:

85745

result:

ok single line: '85745'

Test #184:

score: 12
Accepted
time: 74ms
memory: 49420kb

input:

100000 100020
73457 71946
17499 21072
80979 90227
13627 16771
53493 52560
57665 49443
55079 48399
17877 12841
96847 91165
23745 25873
81381 81806
93347 86251
66004 67263
49068 55941
71406 69527
30170 24331
77592 85895
33797 43560
6304 9364
2952 7029
50792 47364
97343 93307
13431 8200
44911 41346
683...

output:

85553

result:

ok single line: '85553'

Test #185:

score: 12
Accepted
time: 84ms
memory: 48916kb

input:

100000 100020
3826 11406
18581 20166
21214 11969
12075 21080
52817 44171
26534 36849
90196 81789
43819 47068
73216 69825
73274 77640
11596 11023
41489 32599
17785 19202
23819 12867
77978 71682
17857 10308
2453 4517
81961 73799
62683 70004
93421 93943
26357 34163
2193 7916
67930 63906
7728 9028
55880...

output:

85634

result:

ok single line: '85634'

Test #186:

score: 12
Accepted
time: 76ms
memory: 50176kb

input:

100000 100020
8480 1334
44132 51512
47051 35259
70377 77478
73076 70387
3441 3118
42261 42649
27605 29538
59725 58663
70037 59104
31170 38345
786 2269
68215 71758
43901 38747
73659 69493
26656 31664
93791 99095
75116 78089
55388 59399
52521 53816
44391 49010
79809 68032
93530 96297
49953 48812
13255...

output:

85533

result:

ok single line: '85533'

Test #187:

score: 12
Accepted
time: 82ms
memory: 49784kb

input:

100000 100020
15304 8816
17603 25213
57079 44693
717 409
49338 49654
85187 74759
40761 43604
6606 6849
11816 11867
45827 35872
36371 27239
68246 74355
8905 13649
15799 2864
83644 88251
3179 1863
9849 19360
10677 11319
85128 82730
50516 60747
3772 215
1119 9106
39306 43890
82242 74968
71436 59605
488...

output:

85641

result:

ok single line: '85641'

Test #188:

score: 12
Accepted
time: 76ms
memory: 49984kb

input:

100000 100020
7265 6773
1490 3173
8473 6203
33290 21417
85035 84407
400 1279
68862 62209
5451 12220
13892 23078
18037 28966
47376 54067
57459 51579
71900 78566
22782 29229
11904 23033
56566 60078
41541 53931
71681 67223
31750 30149
22596 21665
45251 36775
27650 29149
32980 45993
32055 40258
32196 29...

output:

85400

result:

ok single line: '85400'

Test #189:

score: 12
Accepted
time: 71ms
memory: 50312kb

input:

100000 100020
89212 95370
49755 36600
70261 82936
34787 33750
447 87
90492 78519
56680 61352
61334 46573
5775 2922
1026 1223
36957 35024
34661 48176
83310 90847
81408 89201
46941 49667
60088 45877
52416 58796
95589 81686
7040 13677
9984 22720
74888 69134
45501 48610
68866 58072
4307 13287
42528 3984...

output:

85488

result:

ok single line: '85488'

Test #190:

score: 12
Accepted
time: 77ms
memory: 49908kb

input:

100000 100020
26999 19945
27043 21270
86209 98180
20737 17762
89194 94959
68687 77335
57308 46542
56482 69689
56862 48666
79590 81307
58228 56134
12733 11399
78351 71399
29631 29290
21889 14748
8274 6132
52733 61321
3821 1446
80962 77683
64186 72482
3147 18311
10080 12256
44962 38125
112 256
50877 4...

output:

85269

result:

ok single line: '85269'

Test #191:

score: 12
Accepted
time: 85ms
memory: 51060kb

input:

100000 100020
77685 77422
37206 38549
24327 10615
69346 71048
78349 68683
91971 91606
28227 18638
450 4641
8283 1148
45720 43960
15609 23226
12186 13731
93805 76776
29679 29442
22642 39206
17094 2376
14334 8856
95576 83378
10169 24296
3481 17741
46118 41604
99702 92456
11542 8471
31602 42360
92338 9...

output:

85315

result:

ok single line: '85315'

Test #192:

score: 12
Accepted
time: 68ms
memory: 47884kb

input:

100000 100020
45201 62974
58728 47097
72502 87092
39995 29571
85897 79664
20718 24506
81450 80666
11065 8100
86843 82775
37751 34200
24787 42430
22969 30021
1263 788
28663 13125
47137 48760
632 692
77421 63341
99402 81489
44421 39031
12910 25664
613 3701
41631 55127
43728 43277
20741 33966
68730 608...

output:

85139

result:

ok single line: '85139'

Test #193:

score: 12
Accepted
time: 84ms
memory: 49676kb

input:

100000 100020
56872 55086
62323 65511
14386 10987
55944 51951
71690 71505
1975 6944
9772 17519
71444 82387
44006 42016
69931 84635
72580 57178
95214 97196
31085 25018
80930 78551
74659 92340
49668 33783
395 278
39065 28702
80578 91725
70554 77889
21746 33994
4593 1430
10232 26882
22330 20211
84785 7...

output:

85165

result:

ok single line: '85165'

Test #194:

score: 12
Accepted
time: 72ms
memory: 50592kb

input:

100000 100020
11465 11470
45044 45028
41729 41776
886 922
52037 52005
65380 65356
59477 59473
62684 62714
73933 73888
98443 98465
62008 62029
31402 31419
83318 83354
99952 100000
48571 48619
96638 96676
36909 36900
65556 65603
493 495
43016 43019
14039 14013
18556 18584
24326 24327
23639 23685
40643...

output:

85407

result:

ok single line: '85407'

Test #195:

score: 12
Accepted
time: 68ms
memory: 49492kb

input:

100000 100020
34818 34559
23971 23258
66340 66606
57625 57992
64623 64359
53566 52982
33445 33098
3703 2906
56467 56204
86290 86471
43221 43165
12012 11700
93266 92448
32767 32137
83781 82924
97669 98190
57852 58249
3371 3395
60088 60980
53553 54349
34288 35020
83640 83123
78069 77742
7991 7373
1639...

output:

85993

result:

ok single line: '85993'

Test #196:

score: 12
Accepted
time: 75ms
memory: 48948kb

input:

100000 100020
40914 42530
64711 66660
14426 13810
10855 9214
87384 89205
52874 53782
31818 31256
61219 59779
94442 92805
67411 66300
35176 35708
23373 21537
65568 63743
37787 38392
63690 64159
82945 83614
66373 68308
96529 94730
34950 34175
92083 92967
17071 18296
52095 50709
93200 93868
72849 74443...

output:

85806

result:

ok single line: '85806'

Test #197:

score: 12
Accepted
time: 76ms
memory: 49400kb

input:

100000 100020
42227 44791
95373 97771
71332 69089
47918 49789
41105 42176
25242 22239
5772 8744
57150 54456
85624 86037
566 183
59853 61942
40538 39189
73568 71659
97217 98171
14880 16775
21871 23643
27535 30565
4579 7179
48381 51106
86531 84693
40960 40349
74106 73790
18994 22024
64924 64239
22900 ...

output:

85900

result:

ok single line: '85900'

Test #198:

score: 12
Accepted
time: 66ms
memory: 50004kb

input:

100000 100020
64503 64690
58563 59230
35933 33925
998 1417
66995 64743
97791 99649
4124 3133
29818 27463
83800 80458
73953 72774
33686 30519
64444 63697
26111 26536
85063 82802
94132 94786
65866 67354
56808 59280
82866 85119
83233 81892
70012 73440
40313 37602
13199 9751
69220 71947
73353 72676
8761...

output:

85995

result:

ok single line: '85995'

Test #199:

score: 12
Accepted
time: 80ms
memory: 49452kb

input:

100000 100020
11475 6996
13249 11788
58466 58733
21720 17341
66459 66910
67414 67136
97589 98867
25401 24275
62528 66518
24030 24064
639 1316
9343 8963
20062 15779
28730 33371
40088 44820
68186 67152
56587 53955
48111 43999
86777 86655
86809 89572
29198 33421
12942 10089
55913 58751
47506 49960
9552...

output:

86001

result:

ok single line: '86001'

Test #200:

score: 12
Accepted
time: 66ms
memory: 49416kb

input:

100000 100020
1871 359
50850 48313
51010 48937
50054 51836
87681 91802
84212 89873
6401 2200
90448 92037
50176 48288
64774 70288
99106 95056
20498 22980
9309 5395
90832 89196
41044 39860
88941 90685
73525 75284
24646 19640
9248 14612
45641 42437
89873 91017
88204 82252
57424 61336
43029 46008
31770 ...

output:

85937

result:

ok single line: '85937'

Test #201:

score: 12
Accepted
time: 77ms
memory: 51464kb

input:

100000 100020
59879 60029
91976 92711
37207 42647
91276 91424
82520 75631
12686 7670
99495 97376
17187 22778
10579 5919
24786 30238
88393 94739
42262 43530
86663 93260
19718 24527
75615 77851
45167 41577
56328 57774
42596 45158
97481 95744
21582 25907
22470 26108
54530 47729
54757 61638
69236 70297
...

output:

85904

result:

ok single line: '85904'

Test #202:

score: 12
Accepted
time: 88ms
memory: 50204kb

input:

100000 100020
88919 90177
15593 18004
17025 24551
96997 96380
29819 23714
82821 83203
81350 87091
69910 65884
4574 452
32420 35895
26171 28294
49350 55614
7782 14959
81118 87302
78150 83604
8563 16003
52334 47979
26800 19338
97241 98754
25161 21768
5075 12614
59740 54411
40283 47377
34582 34942
6872...

output:

85701

result:

ok single line: '85701'

Test #203:

score: 12
Accepted
time: 74ms
memory: 47480kb

input:

100000 100020
76624 81936
13147 13471
45803 38252
34096 31531
31838 28742
70566 68244
94161 90369
75730 81524
2634 7789
2509 1120
67587 61299
85458 94413
23944 17238
39012 45972
6160 11342
30325 35532
71952 66052
11892 13574
68552 62107
47401 47244
27769 32044
88556 83365
32158 26613
34910 40359
394...

output:

85596

result:

ok single line: '85596'

Test #204:

score: 12
Accepted
time: 78ms
memory: 51524kb

input:

100000 100020
20519 19894
6224 15571
18579 27110
34892 30447
13269 7589
85049 88688
30689 30584
70581 76267
79855 72946
61743 63749
56341 62622
14670 8939
34907 29501
60732 66864
5496 13896
28993 36375
38994 35469
15934 24769
6999 5396
37376 37877
94595 91918
77983 80673
43831 38491
49312 39963
7721...

output:

85768

result:

ok single line: '85768'

Test #205:

score: 12
Accepted
time: 79ms
memory: 49696kb

input:

100000 100020
77446 67475
87061 93693
61849 61015
80549 90308
29219 21572
3574 9084
40866 41070
46066 54586
38959 39774
94745 88811
86539 83410
44887 51143
74085 81701
85088 77662
60669 50304
34240 44048
40126 45283
83830 78018
26290 27454
2283 2861
83502 81260
26472 16442
48673 54759
8158 5624
2613...

output:

85596

result:

ok single line: '85596'

Test #206:

score: 12
Accepted
time: 81ms
memory: 47536kb

input:

100000 100020
37462 36338
88397 80938
76492 72146
50434 62318
81164 75822
71263 67590
93816 92958
92560 89387
61844 62177
69074 64530
65206 71752
43057 43689
20364 13176
71102 71496
2914 7151
50134 62101
22807 31103
28879 17071
90462 95046
84541 89107
62258 59323
77452 71301
48311 49242
3134 3656
34...

output:

85517

result:

ok single line: '85517'

Test #207:

score: 12
Accepted
time: 71ms
memory: 50380kb

input:

100000 100020
85116 89243
1107 6825
58343 58057
68290 64754
26283 37801
50246 57786
80081 83470
35592 46724
81130 85604
34684 36033
23619 34424
87396 74409
70854 59321
19645 9187
18648 9458
1574 8831
63559 57798
18720 24112
85202 95658
27157 22445
85763 73889
52603 39620
43027 32262
31132 20518
7086...

output:

85524

result:

ok single line: '85524'

Test #208:

score: 12
Accepted
time: 81ms
memory: 48864kb

input:

100000 100020
85450 85957
94157 86562
48053 48318
7150 4448
4481 15072
17359 7895
46989 50849
80578 79770
82694 92074
71912 83674
48264 36771
68509 64760
39916 37925
68715 59110
78662 87612
55221 45805
66635 62435
23300 20433
77273 67247
42223 29122
64051 63308
35823 40318
16021 11701
61791 57715
75...

output:

85467

result:

ok single line: '85467'

Test #209:

score: 12
Accepted
time: 82ms
memory: 50048kb

input:

100000 100020
83600 92459
23684 29412
91568 80835
73379 86008
65161 64631
1333 7243
78042 89235
34037 34289
146 431
89922 78571
72584 64304
2779 4808
6391 5698
50508 54394
36748 26924
4383 4177
81805 82445
50922 42305
41773 55675
69766 69065
91517 94080
652 543
37802 48990
44805 38731
13987 3811
326...

output:

85349

result:

ok single line: '85349'

Test #210:

score: 12
Accepted
time: 74ms
memory: 48936kb

input:

100000 100020
99833 89928
281 2111
1997 10758
8993 6268
8889 19962
50206 49350
44030 34574
96011 94131
38665 29622
32958 27009
86250 80530
85499 71261
59568 61402
9383 9907
56154 60213
14368 27604
75873 79805
95347 89209
68785 72642
92764 81002
64857 66362
19274 8884
18348 17822
92017 99393
50918 56...

output:

85256

result:

ok single line: '85256'

Test #211:

score: 12
Accepted
time: 87ms
memory: 49996kb

input:

100000 100020
94866 99924
40988 29864
61880 53012
88298 87621
13786 14148
57088 46086
3307 3390
22317 15659
59544 47234
52847 39559
225 850
50622 54966
21677 23200
34369 27181
28401 25185
61583 76024
10015 16603
84758 80634
5612 7370
50787 34115
42966 37391
78766 62264
57786 59717
70564 57329
62391 ...

output:

85330

result:

ok single line: '85330'

Test #212:

score: 12
Accepted
time: 78ms
memory: 49724kb

input:

100000 100020
63617 80748
8698 8219
45322 61295
32976 19306
13192 4277
44858 50740
74806 90696
74485 81445
9654 12768
24563 9654
90838 92727
19750 35739
24619 16763
52755 45332
61408 44645
8800 9798
59574 58919
93703 79680
60459 78295
44395 41762
42335 43826
38508 42227
2872 5465
25483 10261
14134 8...

output:

85087

result:

ok single line: '85087'

Test #213:

score: 12
Accepted
time: 86ms
memory: 50312kb

input:

100000 100020
46490 65227
9258 12087
55671 41234
80677 69090
61693 53682
57105 50027
40050 35698
75352 63420
59841 44633
65363 53718
24778 20323
81604 62809
62795 66866
16556 16497
22178 34620
53943 70670
53273 41721
12253 16940
91592 93249
73172 62312
71222 56313
67793 60697
86418 82132
66823 77780...

output:

85117

result:

ok single line: '85117'

Test #214:

score: 12
Accepted
time: 3ms
memory: 28796kb

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 #215:

score: 12
Accepted
time: 2ms
memory: 28516kb

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 #5:

score: 43
Accepted

Test #216:

score: 43
Accepted
time: 114ms
memory: 68204kb

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:

107771

result:

ok single line: '107771'

Test #217:

score: 43
Accepted
time: 117ms
memory: 63000kb

input:

99995 142849
90060 90057
7448 7445
85935 85933
15566 15562
25335 25338
821 822
25480 25477
71808 71807
71003 71002
84971 84972
19764 19763
13160 13154
80905 80902
75616 75620
8537 8536
57125 57122
30173 30177
77421 77423
74987 74990
31319 31321
94601 94600
89236 89232
74405 74404
40795 40792
54854 5...

output:

107485

result:

ok single line: '107485'

Test #218:

score: 43
Accepted
time: 115ms
memory: 63012kb

input:

99995 142849
93428 93424
41566 41567
75455 75456
51558 51556
60050 60048
36352 36351
74963 74964
53156 53157
36121 36120
32614 32618
85636 85638
77293 77288
70402 70405
90645 90646
801 799
98745 98748
66325 66319
41224 41225
42696 42697
841 846
88103 88106
58495 58497
63100 63101
3110 3109
73405 734...

output:

107548

result:

ok single line: '107548'

Test #219:

score: 43
Accepted
time: 112ms
memory: 64792kb

input:

99995 142849
56021 56022
11833 11831
13435 13439
20071 20074
60904 60903
54207 54208
21768 21769
84213 84212
22954 22955
75580 75583
83875 83876
89013 89012
95181 95182
90865 90864
41560 41562
73715 73711
58411 58412
9726 9724
93964 93962
84292 84289
53734 53737
77609 77606
69796 69795
14117 14119
4...

output:

107497

result:

ok single line: '107497'

Test #220:

score: 43
Accepted
time: 109ms
memory: 64860kb

input:

99995 142849
49404 49400
18443 18440
79995 79991
1534 1539
35787 35789
61277 61275
70452 70451
35686 35681
62903 62908
16641 16642
74443 74441
36785 36782
15474 15472
63508 63505
4586 4587
24788 24790
14515 14518
99580 99577
25191 25190
77575 77576
97462 97468
90189 90188
44595 44594
22724 22726
778...

output:

107705

result:

ok single line: '107705'

Test #221:

score: 43
Accepted
time: 99ms
memory: 63056kb

input:

99995 142849
18474 18473
48660 48661
95984 95985
41182 41183
19583 19586
59796 59798
13791 13792
65382 65381
932 935
56979 56977
83105 83106
44163 44160
66458 66457
14963 14965
53612 53613
24996 24992
71854 71850
87103 87104
20033 20029
59228 59227
86974 86973
4968 4969
24453 24454
27583 27584
87771...

output:

107746

result:

ok single line: '107746'

Test #222:

score: 43
Accepted
time: 100ms
memory: 67096kb

input:

99995 142849
93738 93743
85967 85968
68012 68013
82338 82341
15784 15780
77991 77990
62030 62028
36513 36518
94489 94491
87752 87747
90034 90035
57338 57337
5431 5430
23661 23663
86816 86815
59061 59066
83059 83060
27637 27636
32217 32220
155 154
74769 74768
22360 22362
64644 64640
96054 96053
42297...

output:

107532

result:

ok single line: '107532'

Test #223:

score: 43
Accepted
time: 102ms
memory: 67228kb

input:

99995 142849
11383 11385
43303 43304
98286 98282
47744 47747
52311 52305
81580 81579
25803 25804
20337 20341
83146 83147
87635 87638
93031 93032
70756 70754
13841 13842
18767 18768
25131 25130
59811 59815
63678 63674
77019 77020
90211 90212
87759 87754
50503 50499
45751 45752
6794 6792
21280 21279
3...

output:

107677

result:

ok single line: '107677'

Test #224:

score: 43
Accepted
time: 105ms
memory: 65868kb

input:

99995 142849
50734 50731
53070 53069
45723 45720
21696 21699
90802 90800
52712 52715
13692 13693
9715 9714
49134 49137
56992 56991
69302 69306
23535 23534
84020 84016
724 725
65359 65358
80123 80122
55875 55881
44586 44588
9341 9340
38044 38042
53852 53853
16007 16008
24902 24905
83645 83647
41835 4...

output:

107506

result:

ok single line: '107506'

Test #225:

score: 43
Accepted
time: 105ms
memory: 64668kb

input:

99995 142849
58411 58410
14017 14021
10679 10680
75881 75885
28379 28380
48388 48387
62917 62919
12594 12599
92473 92475
17045 17042
13453 13451
49611 49610
50805 50803
45532 45535
49754 49755
26262 26264
8032 8030
6191 6193
2967 2964
36786 36791
46884 46885
23535 23534
60583 60585
42988 42993
2365 ...

output:

107675

result:

ok single line: '107675'

Test #226:

score: 43
Accepted
time: 154ms
memory: 70004kb

input:

99995 185704
71084 71083
44613 44617
42764 42768
36441 36437
49113 49119
84778 84779
9625 9622
97656 97654
86311 86317
88285 88284
41366 41364
3622 3620
60304 60299
8332 8333
83048 83049
31937 31936
69481 69478
61772 61771
74139 74142
6472 6473
77241 77244
69619 69617
71545 71542
86763 86760
95232 9...

output:

114948

result:

ok single line: '114948'

Test #227:

score: 43
Accepted
time: 149ms
memory: 71952kb

input:

99995 185704
85295 85294
31605 31599
52802 52806
42226 42228
1707 1706
33870 33868
90801 90800
7223 7221
21229 21225
42442 42448
46460 46461
65122 65121
79819 79817
50761 50763
57109 57107
86668 86670
41283 41284
37179 37181
58726 58725
47910 47912
71801 71806
79347 79350
44766 44769
27498 27499
451...

output:

115189

result:

ok single line: '115189'

Test #228:

score: 43
Accepted
time: 127ms
memory: 74340kb

input:

99995 185704
7678 7679
48706 48707
63624 63628
40146 40149
75178 75179
51732 51733
95965 95970
15704 15707
25121 25122
80394 80395
13131 13128
96963 96961
21981 21980
57603 57597
97159 97158
23842 23840
27971 27967
79575 79571
3914 3916
73556 73551
77342 77340
41355 41356
59787 59786
86569 86567
957...

output:

115042

result:

ok single line: '115042'

Test #229:

score: 43
Accepted
time: 143ms
memory: 71848kb

input:

99995 185704
31984 31988
41806 41807
61863 61866
11678 11677
59439 59440
61453 61449
57066 57067
46581 46584
33643 33647
473 471
47894 47890
22284 22288
38392 38391
70492 70494
1994 1993
76887 76884
89972 89973
92249 92251
31568 31567
93623 93625
93056 93055
79943 79942
14741 14738
12086 12085
70447...

output:

114777

result:

ok single line: '114777'

Test #230:

score: 43
Accepted
time: 137ms
memory: 71816kb

input:

99995 185704
97449 97452
61299 61293
95851 95845
43587 43588
15155 15152
55382 55378
61783 61788
93372 93370
11006 11005
65686 65683
81799 81796
4788 4785
34582 34581
46164 46161
79575 79574
2750 2749
93660 93656
38171 38170
63071 63074
6335 6334
43768 43765
97587 97588
79037 79031
49403 49404
9004 ...

output:

114807

result:

ok single line: '114807'

Test #231:

score: 43
Accepted
time: 141ms
memory: 74192kb

input:

99995 185704
43051 43054
30617 30613
97561 97560
77173 77174
89062 89067
12081 12080
74761 74763
82440 82441
49527 49528
11004 11005
16095 16098
57897 57892
60716 60712
39390 39394
73478 73479
83979 83977
47608 47609
31836 31833
91718 91715
8321 8319
1941 1943
46111 46116
32217 32221
76736 76735
558...

output:

115092

result:

ok single line: '115092'

Test #232:

score: 43
Accepted
time: 144ms
memory: 71500kb

input:

99995 185704
83456 83455
9811 9809
55341 55336
731 732
40264 40259
73743 73741
4195 4196
37977 37978
80937 80939
77528 77527
89159 89156
2619 2620
98101 98102
61083 61085
46084 46086
97123 97120
72123 72127
33858 33857
60139 60142
2317 2312
29436 29441
86526 86522
53426 53431
7445 7446
7629 7627
530...

output:

114973

result:

ok single line: '114973'

Test #233:

score: 43
Accepted
time: 148ms
memory: 69912kb

input:

99995 185704
40 41
42990 42994
43263 43264
96531 96530
94364 94361
89551 89552
7020 7015
2679 2681
58039 58038
18595 18594
75161 75163
43906 43907
46478 46476
37689 37688
50604 50608
67487 67488
53590 53587
31436 31432
24239 24236
91907 91906
88636 88641
85450 85451
17685 17686
86917 86919
41311 413...

output:

114961

result:

ok single line: '114961'

Test #234:

score: 43
Accepted
time: 145ms
memory: 71884kb

input:

99995 185704
93046 93045
1791 1786
6921 6920
51387 51388
35246 35248
59062 59065
25055 25059
65515 65520
55791 55790
54334 54335
69173 69169
91091 91087
34544 34543
74887 74886
19069 19068
94302 94303
78443 78449
84684 84686
92376 92379
1857 1856
23218 23214
10882 10881
15798 15793
39061 39060
91549...

output:

114599

result:

ok single line: '114599'

Test #235:

score: 43
Accepted
time: 143ms
memory: 70228kb

input:

99995 185704
42059 42061
53652 53655
31382 31385
47181 47180
95982 95979
80154 80151
91553 91554
91382 91379
10180 10179
61232 61235
66274 66271
69147 69150
67005 67007
51368 51370
39416 39417
94335 94336
34049 34054
70754 70752
98786 98788
97365 97368
74556 74555
73688 73684
50857 50856
78906 78907...

output:

114886

result:

ok single line: '114886'

Test #236:

score: 43
Accepted
time: 254ms
memory: 86580kb

input:

99995 299984
65571 65574
34689 34691
2850 2854
5614 5608
98816 98817
1803 1802
44041 44043
68819 68823
81153 81152
38379 38380
31665 31668
70203 70197
8418 8419
69499 69497
3129 3124
13368 13369
80741 80742
9980 9977
95969 95964
29450 29449
78444 78446
85917 85914
65396 65401
43628 43627
62648 62646...

output:

164082

result:

ok single line: '164082'

Test #237:

score: 43
Accepted
time: 233ms
memory: 87408kb

input:

99995 299984
38207 38212
35113 35112
6275 6274
4842 4840
10288 10287
89243 89237
12592 12590
84165 84167
84517 84515
15369 15371
96815 96816
96671 96672
76942 76940
15499 15502
8310 8313
30510 30513
45592 45594
13366 13368
80130 80129
6220 6223
48688 48692
57497 57493
48484 48483
4531 4534
92578 925...

output:

164067

result:

ok single line: '164067'

Test #238:

score: 43
Accepted
time: 259ms
memory: 86948kb

input:

99995 299984
54254 54256
39211 39209
2733 2732
65825 65828
81815 81811
2770 2767
48246 48250
17693 17695
59632 59633
99037 99040
98571 98573
86972 86974
97809 97810
6558 6559
24344 24341
51479 51478
44053 44052
99846 99847
75298 75296
94856 94852
86066 86068
9722 9723
13548 13552
99108 99110
67191 6...

output:

164135

result:

ok single line: '164135'

Test #239:

score: 43
Accepted
time: 234ms
memory: 85508kb

input:

99995 299984
66071 66069
31220 31214
27346 27344
43747 43746
18016 18012
72308 72310
44520 44515
64302 64299
22530 22532
66902 66900
52342 52344
12342 12343
10732 10733
64890 64884
26678 26677
56658 56656
58379 58377
80781 80782
16254 16248
34847 34849
18867 18866
56600 56601
5400 5403
28538 28536
7...

output:

164125

result:

ok single line: '164125'

Test #240:

score: 43
Accepted
time: 229ms
memory: 87064kb

input:

99995 299984
8112 8111
32922 32928
96977 96974
14874 14870
26888 26890
88703 88701
6571 6573
53021 53022
52102 52107
95718 95713
22442 22437
86288 86287
82900 82901
26166 26160
86454 86453
85898 85902
19424 19421
97782 97781
49595 49591
62425 62423
63967 63970
65227 65228
13637 13642
51955 51954
357...

output:

163969

result:

ok single line: '163969'

Test #241:

score: 43
Accepted
time: 239ms
memory: 87808kb

input:

99995 299984
47015 47018
55372 55375
15981 15977
99031 99032
44862 44860
60285 60289
28679 28676
1482 1481
41625 41624
81950 81951
30160 30161
11839 11840
98233 98238
65226 65227
98147 98143
8913 8917
6494 6493
44680 44676
63962 63960
31409 31410
93842 93843
3966 3967
8648 8649
80167 80169
93275 932...

output:

164101

result:

ok single line: '164101'

Test #242:

score: 43
Accepted
time: 239ms
memory: 87020kb

input:

99995 299984
9355 9357
61498 61497
40915 40909
96011 96010
42091 42086
99324 99329
21692 21693
79138 79140
19078 19076
77947 77948
43730 43731
13469 13473
15446 15443
76602 76601
52539 52538
74733 74734
24389 24388
59927 59928
53977 53976
49433 49429
96225 96223
40224 40228
98939 98942
95464 95465
6...

output:

163977

result:

ok single line: '163977'

Test #243:

score: 43
Accepted
time: 231ms
memory: 86544kb

input:

99995 299984
6783 6778
91066 91070
43456 43450
87183 87184
94473 94477
53672 53675
62640 62638
30882 30883
15765 15770
40233 40234
12026 12021
52828 52829
78530 78529
75687 75691
67273 67272
10300 10298
59374 59372
74691 74696
78163 78165
72135 72131
65602 65598
40933 40935
25428 25426
18602 18601
7...

output:

164163

result:

ok single line: '164163'

Test #244:

score: 43
Accepted
time: 254ms
memory: 86256kb

input:

99995 299984
21895 21894
9120 9116
40894 40891
47169 47167
23970 23969
1809 1813
31075 31078
67173 67176
75082 75083
44866 44864
87210 87212
83357 83356
42271 42270
1191 1192
45716 45717
92187 92186
19327 19324
90286 90282
62661 62662
12165 12161
88291 88289
15680 15674
22408 22409
70635 70634
37116...

output:

164090

result:

ok single line: '164090'

Test #245:

score: 43
Accepted
time: 240ms
memory: 87320kb

input:

99995 299984
47430 47429
10465 10461
50288 50287
10168 10171
54497 54501
83744 83747
9219 9217
71128 71133
66296 66293
14930 14927
12122 12121
13907 13905
55668 55669
41143 41140
98876 98881
28395 28399
19335 19340
62562 62564
46957 46960
19171 19169
88281 88282
66077 66078
84069 84068
22096 22094
3...

output:

164031

result:

ok single line: '164031'

Test #246:

score: 43
Accepted
time: 4ms
memory: 27536kb

input:

1000 3000
948 937
125 139
301 263
749 791
366 394
442 482
666 672
26 66
613 661
724 740
319 364
128 87
195 150
5 1
251 246
816 776
359 328
534 539
451 487
147 167
964 926
299 288
27 52
952 933
597 603
875 900
457 432
589 612
751 768
121 124
137 160
549 570
386 401
126 109
888 842
704 711
269 244
176...

output:

10

result:

ok single line: '10'

Test #247:

score: 43
Accepted
time: 9ms
memory: 29248kb

input:

1000 3000
440 476
41 64
706 763
632 683
751 656
540 472
799 758
675 594
46 48
476 532
182 169
546 447
442 504
11 50
207 114
965 935
507 578
407 397
715 680
715 814
861 925
742 687
704 617
923 892
372 443
644 742
243 181
231 135
944 951
484 499
460 473
142 164
14 98
951 871
625 628
974 885
570 639
83...

output:

56

result:

ok single line: '56'

Test #248:

score: 43
Accepted
time: 8ms
memory: 31168kb

input:

1000 3000
999 311
83 605
442 437
554 561
61 710
229 253
278 262
879 617
560 516
297 324
278 325
905 862
973 546
532 287
744 201
622 61
305 953
520 551
539 224
577 572
29 73
669 952
421 449
525 571
343 690
201 466
575 549
122 390
992 225
708 670
928 73
377 53
38 36
232 245
221 978
210 729
889 517
794...

output:

34

result:

ok single line: '34'

Test #249:

score: 43
Accepted
time: 3ms
memory: 30040kb

input:

1000 3000
47 804
668 693
400 496
466 683
726 644
493 290
665 101
633 654
410 401
659 722
637 241
971 371
874 854
680 267
633 223
726 908
476 528
897 865
185 358
805 785
170 89
127 1
176 181
576 969
298 31
967 782
864 820
797 721
60 192
260 57
49 135
285 757
647 804
615 831
5 13
413 425
970 874
817 8...

output:

58

result:

ok single line: '58'

Test #250:

score: 43
Accepted
time: 0ms
memory: 29892kb

input:

1000 3000
414 980
728 876
312 574
96 191
414 54
75 526
326 161
434 601
376 198
122 551
823 46
430 631
286 339
646 414
845 853
191 376
9 251
289 256
534 743
806 743
763 434
7 251
434 288
882 664
775 309
110 224
221 296
198 557
244 728
122 922
191 230
16 9
815 799
198 450
973 238
312 476
66 54
7 12
71...

output:

257

result:

ok single line: '257'

Test #251:

score: 43
Accepted
time: 3ms
memory: 29152kb

input:

1000 3000
262 55
486 153
166 976
592 276
112 858
19 75
2 1
707 828
858 919
547 75
932 731
758 625
731 722
153 160
345 525
771 809
59 518
153 28
648 231
771 155
457 345
779 656
558 71
763 771
153 270
564 259
725 771
348 308
253 680
955 189
675 758
758 520
771 451
327 558
153 175
253 216
417 345
731 6...

output:

276

result:

ok single line: '276'

Test #252:

score: 43
Accepted
time: 349ms
memory: 72656kb

input:

1000 300000
715 978
726 173
770 738
515 225
892 203
314 709
659 427
287 341
774 254
847 89
430 532
820 831
651 215
761 315
77 373
521 853
65 513
283 502
353 253
223 309
169 88
776 51
646 731
302 965
119 900
355 794
435 455
659 491
880 578
860 683
478 61
940 820
361 28
583 979
81 953
637 386
189 711
...

output:

0

result:

ok single line: '0'

Test #253:

score: 43
Accepted
time: 345ms
memory: 73992kb

input:

1000 300000
130 262
142 375
598 647
135 628
363 482
749 300
166 177
611 701
3 267
224 910
431 446
328 827
119 80
671 142
49 180
4 820
708 738
987 76
455 884
739 277
236 611
303 396
494 622
460 126
421 972
279 670
70 460
919 453
117 529
481 156
55 58
168 971
957 595
346 228
942 253
335 662
646 46
948...

output:

0

result:

ok single line: '0'

Test #254:

score: 43
Accepted
time: 353ms
memory: 73112kb

input:

1000 300000
648 320
9 701
951 679
331 985
968 838
11 752
456 111
410 126
565 758
847 516
700 26
146 151
766 520
794 365
499 156
970 528
166 903
151 897
567 244
929 897
286 935
129 454
631 636
690 486
626 712
666 616
78 543
685 818
944 452
891 431
88 234
920 296
674 238
386 612
129 527
816 182
296 36...

output:

0

result:

ok single line: '0'

Test #255:

score: 43
Accepted
time: 328ms
memory: 73696kb

input:

1000 300000
716 294
820 901
462 534
110 217
570 201
468 274
605 256
193 827
172 915
585 481
178 983
220 242
57 472
346 938
171 672
604 326
986 24
153 760
190 967
901 476
390 388
866 682
285 318
33 264
562 723
422 442
895 168
481 106
257 939
680 729
37 844
85 423
672 81
258 732
533 23
999 230
195 934...

output:

0

result:

ok single line: '0'

Test #256:

score: 43
Accepted
time: 467ms
memory: 98768kb

input:

100000 300000
94246 62703
86317 86292
34714 64525
74714 99608
25463 69114
66269 66228
69614 69604
6942 6929
36223 37439
53332 4947
89353 78704
88040 85174
28959 64807
61721 61675
69764 66466
91175 76049
84994 90238
89243 89262
22668 21542
75544 75590
96610 25770
22275 89040
37206 37212
6476 29679
48...

output:

3895

result:

ok single line: '3895'

Test #257:

score: 43
Accepted
time: 478ms
memory: 99020kb

input:

100000 300000
37425 26133
11839 69388
52568 67470
49881 29202
89362 89314
24769 24740
42900 29970
54721 77755
78669 78573
45487 45388
22615 15197
39649 74557
48434 72123
60140 60049
31194 5855
99053 98970
54757 81050
55828 70494
71837 96962
98872 98918
58895 28621
23140 81624
27904 27939
2678 74952
...

output:

3900

result:

ok single line: '3900'

Test #258:

score: 43
Accepted
time: 455ms
memory: 98616kb

input:

100000 300000
56478 56401
31930 37392
17742 17732
26974 41416
4868 26105
69312 69181
80248 63912
63515 15630
364 477
93578 81688
30515 69640
95718 70664
61162 9130
13436 36745
89664 14313
40485 76069
37524 38733
64219 54151
57626 57506
44284 16930
96882 3992
11429 11573
29154 49630
45745 45652
18495...

output:

3984

result:

ok single line: '3984'

Test #259:

score: 43
Accepted
time: 467ms
memory: 98840kb

input:

100000 300000
29812 3856
82844 96336
27070 70413
63408 64524
30157 86372
81668 81826
72959 72857
32037 80555
68489 49919
39573 39581
76931 19231
90404 48156
39182 12177
595 462
30884 99469
69740 5454
31884 28036
11082 11195
64353 64416
85882 49092
84507 49679
2954 18897
92154 92190
62508 26368
7723 ...

output:

4068

result:

ok single line: '4068'

Test #260:

score: 43
Accepted
time: 399ms
memory: 84488kb

input:

100000 300000
24024 55408
17603 26940
1582 71386
83129 68895
67103 3830
88362 66287
29909 38716
38501 98853
26746 22018
97765 49983
73959 34236
98853 760
24314 19562
22932 69082
82627 67513
99217 26746
26746 57747
28704 4084
76602 55408
20335 65658
31958 55463
98853 63419
4206 55408
55408 97047
3870...

output:

44764

result:

ok single line: '44764'

Test #261:

score: 43
Accepted
time: 392ms
memory: 84860kb

input:

100000 300000
53708 63369
50497 88954
26780 58810
42842 1977
62325 68067
34245 42514
17206 46450
70782 62183
34245 27759
44923 77610
58744 52688
60831 25660
25660 36997
76745 94185
41518 58744
50497 15486
76745 4660
77610 10060
15022 15041
62325 57482
40232 76745
1977 42025
2079 97421
77824 95365
76...

output:

45410

result:

ok single line: '45410'

Test #262:

score: 43
Accepted
time: 394ms
memory: 85368kb

input:

100000 300000
89899 54232
89490 73189
94510 22235
96799 35499
20826 89490
69629 44008
44672 23839
17702 95760
54232 93285
7217 95123
3602 8897
21242 61854
19453 23839
40406 39958
67324 54232
38284 91822
52638 54232
10741 57987
1403 56323
35714 23839
54232 38985
49943 89490
23944 92435
37299 54232
14...

output:

44902

result:

ok single line: '44902'

Test #263:

score: 43
Accepted
time: 381ms
memory: 83152kb

input:

100000 300000
11383 19225
44292 96220
28292 55587
32045 5481
62330 50008
28103 55587
79650 28477
17842 35692
8388 53217
79650 13127
14519 36752
14654 48989
30432 35641
79650 94903
66921 77750
56097 48989
77154 96220
17842 39680
9889 83233
96220 91825
348 162
96220 33272
12335 86187
79650 65226
75451...

output:

45641

result:

ok single line: '45641'

Test #264:

score: 43
Accepted
time: 438ms
memory: 84720kb

input:

100000 300000
349 27310
54811 9992
49574 37463
35339 6993
29740 98253
31704 53286
36544 41174
3013 81566
3088 2363
28765 89513
46684 94230
9992 35535
4007 10354
4457 8044
56616 54853
70898 65211
46042 55156
5581 37206
12345 24843
10814 59829
29740 57484
34828 69698
13806 11404
57865 36804
29658 6981...

output:

42237

result:

ok single line: '42237'

Test #265:

score: 43
Accepted
time: 422ms
memory: 83380kb

input:

100000 300000
30989 68759
46148 28239
35026 57756
51054 43490
63931 90121
28592 56906
32526 10349
65860 47031
93336 19295
44037 20535
97347 71162
66422 84472
5622 95866
70062 75250
51302 68076
88519 76527
90840 67925
75890 47622
66127 73640
37545 86984
23760 79420
48114 26071
22113 61710
9514 55922
...

output:

44583

result:

ok single line: '44583'

Test #266:

score: 43
Accepted
time: 439ms
memory: 84136kb

input:

100000 300000
58181 79207
30479 34782
68413 22597
83340 30479
10536 24062
16708 91584
4557 95080
59420 67355
50627 14269
11506 10536
85458 65974
27813 29546
63620 70469
92914 93099
61429 4557
66809 65512
97467 25003
52319 38442
18306 2929
58181 37139
8427 61109
59133 61112
4777 69637
4811 85725
2358...

output:

38903

result:

ok single line: '38903'

Test #267:

score: 43
Accepted
time: 441ms
memory: 85408kb

input:

100000 300000
25067 1960
23129 46751
42488 63461
93749 82163
24484 17118
8820 63781
11991 61122
81113 39985
3243 23854
97520 20851
46746 89952
80804 54493
30522 23108
19836 91256
50473 10407
6247 10645
42263 63792
52854 96908
55998 44945
72520 86907
23108 78574
11021 27325
14200 10640
90641 88841
96...

output:

42298

result:

ok single line: '42298'

Test #268:

score: 43
Accepted
time: 487ms
memory: 88544kb

input:

100000 300000
25994 84334
21567 91118
402 10464
89456 49483
6420 21176
38279 85372
20807 27104
65050 56049
98648 65772
37879 75566
30977 96425
62695 55251
25351 5867
74450 60553
23763 70530
52884 47557
20021 327
12915 17514
15618 92134
76192 34383
1961 17772
1176 63331
35969 37996
27768 8061
56714 8...

output:

38588

result:

ok single line: '38588'

Test #269:

score: 43
Accepted
time: 495ms
memory: 85992kb

input:

100000 300000
22663 44102
5729 5684
11170 10679
45027 81398
16825 18631
18364 17377
14293 2163
4563 23435
5206 59490
62622 64216
92323 76752
17781 40298
47792 39791
803 25600
90789 20953
26036 30687
82594 41109
68150 20684
20428 93799
19595 1385
99163 13275
74708 79508
64082 11217
13893 78809
27313 ...

output:

39994

result:

ok single line: '39994'

Test #270:

score: 43
Accepted
time: 484ms
memory: 86340kb

input:

100000 300000
57841 83277
52914 70036
87047 66963
6502 62550
82558 7685
56263 20442
9727 30070
67747 27133
41068 52634
8760 42040
7397 62905
2003 111
24320 40681
75900 4630
92710 30149
12472 2141
54236 23870
91348 28
49927 42646
5859 4693
20916 8911
51593 13470
33179 82151
95006 95589
48168 5587
278...

output:

43581

result:

ok single line: '43581'

Test #271:

score: 43
Accepted
time: 488ms
memory: 85952kb

input:

100000 300000
35735 54725
55718 12981
1334 13762
14117 27605
16216 22294
70391 71252
66814 67159
69053 77952
49427 37437
41844 34968
18079 35601
13244 20099
52684 97766
90383 42579
5087 33431
66930 47786
95131 2886
66598 27600
73815 246
46905 85066
67199 22151
21981 84343
76979 71361
54059 98992
908...

output:

39346

result:

ok single line: '39346'

Test #272:

score: 43
Accepted
time: 0ms
memory: 27260kb

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 #273:

score: 43
Accepted
time: 0ms
memory: 26868kb

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'

Extra Test:

score: 0
Extra Test Passed