QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#335505#1395. Trzy drogi [A]qwqwf4 912ms159860kbC++144.6kb2024-02-23 15:12:352024-02-23 15:12:35

Judging History

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

  • [2024-02-23 15:12:35]
  • 评测
  • 测评结果:4
  • 用时:912ms
  • 内存:159860kb
  • [2024-02-23 15:12:35]
  • 提交

answer

//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#pragma GCC optimize("Ofast","unroll-loops","inline")
#include<bits/stdc++.h>
#define ll long long
//#define int ll
#define ull unsigned ll
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define MP make_pair
#define umap unordered_map<ull,ll>
#define pq priority_queue<pii>
using namespace std;
const int N=3e5+60,M=5e5+20;
mt19937 rnd(time(0));
int n,m,sm;ll ans;
struct Edge{int u,v,c;}e[M];
int fa[N],Id[N],p[N],dep[N],dfn[N],id[N],up[N],dn[N],dfc;ull w[M],v[M];bool cut[M],on[M],vis[N];
vector<pii> g[N];
pq rt[N],rt2[N];umap mp[N],st;
inline ll S1(int x){return 1ll*x*(x-1)/2;}
inline ll S2(int x){return 1ll*x*(x-1)*(x-2)/6;}
inline int find(int x){return x==fa[x]?fa[x]:fa[x]=find(fa[x]);}
inline ll pw(ll x){return x*x;}
inline void get(umap &u,int x,int y){if(x&&y&&u.count(w[x]^w[y])) ans+=u[w[x]^w[y]]*e[x].c*e[y].c;}
inline void clear(pq &x){while(!x.empty()) x.pop();}
void merge(umap &x,umap &y){
	if(x.size()<y.size()) x.swap(y);
	for(auto z:y) x[z.fi]+=z.se;y.clear();
}
void merge(pq &x,pq &y){
	if(x.size()<y.size()) x.swap(y);
	while(!y.empty()) x.push(y.top()),y.pop();
}
inline void pop(pq &x,int val){while(!x.empty()&&dep[e[x.top().se].v]>=val) x.pop();}
namespace Init{
	inline void add(int u,int v,int id){g[u].pb(MP(v,id)),g[v].pb(MP(u,id));}
	void re(){
		int nn=n,mm=m;n=m=sm=0;
		for(int i=1;i<=nn;i++) fa[i]=i,p[i]=0;
		for(int i=1;i<=mm;i++) if(cut[i]) fa[find(e[i].u)]=find(e[i].v);
		for(int i=1;i<=mm;i++) cut[i]=0;
		for(int i=1;i<=nn;i++) if(i==find(i)) p[i]=++n;
		for(int i=1;i<=mm;i++){
			int u=p[find(e[i].u)],v=p[find(e[i].v)]; 
			if(u!=v) e[++m]=(Edge){u,v,e[i].c},sm+=e[i].c;
		}
	}
	void dfs(int u){
		vis[u]=1;id[dfn[u]=++dfc]=u;
		for(pii x:g[u]) if(!vis[x.fi]) dep[x.fi]=dep[u]+1,Id[x.fi]=x.se,dfs(x.fi),on[x.se]=1;
	}
	void getw(){for(int i=n,u=id[n];i;i--,u=id[i]) for(pii x:g[u]) w[x.se]=v[x.fi],v[u]^=v[x.fi];}
	void init(){
		for(int i=1;i<=n;i++) v[i]=dfn[i]=id[i]=dep[i]=vis[i]=0,g[i].clear(); 
		for(int i=1;i<=m;i++) w[i]=on[i]=0;dfc=0;
		for(int i=1;i<=m;i++) add(e[i].u,e[i].v,i);
		dfs(1);
		for(int i=1;i<=n;i++) g[i].clear();
		for(int i=1;i<=m;i++){
			if(on[i]){
				if(dep[e[i].u]+1==dep[e[i].v]) g[e[i].u].pb(MP(e[i].v,i));
				else g[e[i].v].pb(MP(e[i].u,i));
			}
			else w[i]=rnd(),v[e[i].u]^=w[i],v[e[i].v]^=w[i];//u -1,v +1
		}
		getw();
	}
}
struct data{
	ll a[3];
	data(){}
	data(ll x,ll y,ll z){a[0]=x,a[1]=y,a[2]=z;}
}s[N];
inline data operator +(data x,data y){x.a[0]+=y.a[0];x.a[1]+=y.a[1];x.a[2]+=y.a[2];return x;}
inline data operator +(data x,int y){x.a[0]+=1;x.a[1]+=y;x.a[2]+=1ll*y*y;return x;}
inline data operator -(data x,int y){x.a[0]-=1;x.a[1]-=y;x.a[2]-=1ll*y*y;return x;}
void sv(){
	Init::init();umap t;
	for(int i=1;i<=m;i++) if(!w[i]) --sm,ans+=S1(sm),cut[i]=1;else t[w[i]]++;
	for(int i=1;i<=m;i++){
		if(!t.count(w[i])) cut[i]=1;
		else e[i].c=t[w[i]],ans+=S1(e[i].c)*(sm-e[i].c)+S2(e[i].c),t.erase(w[i]);
	}
	Init::re();
}
void dfs1(int u){
	for(pii x:g[u]) dfs1(x.fi),s[u]=s[u]+s[x.fi];
	if(s[u].a[0]==2) ans+=e[Id[u]].c*(pw(s[u].a[1])-s[u].a[2])/2;
}
void dfs2(int u){
	for(pii x:g[u]) dfs2(x.fi),merge(rt[u],rt[x.fi]);
	pop(rt[u],dep[u]);
	if(!rt[u].empty()) up[u]=rt[u].top().se;
}
void dfs3(int u){
	get(st,Id[u],up[u]);
	if(Id[u]) st[w[Id[u]]]+=e[Id[u]].c;
	for(pii x:g[u]) dfs3(x.fi);
	if(Id[u]) st[w[Id[u]]]-=e[Id[u]].c;
}
void dfs4(int u){
	for(pii x:g[u]) dfs4(x.fi),merge(rt[u],rt[x.fi]),merge(rt2[u],rt2[x.fi]),merge(mp[u],mp[x.fi]);
	pop(rt[u],dep[u]),pop(rt2[u],dep[u]);
	if(Id[u]){
		if(!rt[u].empty()) get(mp[u],Id[u],rt[u].top().se);
		if(!rt2[u].empty()) get(mp[u],Id[u],rt2[u].top().se);
		mp[u][w[Id[u]]]+=e[Id[u]].c;
	}
}
signed main(){
	ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
	cin>>n>>m;sm=m;
	for(int i=1;i<=n;i++) fa[i]=i;
	for(int i=1;i<=m;i++) cin>>e[i].u>>e[i].v,e[i].c=1;
	sv();
	while(n>1){
		Init::init();
		for(int i=1;i<=n;i++) s[i].a[0]=s[i].a[1]=s[i].a[2]=0; 
		for(int i=1;i<=m;i++) if(dep[e[i].u]<dep[e[i].v]) swap(e[i].u,e[i].v);
		for(int i=1;i<=m;i++) if(!on[i]) s[e[i].u]=s[e[i].u]+e[i].c,s[e[i].v]=s[e[i].v]-e[i].c;
		dfs1(1);
		for(int i=1;i<=n;i++) clear(rt[i]);st.clear();
		for(int i=1;i<=m;i++) if(!on[i]) rt[e[i].u].push(MP(dep[e[i].v],i));
		dfs2(1),dfs3(1);
		for(int i=1;i<=n;i++) clear(rt[i]),clear(rt2[i]),mp[i].clear();
		for(int i=1;i<=m;i++) if(!on[i]) rt[e[i].u].push(MP(dfn[e[i].u],i)),rt2[e[i].u].push(MP(-dfn[e[i].u],i));
		dfs4(1);
		for(int i=1;i<=m;i++) if(!on[i]) cut[i]=1;
		Init::re(); 
	}
	cout<<ans<<'\n';
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 1
Accepted

Test #2:

score: 1
Accepted
time: 4ms
memory: 61028kb

input:

2 3
1 2
1 2
2 1

output:

1

result:

ok single line: '1'

Test #3:

score: 0
Accepted
time: 7ms
memory: 63172kb

input:

2 4
2 1
2 1
1 2
1 2

output:

0

result:

ok single line: '0'

Test #4:

score: 0
Accepted
time: 9ms
memory: 63108kb

input:

5 11
4 5
5 1
2 1
4 1
4 2
1 3
2 4
3 2
1 4
4 1
3 4

output:

10

result:

ok single line: '10'

Test #5:

score: 0
Accepted
time: 3ms
memory: 63140kb

input:

10 20
10 9
6 9
1 5
1 3
7 6
7 5
3 7
6 2
1 2
6 1
6 5
1 2
8 1
9 2
9 6
1 4
4 3
8 5
1 10
4 5

output:

39

result:

ok single line: '39'

Test #6:

score: 0
Accepted
time: 4ms
memory: 63148kb

input:

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

output:

1108

result:

ok single line: '1108'

Test #7:

score: 0
Accepted
time: 7ms
memory: 54984kb

input:

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

output:

118

result:

ok single line: '118'

Test #8:

score: 0
Accepted
time: 3ms
memory: 63152kb

input:

40 120
5 35
3 31
1 22
19 7
40 27
32 26
15 18
14 24
12 6
39 1
19 8
30 19
9 27
38 12
21 23
19 32
8 15
4 11
13 39
11 6
32 37
16 20
2 5
32 40
31 35
23 6
7 29
8 28
5 11
20 29
32 15
16 8
19 9
23 19
35 1
13 39
34 9
12 31
15 8
34 28
36 9
29 20
36 39
6 13
18 20
23 2
25 9
33 3
20 4
26 20
6 9
1 6
24 9
39 35
11...

output:

14044

result:

ok single line: '14044'

Test #9:

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

input:

40 116
19 14
31 27
14 40
18 36
8 17
24 13
19 15
32 9
24 10
5 39
22 11
5 29
25 28
34 30
38 8
14 32
1 13
31 14
32 26
6 40
40 13
37 19
27 9
4 13
28 22
10 36
40 18
26 22
21 1
35 23
1 21
38 3
36 15
9 5
21 40
23 24
21 10
16 7
4 26
23 36
21 18
20 14
23 39
28 29
22 5
37 23
21 36
7 37
40 14
3 39
6 38
17 23
1...

output:

120

result:

ok single line: '120'

Test #10:

score: 0
Accepted
time: 3ms
memory: 61100kb

input:

40 102
38 23
25 33
21 9
26 40
13 18
40 13
13 5
2 23
13 26
8 1
21 32
11 25
28 14
15 18
5 24
34 39
27 17
31 8
4 36
14 27
13 36
24 23
18 30
29 20
4 19
11 37
40 11
34 7
24 18
40 31
16 27
6 33
11 7
24 10
28 39
36 40
4 28
33 9
12 31
4 3
11 21
24 11
23 9
17 29
37 7
10 4
6 16
20 6
23 27
19 4
9 13
1 38
2 37
...

output:

5548

result:

ok single line: '5548'

Test #11:

score: 0
Accepted
time: 7ms
memory: 63192kb

input:

40 120
34 28
9 16
36 12
23 24
9 16
20 12
15 36
15 37
2 10
4 3
18 8
7 5
9 31
37 28
4 9
20 38
28 15
17 32
6 18
1 18
9 4
13 27
8 22
30 22
38 12
19 23
5 33
1 39
11 38
34 37
3 7
10 37
2 28
11 20
32 14
35 38
13 30
2 15
30 8
19 34
11 1
35 11
31 16
14 17
18 6
31 25
32 17
34 10
36 2
29 36
28 29
38 39
1 35
17...

output:

14044

result:

ok single line: '14044'

Test #12:

score: 0
Accepted
time: 7ms
memory: 63148kb

input:

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

output:

125

result:

ok single line: '125'

Test #13:

score: 0
Accepted
time: 9ms
memory: 63144kb

input:

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

output:

58

result:

ok single line: '58'

Test #14:

score: 0
Accepted
time: 3ms
memory: 61068kb

input:

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

output:

58

result:

ok single line: '58'

Test #15:

score: 0
Accepted
time: 7ms
memory: 61332kb

input:

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

output:

58

result:

ok single line: '58'

Test #16:

score: 0
Accepted
time: 7ms
memory: 59016kb

input:

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

output:

401

result:

ok single line: '401'

Test #17:

score: 0
Accepted
time: 9ms
memory: 59292kb

input:

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

output:

279

result:

ok single line: '279'

Test #18:

score: 0
Accepted
time: 7ms
memory: 61108kb

input:

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

output:

464

result:

ok single line: '464'

Test #19:

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

input:

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

output:

58

result:

ok single line: '58'

Test #20:

score: 0
Accepted
time: 3ms
memory: 61180kb

input:

40 120
1 30
7 1
2 5
7 1
33 18
33 25
15 3
5 39
17 34
39 5
1 40
5 31
38 16
35 37
24 25
1 35
5 2
1 20
20 22
7 1
40 1
3 6
35 1
9 38
38 9
25 24
34 17
33 36
32 28
37 21
7 11
11 38
33 18
12 17
33 19
7 6
29 15
7 26
28 32
9 28
2 5
12 17
20 12
7 26
5 2
24 25
38 16
13 23
20 1
12 14
25 33
2 27
20 12
34 17
22 20...

output:

15327

result:

ok single line: '15327'

Test #21:

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

input:

40 120
7 3
22 19
38 10
29 33
11 34
23 38
39 5
25 39
21 11
15 35
15 35
23 27
16 28
12 7
26 36
40 36
2 1
16 38
30 12
27 23
16 28
38 16
39 25
35 5
11 21
19 22
19 32
3 7
5 39
32 11
36 38
35 15
28 16
7 35
36 26
13 19
35 5
32 11
19 22
31 12
40 36
29 36
27 23
12 31
32 11
7 3
10 38
24 8
23 27
11 29
16 38
15...

output:

53591

result:

ok single line: '53591'

Test #22:

score: 0
Accepted
time: 3ms
memory: 59020kb

input:

40 120
2 9
28 11
23 31
30 34
8 30
25 4
30 27
34 30
27 30
20 33
2 9
37 10
37 10
40 24
13 28
16 7
9 18
32 2
9 18
17 16
16 11
13 28
15 40
11 35
3 9
27 11
22 3
27 30
23 14
34 30
9 1
11 16
11 27
17 20
30 27
10 9
20 9
16 40
18 9
13 28
1 9
30 38
20 17
38 30
12 9
22 3
9 3
23 31
40 24
20 33
30 26
30 27
30 34...

output:

47710

result:

ok single line: '47710'

Test #23:

score: 0
Accepted
time: 3ms
memory: 61148kb

input:

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

output:

173

result:

ok single line: '173'

Test #24:

score: 0
Accepted
time: 8ms
memory: 59048kb

input:

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

output:

165

result:

ok single line: '165'

Test #25:

score: 0
Accepted
time: 11ms
memory: 61184kb

input:

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

output:

3958

result:

ok single line: '3958'

Test #26:

score: 0
Accepted
time: 8ms
memory: 59048kb

input:

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

output:

9139

result:

ok single line: '9139'

Subtask #2:

score: 1
Accepted

Test #27:

score: 1
Accepted
time: 7ms
memory: 61188kb

input:

196 599
86 111
68 176
32 111
105 146
183 179
193 48
3 101
61 173
16 134
147 123
129 168
113 34
98 90
103 91
140 93
89 38
137 110
39 62
165 119
54 22
65 70
91 49
135 48
20 167
108 62
169 71
188 8
191 132
63 108
56 194
40 133
171 61
40 79
134 12
165 151
62 141
9 84
170 2
174 72
52 47
58 9
30 138
68 53...

output:

362371

result:

ok single line: '362371'

Test #28:

score: 0
Accepted
time: 9ms
memory: 59392kb

input:

197 599
106 89
188 100
82 104
104 36
175 109
159 106
55 188
13 86
74 80
10 77
16 154
128 159
28 165
83 91
112 187
143 103
87 195
156 129
11 59
164 53
86 82
66 58
54 180
142 151
177 37
121 57
41 64
52 185
164 57
190 146
166 178
53 90
80 166
132 21
14 143
77 195
161 122
162 31
172 55
182 142
101 119
4...

output:

535518

result:

ok single line: '535518'

Test #29:

score: 0
Accepted
time: 7ms
memory: 61252kb

input:

200 598
188 148
39 175
71 128
16 48
100 182
160 76
197 140
134 106
50 138
164 55
149 91
103 34
20 159
149 21
175 37
105 141
120 150
102 3
101 66
9 132
24 20
119 67
104 99
51 125
68 69
73 108
191 58
80 151
10 4
23 14
2 112
36 9
102 189
123 17
4 82
55 35
45 154
191 87
193 180
190 145
50 76
172 23
24 8...

output:

2405

result:

ok single line: '2405'

Test #30:

score: 0
Accepted
time: 9ms
memory: 59140kb

input:

200 600
132 43
177 122
21 63
118 161
107 81
96 148
170 196
162 183
13 147
131 5
15 155
199 58
48 97
57 132
115 188
169 195
95 113
130 187
42 145
130 13
98 162
81 150
9 151
119 107
27 135
90 103
156 24
157 13
189 48
183 106
160 157
6 180
114 189
195 70
139 111
142 18
114 139
156 39
77 14
118 39
73 17...

output:

184487

result:

ok single line: '184487'

Test #31:

score: 0
Accepted
time: 7ms
memory: 59148kb

input:

200 600
184 166
26 196
62 6
139 121
189 37
13 25
28 141
45 90
116 163
149 49
104 200
29 196
116 120
17 115
120 137
124 35
112 182
26 142
26 142
123 67
143 189
165 35
92 44
89 105
133 14
9 158
182 154
41 136
165 35
186 31
42 65
4 36
104 11
83 82
118 112
18 160
72 40
120 165
152 134
192 140
189 37
195...

output:

546865

result:

ok single line: '546865'

Test #32:

score: 0
Accepted
time: 9ms
memory: 61116kb

input:

200 600
82 22
156 78
136 193
63 136
152 154
109 48
79 127
87 77
142 100
137 163
73 24
75 150
178 52
124 47
160 104
47 176
198 156
9 26
16 138
11 39
28 102
170 56
72 144
25 85
158 18
117 80
3 115
33 175
10 110
35 90
161 164
165 55
71 191
160 87
70 150
31 113
158 181
192 96
35 80
138 16
75 150
97 96
1...

output:

8455

result:

ok single line: '8455'

Test #33:

score: 0
Accepted
time: 3ms
memory: 61388kb

input:

200 300
21 137
147 99
110 159
136 77
77 95
29 97
163 13
59 178
175 16
109 27
4 158
37 79
58 41
9 40
143 51
182 131
154 185
193 188
31 6
176 166
127 196
180 169
184 139
59 84
37 80
21 144
48 39
45 18
81 139
31 164
191 62
145 152
194 168
8 63
125 115
179 109
175 44
99 162
38 83
180 125
109 119
98 174
...

output:

298

result:

ok single line: '298'

Test #34:

score: 0
Accepted
time: 7ms
memory: 63208kb

input:

200 300
157 130
22 189
160 143
89 9
172 119
68 197
66 32
40 173
10 35
70 90
154 143
86 158
174 42
17 186
181 45
49 42
54 114
61 153
65 179
150 13
41 154
73 106
54 92
165 187
46 190
41 56
164 29
71 157
78 123
176 75
122 32
59 178
178 116
96 177
176 22
11 194
2 87
135 80
189 3
57 60
16 130
192 136
105...

output:

298

result:

ok single line: '298'

Test #35:

score: 0
Accepted
time: 10ms
memory: 63136kb

input:

200 300
173 87
53 175
138 8
82 171
168 170
77 36
31 143
80 165
190 189
121 114
191 132
20 124
75 183
69 1
18 67
35 162
62 155
163 47
108 23
26 40
157 173
173 79
134 66
177 40
94 142
116 34
86 76
54 41
49 158
172 31
23 187
83 54
120 62
88 107
182 174
42 102
11 71
110 25
154 186
162 58
139 88
139 193
...

output:

298

result:

ok single line: '298'

Test #36:

score: 0
Accepted
time: 9ms
memory: 61148kb

input:

199 297
155 128
88 116
106 7
7 78
35 6
179 25
198 41
144 85
74 118
24 91
62 163
106 56
112 132
90 27
58 3
132 90
40 62
155 112
111 151
173 72
26 121
68 12
10 93
104 19
107 43
143 107
68 186
26 152
53 179
1 185
159 184
95 60
115 157
71 152
14 160
62 130
181 190
187 108
120 82
58 50
42 183
18 5
170 84...

output:

2700

result:

ok single line: '2700'

Test #37:

score: 0
Accepted
time: 7ms
memory: 61144kb

input:

199 297
102 43
2 149
100 161
30 148
54 45
138 143
111 94
110 43
132 63
51 113
2 131
109 166
41 179
108 66
67 69
82 91
196 119
42 61
74 43
2 68
129 48
72 152
159 177
89 71
159 154
76 30
181 10
188 155
37 47
22 198
87 183
8 52
14 133
1 36
19 103
106 15
196 98
129 26
56 92
150 96
36 123
44 101
138 127
...

output:

1775

result:

ok single line: '1775'

Test #38:

score: 0
Accepted
time: 7ms
memory: 63464kb

input:

199 297
79 177
80 141
175 129
166 183
50 78
35 177
155 35
49 118
95 92
172 32
161 27
188 68
132 195
18 2
19 193
151 124
182 159
145 197
54 64
29 139
134 13
72 7
159 81
15 136
183 142
23 60
171 109
107 33
119 59
8 76
65 11
70 71
192 6
42 11
120 112
164 140
127 93
31 68
146 133
23 66
29 100
118 135
36...

output:

2084

result:

ok single line: '2084'

Test #39:

score: 0
Accepted
time: 10ms
memory: 59056kb

input:

200 300
112 187
6 84
50 72
77 86
53 172
197 145
30 195
156 83
5 24
171 156
60 19
116 96
188 104
21 83
144 185
27 172
124 138
132 180
4 42
31 39
8 133
108 183
54 144
134 191
27 60
199 139
142 182
61 180
101 109
76 49
154 59
127 121
173 65
143 160
6 45
190 135
122 195
29 163
129 93
76 28
170 153
167 1...

output:

298

result:

ok single line: '298'

Test #40:

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

input:

200 332
7 158
140 47
62 175
173 22
199 62
179 169
100 5
69 34
174 60
4 56
12 140
150 123
76 67
133 129
34 108
119 139
98 110
6 174
1 99
65 70
23 43
15 131
140 121
93 5
101 133
172 197
199 169
191 19
89 18
168 166
38 64
72 73
194 48
50 154
150 186
39 176
114 133
32 194
199 169
19 77
97 189
123 63
175...

output:

2252697

result:

ok single line: '2252697'

Test #41:

score: 0
Accepted
time: 7ms
memory: 59108kb

input:

200 459
55 172
184 187
10 179
142 23
155 119
38 17
184 108
188 167
155 137
174 112
64 138
187 90
26 12
8 161
153 83
38 61
3 17
17 30
183 108
159 58
191 186
98 111
67 168
33 120
39 178
110 168
126 107
189 22
170 185
72 97
186 198
172 110
118 129
152 34
33 179
55 47
143 157
78 121
44 170
104 85
120 33...

output:

3054618

result:

ok single line: '3054618'

Test #42:

score: 0
Accepted
time: 4ms
memory: 61240kb

input:

200 559
88 140
56 21
52 5
5 2
83 182
77 58
95 27
98 197
181 88
155 145
67 75
195 27
121 175
91 137
175 92
8 88
115 34
191 8
113 154
128 174
198 115
81 18
38 183
54 157
95 12
198 41
51 37
99 116
164 162
80 129
31 142
18 81
11 124
181 134
104 20
116 45
65 81
120 32
58 4
97 57
74 54
71 166
174 98
57 8
...

output:

2883685

result:

ok single line: '2883685'

Test #43:

score: 0
Accepted
time: 4ms
memory: 63204kb

input:

200 600
196 118
93 146
130 152
76 140
200 58
95 170
175 172
148 188
42 8
30 197
99 30
37 190
120 94
154 23
76 88
41 197
82 58
195 144
63 38
177 105
180 157
6 158
173 159
17 64
163 25
58 82
127 102
196 28
178 155
82 58
191 63
197 41
63 96
109 69
5 21
149 132
58 82
110 47
157 180
197 68
159 173
170 11...

output:

4986139

result:

ok single line: '4986139'

Test #44:

score: 0
Accepted
time: 3ms
memory: 65424kb

input:

200 600
177 123
170 12
134 125
57 40
82 94
25 45
134 107
70 33
26 104
77 83
38 50
100 7
71 174
46 60
131 180
32 123
45 130
79 186
170 103
11 85
10 35
25 2
133 55
69 144
171 131
149 20
67 157
56 58
3 110
161 138
46 199
130 42
24 158
183 132
77 83
154 180
127 176
106 38
62 85
11 85
136 155
136 155
172...

output:

4162448

result:

ok single line: '4162448'

Test #45:

score: 0
Accepted
time: 7ms
memory: 65200kb

input:

195 600
27 178
146 66
86 41
112 51
110 82
122 154
12 169
137 122
170 87
82 110
160 172
186 190
153 71
137 122
21 134
110 82
156 139
131 129
83 89
30 72
88 6
129 14
71 142
73 125
191 16
33 142
23 189
105 177
46 134
148 165
8 128
146 110
172 135
53 182
12 52
101 8
138 15
31 55
3 94
185 137
134 21
45 1...

output:

3669804

result:

ok single line: '3669804'

Test #46:

score: 0
Accepted
time: 6ms
memory: 55004kb

input:

200 299
15 172
45 9
145 109
137 192
127 170
47 22
24 125
6 112
116 91
186 129
24 113
79 84
141 154
92 83
200 122
115 150
56 195
149 130
40 37
198 114
74 177
89 148
78 130
151 191
118 108
9 177
88 142
120 36
76 25
173 8
63 51
159 91
189 7
128 39
133 151
115 5
19 99
83 146
58 64
89 145
193 182
8 30
13...

output:

893

result:

ok single line: '893'

Test #47:

score: 0
Accepted
time: 4ms
memory: 63208kb

input:

200 299
1 161
26 134
179 31
111 128
171 131
80 184
137 86
117 53
157 198
60 98
130 142
196 166
76 20
89 100
69 57
37 103
28 57
114 176
22 124
52 192
129 23
157 151
5 161
123 118
180 63
70 172
152 169
131 94
169 167
19 147
31 79
200 62
143 194
49 158
68 162
79 22
188 37
39 78
197 9
3 183
21 191
188 1...

output:

825

result:

ok single line: '825'

Test #48:

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

input:

200 329
44 9
166 34
96 107
97 58
17 106
153 27
65 188
192 35
138 53
76 133
198 86
121 34
175 52
85 50
12 115
62 133
11 66
139 32
108 64
67 29
176 29
42 99
124 179
122 156
127 67
116 196
28 180
69 155
191 163
64 170
32 184
140 129
168 123
57 48
58 31
164 77
5 160
111 28
135 111
31 66
158 109
141 153
...

output:

116253

result:

ok single line: '116253'

Test #49:

score: 0
Accepted
time: 3ms
memory: 61096kb

input:

200 329
79 144
17 144
184 179
130 71
168 119
56 118
194 149
31 123
46 96
118 143
7 64
20 164
1 40
107 180
87 84
184 159
143 106
38 113
105 62
85 124
12 135
18 30
150 109
181 97
116 50
4 16
173 137
112 114
79 99
172 49
128 46
179 159
198 111
196 50
161 175
167 47
105 74
47 177
125 96
82 14
72 80
86 2...

output:

111697

result:

ok single line: '111697'

Test #50:

score: 0
Accepted
time: 4ms
memory: 63136kb

input:

200 200
31 195
32 96
112 86
30 16
15 85
82 16
58 65
59 2
100 147
62 179
105 15
26 110
153 186
124 181
85 49
108 157
120 140
36 101
37 8
38 66
20 53
117 68
51 200
190 69
132 21
84 70
177 91
195 33
41 50
168 49
160 177
56 176
178 31
152 161
98 44
90 156
80 192
138 183
56 60
125 154
103 25
3 180
132 52...

output:

1313400

result:

ok single line: '1313400'

Test #51:

score: 0
Accepted
time: 3ms
memory: 63392kb

input:

180 270
10 58
154 177
78 3
171 65
109 95
92 28
14 180
48 141
65 132
20 121
87 144
143 73
180 130
124 28
77 155
23 137
150 179
172 132
114 44
40 177
10 117
90 69
37 63
20 36
180 122
93 16
148 76
79 74
178 20
158 24
65 125
144 87
140 90
54 164
68 11
21 81
133 112
26 9
111 6
85 139
28 151
6 138
136 135...

output:

1477453

result:

ok single line: '1477453'

Test #52:

score: 0
Accepted
time: 4ms
memory: 61108kb

input:

180 255
88 118
171 142
63 40
112 104
166 131
124 53
154 88
1 94
154 88
178 106
93 66
20 79
78 81
130 69
118 162
170 131
33 138
70 86
91 138
29 127
4 135
164 27
44 136
42 151
127 66
93 127
48 72
22 35
92 54
13 68
126 174
31 6
2 139
3 128
175 108
99 158
80 85
137 115
105 120
97 44
132 34
56 144
148 65...

output:

1192973

result:

ok single line: '1192973'

Subtask #3:

score: 1
Accepted

Test #53:

score: 1
Accepted
time: 4ms
memory: 65700kb

input:

998 3000
233 962
435 623
229 654
54 639
799 29
958 154
144 444
23 464
451 699
835 85
272 722
20 226
547 206
616 795
252 964
18 14
447 392
316 681
16 526
359 2
428 382
549 498
78 930
811 610
663 871
16 848
330 202
875 644
334 949
36 698
849 763
654 619
873 259
630 517
410 740
133 600
636 191
997 87
8...

output:

58333417

result:

ok single line: '58333417'

Test #54:

score: 0
Accepted
time: 3ms
memory: 63604kb

input:

1000 2999
490 439
536 98
400 332
307 197
330 658
429 868
659 684
140 608
80 923
440 675
663 533
712 526
703 725
87 714
936 458
143 841
895 76
220 977
129 771
226 707
638 117
412 926
565 487
16 133
269 941
800 826
606 319
773 644
127 961
507 741
817 135
250 155
504 343
142 785
433 576
753 396
860 133...

output:

31477399

result:

ok single line: '31477399'

Test #55:

score: 0
Accepted
time: 6ms
memory: 61580kb

input:

997 3000
596 509
994 252
580 39
587 41
247 313
622 805
717 470
349 774
836 598
100 129
432 696
890 434
830 971
977 492
1 664
86 712
368 959
818 43
324 328
213 760
844 428
882 463
570 26
370 228
585 114
83 269
95 984
661 887
804 607
578 128
722 114
530 73
272 800
238 76
562 586
395 881
857 204
205 47...

output:

27038858

result:

ok single line: '27038858'

Test #56:

score: 0
Accepted
time: 7ms
memory: 63516kb

input:

1000 2999
511 742
48 250
874 756
501 907
870 748
343 116
265 661
351 736
658 802
996 6
447 425
334 992
136 751
487 109
196 254
803 136
388 98
963 78
957 23
939 675
874 105
154 60
580 796
15 594
209 521
853 246
405 651
618 583
611 646
722 758
373 765
404 407
859 719
65 944
437 262
508 219
723 120
981...

output:

31489381

result:

ok single line: '31489381'

Test #57:

score: 0
Accepted
time: 4ms
memory: 63772kb

input:

1000 3000
349 449
637 915
495 765
837 122
515 220
701 52
106 858
64 87
37 157
727 204
705 460
122 43
204 567
961 12
81 171
623 279
339 284
475 639
603 226
431 363
302 269
563 270
981 731
915 79
386 799
831 140
479 614
802 464
769 720
676 286
994 524
330 680
762 229
925 721
231 123
100 229
671 233
32...

output:

31552291

result:

ok single line: '31552291'

Test #58:

score: 0
Accepted
time: 16ms
memory: 61508kb

input:

1000 2998
398 993
344 561
412 41
207 621
62 943
701 451
672 225
91 818
743 336
732 425
42 860
852 231
610 652
381 623
991 230
325 884
170 963
152 229
524 428
704 743
680 968
434 756
56 828
474 974
827 877
396 913
510 558
62 554
164 968
475 183
469 626
154 183
508 946
242 240
623 160
60 41
844 348
49...

output:

177049

result:

ok single line: '177049'

Test #59:

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

input:

1000 1500
726 523
149 216
790 197
794 185
962 838
237 139
529 8
212 318
715 322
918 881
256 626
144 11
107 688
501 152
945 925
91 804
366 835
901 663
595 613
425 701
798 611
423 770
25 669
395 66
931 808
406 345
282 65
482 104
443 910
379 449
850 973
89 601
521 470
665 22
364 84
873 605
910 167
870 ...

output:

1498

result:

ok single line: '1498'

Test #60:

score: 0
Accepted
time: 10ms
memory: 63416kb

input:

1000 1500
701 20
613 695
760 842
5 784
1 8
655 510
115 386
903 334
321 731
431 400
755 504
590 983
74 478
211 556
941 538
785 671
21 489
364 365
579 803
893 883
594 105
801 64
411 194
887 673
326 775
982 581
995 286
37 97
866 256
666 244
250 320
243 648
233 433
587 864
230 561
225 599
829 160
87 949...

output:

1498

result:

ok single line: '1498'

Test #61:

score: 0
Accepted
time: 7ms
memory: 61384kb

input:

1000 1500
287 339
632 966
179 246
506 443
374 228
204 337
858 736
907 372
136 244
391 302
748 738
528 358
633 924
393 25
397 559
998 163
657 600
513 472
873 757
613 692
739 171
264 292
561 252
6 47
147 572
564 732
152 283
539 285
262 490
446 229
19 341
929 383
889 622
100 83
809 350
832 458
909 274
...

output:

1498

result:

ok single line: '1498'

Test #62:

score: 0
Accepted
time: 14ms
memory: 63364kb

input:

999 1497
390 274
583 520
969 429
817 556
532 583
212 437
420 809
22 11
976 685
471 553
890 984
549 539
332 606
345 977
207 98
879 749
858 986
399 443
113 371
156 320
877 355
952 790
145 807
789 237
998 340
159 721
146 445
734 186
387 338
517 159
179 746
446 649
73 150
71 577
181 23
160 321
597 467
6...

output:

18014

result:

ok single line: '18014'

Test #63:

score: 0
Accepted
time: 8ms
memory: 65472kb

input:

999 1497
591 268
399 993
857 723
930 801
520 456
647 387
159 329
432 98
174 92
926 703
40 582
977 541
813 479
287 65
187 113
402 463
231 625
343 700
349 284
308 42
296 318
246 672
618 261
255 180
329 252
77 83
338 397
263 51
821 836
697 224
283 879
110 809
199 954
379 809
726 303
581 498
694 17
116 ...

output:

7479

result:

ok single line: '7479'

Test #64:

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

input:

999 1497
997 395
412 270
966 34
401 719
106 757
217 854
146 323
568 109
8 123
377 824
624 561
475 134
124 511
703 671
125 435
19 183
754 747
492 591
716 768
685 756
264 788
472 373
513 936
170 679
302 843
99 694
662 819
621 178
154 656
469 931
780 306
598 499
488 820
920 769
490 455
954 113
858 227
...

output:

11979

result:

ok single line: '11979'

Test #65:

score: 0
Accepted
time: 8ms
memory: 63484kb

input:

1000 1500
210 504
69 269
363 719
923 451
772 235
708 834
680 337
281 436
295 885
442 579
417 174
855 49
497 435
606 119
723 98
334 397
116 658
354 255
555 635
294 260
874 162
445 469
525 377
804 950
708 633
15 275
469 321
448 528
467 297
975 790
864 591
348 782
81 77
73 754
912 247
111 366
609 448
8...

output:

1498

result:

ok single line: '1498'

Test #66:

score: 0
Accepted
time: 7ms
memory: 63308kb

input:

1000 1653
427 444
506 128
781 697
656 55
827 726
566 242
191 965
61 200
29 747
798 796
863 776
128 161
431 186
805 546
690 90
742 566
108 984
115 648
477 75
806 750
163 137
322 864
392 899
617 198
893 473
662 988
151 119
233 495
713 461
665 220
64 304
607 156
10 540
831 155
840 491
55 493
614 119
69...

output:

260491928

result:

ok single line: '260491928'

Test #67:

score: 0
Accepted
time: 8ms
memory: 65428kb

input:

1000 2248
382 666
347 2
837 157
701 489
781 221
337 467
668 568
809 416
539 582
900 41
56 273
513 432
959 891
498 65
485 424
301 974
765 120
74 780
324 622
365 158
131 167
745 964
360 725
837 576
284 934
173 789
616 71
428 594
924 344
258 739
771 507
58 605
867 550
846 288
634 360
191 38
459 658
493...

output:

352399300

result:

ok single line: '352399300'

Test #68:

score: 0
Accepted
time: 11ms
memory: 63584kb

input:

1000 2923
351 40
276 245
135 498
748 857
222 864
818 759
582 842
10 760
889 930
232 389
990 633
969 867
818 354
560 302
633 293
301 726
868 896
658 651
800 921
662 120
603 911
422 181
149 896
132 302
35 392
943 32
166 157
174 486
959 734
764 355
195 577
352 708
316 297
952 489
686 599
829 941
812 20...

output:

336860760

result:

ok single line: '336860760'

Test #69:

score: 0
Accepted
time: 8ms
memory: 61432kb

input:

999 2995
560 667
280 808
948 346
567 463
644 276
121 69
397 417
954 119
216 759
700 585
240 63
996 626
761 967
599 414
280 262
363 379
767 720
95 121
850 715
171 809
830 969
706 663
634 669
855 113
935 601
305 815
701 738
275 898
380 677
679 261
488 250
388 422
1 325
394 983
443 647
29 387
418 278
7...

output:

533867978

result:

ok single line: '533867978'

Test #70:

score: 0
Accepted
time: 16ms
memory: 61440kb

input:

1000 3000
404 867
2 646
508 289
248 657
724 336
302 565
673 715
86 925
925 105
64 898
453 886
52 563
358 456
783 77
46 732
761 397
258 773
994 140
223 421
798 54
689 371
113 469
175 539
371 802
347 77
41 584
946 491
286 117
374 892
869 977
258 823
925 105
1000 275
535 568
656 121
233 424
204 205
703...

output:

634021047

result:

ok single line: '634021047'

Test #71:

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

input:

1000 3000
832 107
242 891
857 446
640 13
265 63
90 376
781 526
441 77
127 514
308 142
621 605
804 910
902 85
879 963
169 490
682 979
665 349
761 161
677 603
265 63
224 87
70 578
46 402
492 767
394 2
100 292
178 111
462 757
653 671
388 835
198 339
18 237
256 156
680 640
239 64
321 574
376 755
582 182...

output:

572719395

result:

ok single line: '572719395'

Test #72:

score: 0
Accepted
time: 15ms
memory: 61496kb

input:

1000 1499
440 145
987 212
963 595
247 207
167 765
194 699
267 416
122 799
310 89
746 957
692 396
778 16
830 762
497 742
401 142
935 831
956 380
719 865
438 436
910 447
895 846
596 75
615 745
749 893
652 597
341 210
338 78
623 838
263 336
410 414
304 397
108 66
54 105
368 853
350 279
788 42
285 787
6...

output:

4493

result:

ok single line: '4493'

Test #73:

score: 0
Accepted
time: 8ms
memory: 63460kb

input:

1000 1499
754 321
492 250
968 724
401 934
786 524
457 101
682 810
738 221
709 133
189 771
330 392
992 565
609 925
612 452
607 618
131 144
494 758
933 55
652 463
525 796
674 354
509 744
58 225
877 784
72 474
913 398
550 613
766 62
31 848
47 830
879 373
750 288
646 258
837 958
849 144
288 588
536 40
4...

output:

4058

result:

ok single line: '4058'

Test #74:

score: 0
Accepted
time: 4ms
memory: 61552kb

input:

986 1639
879 366
740 198
355 906
324 27
667 249
922 110
792 89
216 721
572 385
323 203
816 912
535 867
294 457
659 861
881 23
887 499
754 104
154 513
498 877
182 623
812 684
928 400
104 41
468 517
856 553
563 308
910 119
925 135
254 135
985 721
442 671
223 521
321 57
841 811
327 2
284 270
902 57
559...

output:

2893481

result:

ok single line: '2893481'

Test #75:

score: 0
Accepted
time: 8ms
memory: 65744kb

input:

998 1659
491 533
348 877
957 518
981 419
49 651
870 464
588 704
973 995
761 964
609 813
213 941
615 894
961 65
374 657
241 690
539 739
434 836
784 6
567 209
171 644
959 668
501 50
77 866
678 553
593 206
950 102
389 917
998 805
794 520
74 966
725 267
548 338
983 785
660 204
33 73
43 664
496 73
804 87...

output:

2822843

result:

ok single line: '2822843'

Test #76:

score: 0
Accepted
time: 8ms
memory: 63696kb

input:

998 1659
743 360
901 592
398 324
399 936
807 643
912 168
457 37
467 88
197 390
427 843
8 797
419 463
361 534
254 834
506 926
124 133
544 153
876 406
901 690
101 822
669 297
754 910
170 218
719 667
636 357
191 510
376 132
738 469
20 395
920 915
810 127
986 238
508 443
537 757
818 894
546 977
748 794
...

output:

2766522

result:

ok single line: '2766522'

Test #77:

score: 0
Accepted
time: 3ms
memory: 61308kb

input:

999 1662
613 460
551 477
247 707
228 8
892 445
566 460
445 203
602 445
570 933
319 445
866 444
277 35
172 987
671 558
376 110
650 572
2 354
240 298
873 44
131 90
445 441
399 878
247 227
76 51
624 916
209 397
835 894
806 460
122 87
55 882
809 725
345 879
151 632
460 564
778 660
345 797
573 306
672 77...

output:

569033

result:

ok single line: '569033'

Test #78:

score: 0
Accepted
time: 7ms
memory: 61156kb

input:

976 1497
374 236
385 806
186 314
648 139
737 249
50 808
708 77
397 20
67 328
818 338
786 489
859 776
636 332
624 265
7 159
491 516
307 526
749 852
91 501
600 192
951 945
18 310
895 592
748 230
49 278
297 299
169 23
511 759
627 729
7 690
270 742
834 815
431 851
375 679
182 330
225 670
780 783
925 850...

output:

203090614

result:

ok single line: '203090614'

Subtask #4:

score: 1
Accepted

Test #79:

score: 1
Accepted
time: 11ms
memory: 64548kb

input:

3000 10000
1462 2456
1392 440
1583 2589
2538 688
1567 2535
191 2866
2383 588
2559 2490
769 1534
412 709
2592 2349
1997 72
2716 1097
702 1512
2166 1393
2968 62
184 1684
2787 669
605 2542
340 1029
1681 1984
897 2794
2187 2410
2014 2564
476 2313
883 143
2971 2828
1494 2144
1797 1735
2055 1685
311 2511
...

output:

848984993

result:

ok single line: '848984993'

Test #80:

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

input:

3000 10000
1026 1160
2232 980
2905 2477
1395 1586
1776 2162
675 2729
2306 1958
559 2089
551 1043
1122 1397
1871 2324
1662 27
1539 920
1178 183
333 1005
2775 1265
1034 716
142 2518
1211 918
418 1013
604 614
2236 2771
204 863
940 203
2536 1501
1530 823
268 1664
1680 367
2132 744
2429 22
1823 1743
2766...

output:

350484542

result:

ok single line: '350484542'

Test #81:

score: 0
Accepted
time: 16ms
memory: 62436kb

input:

2998 9149
2723 73
2877 1300
1841 932
1431 2571
1951 724
2203 1887
2139 1215
2730 1694
2349 413
471 1161
898 2623
1152 427
1603 147
2329 373
2179 1430
1032 1925
447 476
5 1194
2924 1878
2925 1567
1913 1111
2318 1645
380 2615
394 1866
767 902
2286 1673
2790 1587
2647 1782
2467 2065
2099 1469
303 1987
...

output:

794269949

result:

ok single line: '794269949'

Test #82:

score: 0
Accepted
time: 14ms
memory: 62476kb

input:

2998 10000
1258 1679
2751 621
1241 2056
23 2391
2158 61
1426 1343
201 1641
1970 2574
2643 1757
1819 1635
803 1636
1612 387
543 1829
1631 741
1030 2761
2788 2367
1795 538
1444 2515
2814 833
1158 2295
1657 2465
707 1181
2516 2182
220 2825
2719 392
988 924
2484 1503
1097 438
896 1237
1886 1931
348 437
...

output:

649634712

result:

ok single line: '649634712'

Test #83:

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

input:

3000 10000
848 2755
2804 1912
1776 1288
683 22
1224 2504
2375 834
292 2954
1700 1620
2094 1679
119 2190
196 2413
1157 2913
854 7
1985 1629
302 848
203 1653
1241 569
2735 1933
1913 2433
1924 1416
474 508
10 2676
2201 1688
306 1450
2447 1852
442 2321
398 2476
277 1220
1220 2438
1527 1637
1897 1905
121...

output:

500169597

result:

ok single line: '500169597'

Test #84:

score: 0
Accepted
time: 8ms
memory: 62452kb

input:

3000 10000
367 888
1051 1569
1070 2489
2703 950
2812 1607
2180 1965
2404 997
2314 104
2733 692
2177 1425
2580 1134
2120 631
1438 2113
1610 2622
1300 592
752 2283
2767 1663
1013 2650
2237 2403
2927 2723
2556 1598
276 2440
1172 2006
1899 411
809 87
109 1326
464 2126
2842 67
430 1644
222 2739
14 151
17...

output:

770159

result:

ok single line: '770159'

Test #85:

score: 0
Accepted
time: 11ms
memory: 62204kb

input:

3000 4500
2477 2827
2845 979
1375 937
1504 1754
2185 867
2148 2008
668 1821
2471 561
2541 2603
2693 2256
981 951
2549 2406
1202 282
946 2493
1357 137
658 1534
1370 1224
303 1883
217 2122
2632 2814
2249 682
2387 1136
140 2143
2350 2168
856 2574
2268 1086
1059 223
2605 2022
780 1446
1267 2619
2023 115...

output:

4498

result:

ok single line: '4498'

Test #86:

score: 0
Accepted
time: 7ms
memory: 62036kb

input:

3000 4500
443 1521
2611 1005
113 1880
2322 1285
2058 2789
462 2092
2106 362
2167 518
2600 40
2625 193
2163 1418
713 687
1930 2085
979 760
1028 787
1387 2543
1829 1597
1018 2815
889 2369
1289 291
119 2142
1752 489
141 385
1765 1315
1279 1073
1838 2873
298 2110
1943 1271
2680 2762
699 2245
1334 1134
1...

output:

4498

result:

ok single line: '4498'

Test #87:

score: 0
Accepted
time: 4ms
memory: 64268kb

input:

3000 4500
2013 1627
987 2831
2780 1727
1917 2787
2982 862
1791 2015
1926 2338
889 2124
255 1581
2038 1678
2889 2719
1863 1415
1548 2823
1531 209
844 2811
2285 2242
1293 208
92 1031
228 426
222 1760
2820 897
2628 1985
1182 2597
2296 1286
17 2957
1805 340
1974 443
400 223
640 272
270 1066
1952 8
851 2...

output:

4498

result:

ok single line: '4498'

Test #88:

score: 0
Accepted
time: 15ms
memory: 66016kb

input:

2999 4497
536 126
1348 737
2520 2444
1821 2721
2068 235
51 382
2392 74
287 1547
1859 2278
497 2786
1675 1401
1661 1726
2539 1730
2117 213
528 1536
263 2192
904 133
321 446
141 550
254 1032
49 2626
2635 296
554 1307
1503 2480
1210 794
2301 164
2791 1818
2678 2838
2923 1792
434 2933
715 964
1189 1663
...

output:

58533

result:

ok single line: '58533'

Test #89:

score: 0
Accepted
time: 7ms
memory: 62020kb

input:

2999 4497
1790 282
1481 1228
2364 977
1376 102
1319 753
473 1361
1073 1259
2825 1411
381 770
1226 1547
2733 1767
1490 613
113 1073
1669 942
999 2175
2224 370
1494 1895
1136 1281
574 1200
1456 1143
477 98
2223 2688
1408 1977
2301 1256
1725 1672
2180 2304
1010 1958
708 661
134 1206
1939 356
1756 2800
...

output:

22480

result:

ok single line: '22480'

Test #90:

score: 0
Accepted
time: 15ms
memory: 62036kb

input:

2999 4497
1137 1373
237 126
2712 2868
2056 2922
1090 462
930 958
2631 1771
1867 1856
847 755
56 2803
1048 603
434 1580
181 1328
1423 2806
646 1966
2841 357
2566 1681
2461 500
1954 2587
1074 1025
544 1696
498 2644
2340 2903
577 1875
2299 2457
679 993
1241 1061
1797 978
2852 2179
1692 2958
129 772
250...

output:

31481

result:

ok single line: '31481'

Test #91:

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

input:

3000 4500
311 2871
1161 1242
2957 104
2729 290
1873 1765
2305 2712
1316 2648
1327 298
1319 2997
1760 1389
2365 1226
1860 2756
2636 19
268 1355
310 1822
410 1066
2641 97
2886 230
2857 274
2533 1363
1301 526
814 1301
543 2351
1878 906
1107 2833
1153 2500
2595 168
548 2096
2727 692
803 487
2140 386
689...

output:

4498

result:

ok single line: '4498'

Test #92:

score: 0
Accepted
time: 11ms
memory: 66100kb

input:

2997 5331
2171 723
1973 430
2279 2344
2281 2423
1713 2195
515 110
1150 98
2354 1629
495 2141
524 2753
610 2705
2874 917
2301 2871
853 1509
2678 288
290 1016
1071 1004
2169 923
2311 181
2923 750
2983 630
1742 1774
1832 2191
1348 971
56 1128
79 1879
2096 883
2012 969
1719 2108
2777 2381
1308 1860
373 ...

output:

7028318840

result:

ok single line: '7028318840'

Test #93:

score: 0
Accepted
time: 8ms
memory: 63976kb

input:

3000 7616
1981 2729
1342 2278
96 2344
967 2741
2175 2020
382 806
867 2232
576 957
2200 906
79 183
1528 1763
2983 680
95 1149
115 2099
806 2707
951 598
1493 582
1514 1896
1993 538
2605 76
556 1745
1140 1332
1266 300
2312 720
59 1919
2703 2358
2206 1452
2582 607
479 1034
614 2009
1474 1913
772 994
236...

output:

9429421366

result:

ok single line: '9429421366'

Test #94:

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

input:

3000 9993
2352 807
2235 2186
1112 48
922 1128
407 294
1159 1450
1355 139
188 2905
199 2086
2911 665
2403 1253
2449 833
1681 883
1921 961
2094 917
2768 1860
1507 1841
1691 982
106 1525
1795 1862
1569 707
2634 1030
1051 2487
2796 288
149 1676
1377 30
2258 1303
2713 1433
980 126
545 1924
2079 302
777 1...

output:

10125518520

result:

ok single line: '10125518520'

Test #95:

score: 0
Accepted
time: 14ms
memory: 64332kb

input:

3000 10000
2808 1645
1315 807
1325 938
88 1021
1552 406
2337 208
31 72
1786 2219
1447 257
575 2509
2953 1158
243 146
615 1555
226 2541
1054 1600
1785 1825
2701 427
1995 2542
2908 1934
684 1762
1699 2551
420 2121
2527 361
2345 2313
2417 2642
596 2512
1121 1543
1397 1401
273 1518
1061 1175
1713 2528
9...

output:

14793095471

result:

ok single line: '14793095471'

Test #96:

score: 0
Accepted
time: 10ms
memory: 66280kb

input:

3000 10000
2368 2954
485 1685
2882 1645
1469 1996
221 524
172 759
2350 324
190 794
2477 2981
261 591
556 146
1885 176
975 1011
2000 2884
111 1374
1328 2954
810 2774
1465 654
2674 427
1934 2412
1239 158
1900 287
2397 1966
2945 1971
936 2539
317 2993
1352 311
356 333
2449 2307
2456 2943
1330 2865
1725...

output:

14040046478

result:

ok single line: '14040046478'

Test #97:

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

input:

2995 10000
2794 2544
1010 282
2832 1749
2016 183
1980 572
1721 1622
1985 1769
483 113
456 1041
479 80
1305 950
592 2649
2311 2642
983 2992
1638 143
2088 2642
693 2367
1654 885
1900 1141
912 2203
1921 495
400 2182
911 432
1552 1869
355 2724
2062 852
2055 2311
358 1262
208 2275
889 2403
1462 1595
2711...

output:

14275525314

result:

ok single line: '14275525314'

Test #98:

score: 0
Accepted
time: 15ms
memory: 62128kb

input:

3000 4499
918 960
464 1159
721 1248
1973 48
2638 494
176 2639
960 1274
2799 791
2926 2526
1038 212
774 803
1012 2646
2457 2910
1692 1889
910 1289
2967 2310
1209 2414
1975 2364
240 2801
2938 1187
2219 2904
2314 2976
1841 1154
193 601
2370 1614
2557 2277
975 301
2333 1206
2985 2899
861 686
2296 226
84...

output:

13493

result:

ok single line: '13493'

Test #99:

score: 0
Accepted
time: 3ms
memory: 62080kb

input:

3000 4499
2264 1470
1757 1093
917 2832
1216 2704
1930 2415
2745 705
643 814
2679 1285
553 1954
2361 1525
803 2423
1148 386
427 1275
1903 2944
2660 505
1832 2046
1313 730
2826 73
2392 1736
2109 2893
1251 2552
1391 1153
2278 744
1938 2881
2359 93
147 2736
1860 952
1972 2555
1866 1399
1603 968
788 728
...

output:

12198

result:

ok single line: '12198'

Test #100:

score: 0
Accepted
time: 15ms
memory: 61956kb

input:

2957 4924
2903 795
1396 672
2614 2444
1491 1216
1824 755
1201 2682
1767 2830
2952 1292
2226 1098
2788 125
2132 2344
970 130
292 1842
1237 437
939 2192
1550 2133
1653 904
1262 1638
264 670
2637 643
2485 1409
1414 2614
94 60
708 715
1647 2733
2199 2024
2309 334
1258 2876
903 2095
955 2175
1890 1231
30...

output:

26236924

result:

ok single line: '26236924'

Test #101:

score: 0
Accepted
time: 9ms
memory: 64112kb

input:

2999 4994
445 967
596 2801
786 1390
86 2812
681 567
1478 1412
2004 2538
1871 2239
1597 799
195 2718
1898 2679
2033 1289
2158 1342
1096 611
2069 606
794 139
248 2748
382 1848
1248 1347
1169 2409
470 637
117 2270
2482 2889
2527 687
1431 1020
2571 1585
1205 194
140 2909
513 2353
1776 1751
1646 1810
209...

output:

25601892

result:

ok single line: '25601892'

Test #102:

score: 0
Accepted
time: 11ms
memory: 62320kb

input:

2999 4994
163 999
544 795
1825 2396
2976 1242
566 1311
1966 1023
1420 2526
2834 2311
1750 2795
612 1912
304 2818
2036 2299
382 323
651 1564
2752 2812
2233 2067
1178 2612
1916 592
2176 1932
2604 1490
2078 2438
59 1586
2654 2737
2457 1946
1183 1542
2553 1246
2557 171
2627 2513
2171 2513
1538 1895
604 ...

output:

25112735

result:

ok single line: '25112735'

Test #103:

score: 0
Accepted
time: 8ms
memory: 61852kb

input:

401 10000
306 4
109 241
319 194
140 229
365 174
91 323
337 347
127 349
52 250
96 324
205 3
34 178
84 186
303 80
235 228
89 382
225 144
391 285
309 391
216 33
283 25
397 222
170 283
23 307
322 237
139 224
321 327
158 294
254 86
310 265
226 219
93 348
279 26
354 133
392 309
331 228
252 188
70 22
251 2...

output:

1

result:

ok single line: '1'

Test #104:

score: 0
Accepted
time: 7ms
memory: 64032kb

input:

3000 4997
2998 2699
2474 1046
1959 2187
2008 1851
2328 2253
826 1635
2999 259
2760 1115
2864 1046
1306 1127
429 1224
861 283
2550 204
564 2179
1075 958
1383 791
2379 510
949 444
796 1459
1952 2696
916 470
1856 2634
946 568
1250 1513
1241 2948
771 2985
610 1509
368 1513
349 79
748 664
2012 594
1600 1...

output:

5138881

result:

ok single line: '5138881'

Subtask #5:

score: 0
Wrong Answer

Test #105:

score: 0
Wrong Answer
time: 173ms
memory: 92244kb

input:

50000 150000
1991 3143
21349 44702
31247 42669
25507 37965
30412 49299
42044 38756
42138 41113
1488 32434
34208 17493
20840 21536
5774 22280
23608 8775
12401 15509
10050 29833
19233 13110
33781 13775
47773 6171
33162 25107
39816 35136
36124 20728
37273 39076
3443 17847
27460 32446
44858 37844
1464 4...

output:

3906143703878

result:

wrong answer 1st lines differ - expected: '3906142805978', found: '3906143703878'

Subtask #6:

score: 0
Wrong Answer

Test #127:

score: 0
Wrong Answer
time: 178ms
memory: 87680kb

input:

50000 150000
14654 26345
16262 18307
45564 2940
34025 14154
7547 38896
20114 3366
31149 45513
28695 13798
6986 30707
22590 34358
5291 48712
22936 4381
32033 28140
39625 3256
42953 35299
11588 48847
30809 15894
29064 20863
13324 24272
36616 19852
34373 35937
22995 47785
48427 34086
33652 32646
13204 ...

output:

3704557253619

result:

wrong answer 1st lines differ - expected: '3704557253617', found: '3704557253619'

Subtask #7:

score: 0
Wrong Answer

Test #148:

score: 0
Wrong Answer
time: 440ms
memory: 115008kb

input:

100000 299995
76541 36034
21821 10717
92372 13436
91177 67290
71556 36287
43424 89680
17336 89543
63537 88070
82867 44178
92429 69404
13146 91748
23872 72000
37854 97944
23163 54817
59266 1546
15026 23692
50066 78011
52457 48543
11443 92637
75907 78168
27266 11744
82645 78843
6877 87925
11409 71750
...

output:

32232521445021

result:

wrong answer 1st lines differ - expected: '32232518751544', found: '32232521445021'

Subtask #8:

score: 0
Wrong Answer

Test #170:

score: 0
Wrong Answer
time: 406ms
memory: 112352kb

input:

100000 279113
79936 98761
86614 13502
60129 57171
2595 59656
26815 73006
73210 93780
40617 228
10831 3236
55162 74636
9755 51956
77084 72230
67416 15170
70010 48350
89472 13476
82658 83842
52979 65242
76367 98517
83573 36155
54122 47171
3609 48304
49848 33193
50856 12549
66484 23383
10297 46286
5170...

output:

45963549998079

result:

wrong answer 1st lines differ - expected: '45963547774669', found: '45963549998079'

Subtask #9:

score: 0
Wrong Answer

Test #191:

score: 0
Wrong Answer
time: 912ms
memory: 159860kb

input:

200000 499996
14624 5312
87648 67591
23942 139952
90144 149693
72944 191585
172981 110212
70462 12669
60888 174228
45855 161004
187502 20151
13037 10778
108403 70474
60659 59857
101373 2903
25797 181839
178092 4148
47398 58716
33458 86598
122142 109187
84168 97778
129458 9734
155530 196813
74051 160...

output:

513716382999647

result:

wrong answer 1st lines differ - expected: '513716366636593', found: '513716382999647'

Subtask #10:

score: 0
Wrong Answer

Test #214:

score: 0
Wrong Answer
time: 880ms
memory: 156980kb

input:

200000 500000
96760 112554
29323 168994
89784 103554
72230 56614
72441 184640
409 79524
137579 154258
176 98259
27225 66351
135833 195396
31261 115021
12999 157947
96082 24545
130808 58489
59300 142171
128138 77303
192454 105413
102811 151935
139420 157027
70134 188719
122103 154600
106433 9386
1513...

output:

502166276315506

result:

wrong answer 1st lines differ - expected: '502166260941108', found: '502166276315506'