QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#109605#6379. LaLa and Monster Hunting (Part 2)grass8cowAC ✓1519ms15764kbC++142.2kb2023-05-29 21:10:112023-05-29 21:10:13

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-29 21:10:13]
  • 评测
  • 测评结果:AC
  • 用时:1519ms
  • 内存:15764kb
  • [2023-05-29 21:10:11]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int n,m,d[101000],U[100100],V[101000],rk[100100],sa[101000];
bool cmp(int x,int y){
	if(sa[x]==sa[y]){return x<y;}
	return sa[x]<sa[y];
}
#define ll long long
int head[100100],to[101000],nxt[101000],c;
void add(int u,int v){to[++c]=v,nxt[c]=head[u],head[u]=c;}
int zk[101000],e[101010];
const int mod=998244353;
void ad(int &a,int b){(a+=b)%=mod;}
int f[101000],g[100100],h[101000],ans;
struct ed{int v,w;};
vector<ed>G[101000];
int t1[101000],t2[101000];
bool vi[101000];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=m;i++)scanf("%d%d",&U[i],&V[i]),U[i]++,V[i]++,d[U[i]]++,d[V[i]]++;
	for(int i=1;i<=n;i++)sa[i]=i;
	sort(sa+1,sa+n+1,cmp);
	for(int i=1;i<=n;i++)rk[sa[i]]=i;
	for(int i=1;i<=m;i++){
		if(rk[U[i]]<rk[V[i]])swap(U[i],V[i]);
		add(U[i],V[i]);f[U[i]]++,f[V[i]]++;
		G[U[i]].push_back((ed){V[i],i}),G[V[i]].push_back((ed){U[i],i});
	}
	for(int i=1;i<=m;i++)ad(g[V[i]],f[U[i]]-1),ad(g[U[i]],f[V[i]]-1);
	for(int i=1;i<=m;i++)ad(h[V[i]],(g[U[i]]-(f[V[i]]-1))%mod),ad(h[U[i]],(g[V[i]]-(f[U[i]]-1))%mod);
	for(int i=1;i<=n;i++){
		vector<int>cj;
		for(int j=head[i];j;j=nxt[j])zk[to[j]]=j,cj.push_back(to[j]);
		for(int v:cj)for(int k=head[v];k;k=nxt[k])if(zk[to[k]])e[k]++,e[zk[v]]++,e[zk[to[k]]]++,h[i]-=2,h[v]-=2,h[to[k]]-=2;
		for(int v:cj)zk[v]=0; 
	}
	for(int i=1;i<=n;i++){
		vector<int>cj,cj2;
		for(int j=head[i];j;j=nxt[j])zk[to[j]]=j,cj.push_back(to[j]);
		for(int v:cj)for(int k=head[v];k;k=nxt[k])if(zk[to[k]]){
			int p[3]={k,zk[v],zk[to[k]]},o[3]={to[k],v,i};
			//to[k]-v-i-to[k]
			for(int j=0;j<3;j++)ad(ans,h[o[j]]),ad(ans,-2*g[o[j]]%mod),ad(ans,2*(f[o[j]]-1)%mod),ad(ans,e[p[j]]*2%mod);
			for(int j=0;j<3;j++)ad(ans,-1ll*(e[p[j]]-1)*(f[o[j]]-2)%mod),ad(ans,-1ll*(e[p[j]]-1)*(f[o[(j+1)%3]]-2)%mod);
		}
		for(int v:cj)for(ed t:G[v])if(rk[t.v]<rk[i]){
			if(!vi[t.v])vi[t.v]=1,t1[t.v]=t2[t.v]=0,cj2.push_back(t.v);
			int x=(e[zk[v]]+e[t.w])%mod;
			ad(ans,-t2[t.v]*2%mod),ad(ans,-2ll*t1[t.v]*x%mod);
			t1[t.v]++,(t2[t.v]+=x)%=mod;
		}
		for(int v:cj)zk[v]=0;
		for(int v:cj2)vi[v]=0;
	}
	for(int i=1;i<=m;i++)ad(ans,4ll*e[i]*(e[i]-1)%mod);
	//最后一个结构 
	return printf("%lld",(ans+mod)%mod),0;
}

详细

Test #1:

score: 100
Accepted
time: 4ms
memory: 8880kb

input:

6 7
0 1
1 2
0 2
2 3
3 4
4 5
3 5

output:

4

result:

ok 1 number(s): "4"

Test #2:

score: 0
Accepted
time: 2ms
memory: 9780kb

input:

6 15
0 1
0 2
0 3
0 4
0 5
1 2
1 3
1 4
1 5
2 3
2 4
2 5
3 4
3 5
4 5

output:

360

result:

ok 1 number(s): "360"

Test #3:

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

input:

2 0

output:

0

result:

ok 1 number(s): "0"

Test #4:

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

input:

2 1
0 1

output:

0

result:

ok 1 number(s): "0"

Test #5:

score: 0
Accepted
time: 0ms
memory: 7740kb

input:

2 1
0 1

output:

0

result:

ok 1 number(s): "0"

Test #6:

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

input:

2 1
0 1

output:

0

result:

ok 1 number(s): "0"

Test #7:

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

input:

2 0

output:

0

result:

ok 1 number(s): "0"

Test #8:

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

input:

2 1
0 1

output:

0

result:

ok 1 number(s): "0"

Test #9:

score: 0
Accepted
time: 1ms
memory: 9868kb

input:

3 3
1 2
0 2
0 1

output:

0

result:

ok 1 number(s): "0"

Test #10:

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

input:

3 2
0 1
0 2

output:

0

result:

ok 1 number(s): "0"

Test #11:

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

input:

3 2
0 2
0 1

output:

0

result:

ok 1 number(s): "0"

Test #12:

score: 0
Accepted
time: 0ms
memory: 9792kb

input:

3 3
0 1
0 2
1 2

output:

0

result:

ok 1 number(s): "0"

Test #13:

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

input:

3 0

output:

0

result:

ok 1 number(s): "0"

Test #14:

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

input:

3 3
0 2
0 1
1 2

output:

0

result:

ok 1 number(s): "0"

Test #15:

score: 0
Accepted
time: 0ms
memory: 9820kb

input:

4 5
0 3
0 2
1 3
0 1
1 2

output:

0

result:

ok 1 number(s): "0"

Test #16:

score: 0
Accepted
time: 0ms
memory: 8152kb

input:

4 3
2 3
1 2
0 2

output:

0

result:

ok 1 number(s): "0"

Test #17:

score: 0
Accepted
time: 1ms
memory: 8700kb

input:

4 1
2 3

output:

0

result:

ok 1 number(s): "0"

Test #18:

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

input:

4 3
2 3
1 2
0 3

output:

0

result:

ok 1 number(s): "0"

Test #19:

score: 0
Accepted
time: 0ms
memory: 8764kb

input:

4 5
1 2
0 3
1 3
0 1
0 2

output:

0

result:

ok 1 number(s): "0"

Test #20:

score: 0
Accepted
time: 1ms
memory: 8876kb

input:

4 4
2 3
0 3
1 3
0 2

output:

0

result:

ok 1 number(s): "0"

Test #21:

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

input:

5 6
2 4
0 3
1 4
2 3
0 4
0 2

output:

0

result:

ok 1 number(s): "0"

Test #22:

score: 0
Accepted
time: 0ms
memory: 9836kb

input:

5 8
0 1
0 4
2 4
3 4
2 3
1 2
1 4
0 2

output:

0

result:

ok 1 number(s): "0"

Test #23:

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

input:

5 8
1 2
0 3
2 3
2 4
0 4
1 3
1 4
0 2

output:

0

result:

ok 1 number(s): "0"

Test #24:

score: 0
Accepted
time: 1ms
memory: 8184kb

input:

5 6
0 1
1 4
2 4
3 4
0 3
0 2

output:

0

result:

ok 1 number(s): "0"

Test #25:

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

input:

5 3
2 4
2 3
1 3

output:

0

result:

ok 1 number(s): "0"

Test #26:

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

input:

5 7
2 4
0 1
1 4
1 3
0 3
0 4
1 2

output:

0

result:

ok 1 number(s): "0"

Test #27:

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

input:

6 8
1 2
1 3
2 3
4 5
0 5
0 4
0 2
1 5

output:

8

result:

ok 1 number(s): "8"

Test #28:

score: 0
Accepted
time: 1ms
memory: 9808kb

input:

6 14
0 4
2 5
1 3
1 4
1 5
4 5
2 4
0 5
0 3
3 5
1 2
0 2
3 4
2 3

output:

216

result:

ok 1 number(s): "216"

Test #29:

score: 0
Accepted
time: 1ms
memory: 8688kb

input:

6 3
2 5
0 2
2 3

output:

0

result:

ok 1 number(s): "0"

Test #30:

score: 0
Accepted
time: 1ms
memory: 9828kb

input:

6 15
0 3
1 2
1 4
0 1
2 5
2 4
4 5
3 4
0 4
1 5
0 5
2 3
1 3
0 2
3 5

output:

360

result:

ok 1 number(s): "360"

Test #31:

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

input:

6 14
4 5
2 5
2 4
2 3
0 2
3 5
1 3
1 5
1 2
1 4
0 4
3 4
0 5
0 3

output:

216

result:

ok 1 number(s): "216"

Test #32:

score: 0
Accepted
time: 1ms
memory: 8892kb

input:

6 5
0 3
1 2
1 4
3 5
4 5

output:

0

result:

ok 1 number(s): "0"

Test #33:

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

input:

7 20
2 6
0 2
1 6
1 5
3 5
2 4
0 4
4 6
0 1
2 5
3 6
2 3
4 5
1 2
1 3
0 3
0 5
1 4
5 6
0 6

output:

1800

result:

ok 1 number(s): "1800"

Test #34:

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

input:

7 11
0 3
0 1
2 5
2 4
1 4
1 6
2 3
0 6
0 4
0 2
2 6

output:

16

result:

ok 1 number(s): "16"

Test #35:

score: 0
Accepted
time: 0ms
memory: 9828kb

input:

7 11
0 4
3 6
0 1
3 4
4 6
1 5
4 5
0 5
3 5
1 2
0 3

output:

26

result:

ok 1 number(s): "26"

Test #36:

score: 0
Accepted
time: 1ms
memory: 9812kb

input:

7 8
1 3
3 5
4 5
2 4
0 2
0 6
3 4
3 6

output:

2

result:

ok 1 number(s): "2"

Test #37:

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

input:

7 6
3 5
4 6
0 1
1 2
1 4
0 2

output:

0

result:

ok 1 number(s): "0"

Test #38:

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

input:

7 20
4 6
2 6
2 5
0 2
1 4
3 6
3 4
3 5
2 3
5 6
1 3
4 5
1 6
1 5
0 5
1 2
0 1
0 3
0 4
2 4

output:

1800

result:

ok 1 number(s): "1800"

Test #39:

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

input:

8 18
2 3
0 5
1 6
2 6
0 2
1 5
5 7
2 4
3 5
1 3
5 6
4 5
2 5
3 7
3 4
2 7
3 6
0 4

output:

478

result:

ok 1 number(s): "478"

Test #40:

score: 0
Accepted
time: 1ms
memory: 9832kb

input:

8 26
0 5
4 7
1 5
1 7
4 6
2 3
2 6
1 4
2 4
6 7
0 6
0 7
3 6
5 7
0 2
5 6
2 5
1 3
0 1
1 6
0 3
3 5
3 7
2 7
3 4
0 4

output:

6144

result:

ok 1 number(s): "6144"

Test #41:

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

input:

8 25
5 6
0 4
3 7
0 5
0 6
2 3
1 7
4 5
4 6
5 7
2 4
4 7
1 5
0 3
1 4
1 2
2 5
3 6
2 7
3 5
3 4
0 7
1 6
0 1
0 2

output:

4716

result:

ok 1 number(s): "4716"

Test #42:

score: 0
Accepted
time: 1ms
memory: 8572kb

input:

8 16
1 6
2 6
3 7
4 6
4 5
0 5
0 7
2 3
1 2
5 7
0 2
0 3
3 5
1 3
1 5
0 4

output:

220

result:

ok 1 number(s): "220"

Test #43:

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

input:

8 15
1 3
3 5
1 2
1 7
0 4
2 6
1 5
4 5
2 7
5 7
0 1
2 3
3 7
3 6
3 4

output:

121

result:

ok 1 number(s): "121"

Test #44:

score: 0
Accepted
time: 0ms
memory: 8684kb

input:

8 15
0 1
0 3
4 7
0 5
2 6
5 6
6 7
2 4
3 4
0 7
3 5
4 6
4 5
1 3
0 6

output:

163

result:

ok 1 number(s): "163"

Test #45:

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

input:

9 15
4 7
3 4
2 3
1 5
0 2
2 8
3 7
0 5
6 8
3 8
5 8
2 6
4 6
5 7
6 7

output:

74

result:

ok 1 number(s): "74"

Test #46:

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

input:

9 9
0 6
2 6
3 4
3 6
1 5
6 7
1 6
1 8
0 7

output:

0

result:

ok 1 number(s): "0"

Test #47:

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

input:

9 23
5 8
1 6
5 6
3 7
4 8
2 6
4 5
6 7
0 4
3 6
5 7
0 7
2 7
3 8
0 1
1 7
0 5
1 3
1 4
2 5
1 2
1 8
1 5

output:

1577

result:

ok 1 number(s): "1577"

Test #48:

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

input:

9 15
1 6
3 5
2 6
2 8
5 7
4 5
0 4
0 8
1 5
1 7
3 6
4 7
5 8
2 5
3 4

output:

48

result:

ok 1 number(s): "48"

Test #49:

score: 0
Accepted
time: 0ms
memory: 9784kb

input:

9 30
1 8
0 8
5 8
2 5
2 7
1 2
4 5
2 3
3 6
6 8
7 8
1 5
1 3
1 4
0 3
2 6
3 4
0 1
3 7
0 5
4 6
1 6
0 4
0 7
5 6
6 7
0 6
2 4
4 8
2 8

output:

9141

result:

ok 1 number(s): "9141"

Test #50:

score: 0
Accepted
time: 0ms
memory: 9828kb

input:

9 35
3 6
3 5
4 8
4 6
0 2
1 2
2 4
3 7
5 7
0 4
1 3
4 5
0 7
0 1
2 7
2 3
2 6
0 6
4 7
2 5
2 8
1 6
0 8
1 8
1 4
3 8
1 7
6 7
5 8
0 3
7 8
6 8
3 4
0 5
5 6

output:

25200

result:

ok 1 number(s): "25200"

Test #51:

score: 0
Accepted
time: 2ms
memory: 9824kb

input:

10 13
0 1
3 7
0 4
3 6
0 7
4 7
2 6
2 5
6 8
5 9
1 3
6 9
7 9

output:

8

result:

ok 1 number(s): "8"

Test #52:

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

input:

10 13
0 1
1 9
3 7
4 7
5 7
5 8
5 6
2 6
2 9
0 6
4 9
0 7
0 9

output:

7

result:

ok 1 number(s): "7"

Test #53:

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

input:

10 36
3 7
4 6
2 9
5 6
1 5
7 9
5 9
5 8
0 8
2 4
4 8
0 5
0 9
3 4
3 9
1 8
1 6
0 3
2 3
5 7
0 7
2 7
6 7
1 3
1 2
1 7
2 8
3 8
3 5
2 6
6 8
4 7
3 6
4 5
0 1
1 9

output:

17948

result:

ok 1 number(s): "17948"

Test #54:

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

input:

10 43
0 1
3 8
1 4
2 5
2 7
1 2
1 6
6 9
8 9
5 8
0 4
0 3
1 9
2 3
0 7
2 8
2 6
2 9
4 7
5 7
1 3
3 6
3 7
4 9
6 7
4 6
5 9
3 5
0 6
4 8
7 8
3 4
3 9
1 5
0 8
1 8
7 9
1 7
5 6
0 9
2 4
0 2
0 5

output:

56400

result:

ok 1 number(s): "56400"

Test #55:

score: 0
Accepted
time: 0ms
memory: 9764kb

input:

10 12
3 8
5 7
2 4
3 6
6 7
5 6
3 7
7 9
0 9
0 2
2 9
2 8

output:

20

result:

ok 1 number(s): "20"

Test #56:

score: 0
Accepted
time: 1ms
memory: 8676kb

input:

10 44
2 4
3 6
5 7
6 9
0 7
0 4
1 4
1 9
8 9
7 9
3 4
1 2
0 2
3 7
6 7
1 7
3 8
0 9
0 3
4 6
4 5
2 9
1 5
1 8
4 9
2 7
3 5
2 3
5 9
3 9
1 6
4 7
6 8
2 5
1 3
4 8
2 8
5 8
2 6
7 8
0 5
0 6
0 1
0 8

output:

65520

result:

ok 1 number(s): "65520"

Test #57:

score: 0
Accepted
time: 0ms
memory: 8640kb

input:

6 15
1 4
0 3
4 5
3 5
0 4
2 3
3 4
2 4
2 5
1 3
0 5
0 1
0 2
1 5
1 2

output:

360

result:

ok 1 number(s): "360"

Test #58:

score: 0
Accepted
time: 1ms
memory: 9796kb

input:

7 21
5 6
1 3
0 3
1 5
4 5
0 4
2 4
3 5
0 2
4 6
1 2
3 6
0 5
1 4
2 6
0 6
2 5
1 6
2 3
3 4
0 1

output:

2520

result:

ok 1 number(s): "2520"

Test #59:

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

input:

8 28
3 7
2 6
5 6
1 2
3 4
0 7
0 3
1 7
0 6
3 6
5 7
0 5
0 4
2 7
6 7
4 7
1 5
0 2
2 4
1 4
1 6
1 3
2 3
4 5
4 6
0 1
2 5
3 5

output:

10080

result:

ok 1 number(s): "10080"

Test #60:

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

input:

9 36
1 8
1 5
4 5
6 8
2 6
0 8
0 7
5 6
0 2
4 7
3 8
0 6
0 3
3 7
1 7
3 4
7 8
1 2
2 8
1 3
2 7
2 5
1 4
4 8
3 6
2 3
0 4
1 6
3 5
0 1
4 6
5 8
5 7
0 5
2 4
6 7

output:

30240

result:

ok 1 number(s): "30240"

Test #61:

score: 0
Accepted
time: 1ms
memory: 9812kb

input:

10 45
4 5
3 8
0 6
6 8
1 6
0 3
4 6
4 9
6 7
4 7
3 6
0 7
0 2
0 8
1 9
1 5
1 4
3 4
5 6
1 3
5 7
5 9
2 5
2 9
2 3
2 8
0 4
1 2
2 7
8 9
7 8
3 5
1 7
2 6
4 8
6 9
3 7
3 9
7 9
0 9
2 4
5 8
0 5
0 1
1 8

output:

75600

result:

ok 1 number(s): "75600"

Test #62:

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

input:

11 55
1 10
2 6
7 8
4 8
5 9
1 6
3 10
5 10
4 9
1 5
0 6
4 7
3 8
3 4
9 10
2 9
2 5
0 5
6 10
0 2
2 7
1 8
0 9
4 10
4 6
6 8
3 7
0 4
1 4
1 7
3 9
2 10
8 10
6 9
5 8
3 5
7 10
3 6
8 9
1 9
2 4
2 3
5 6
0 7
6 7
0 10
2 8
0 3
4 5
1 3
0 8
5 7
0 1
1 2
7 9

output:

166320

result:

ok 1 number(s): "166320"

Test #63:

score: 0
Accepted
time: 1ms
memory: 9896kb

input:

12 66
7 8
0 3
2 5
0 4
1 6
0 9
4 5
0 8
0 7
3 11
5 11
1 4
2 6
5 10
7 10
7 11
6 10
0 1
3 5
3 6
1 2
0 6
5 7
2 9
4 7
2 4
0 11
6 8
1 3
5 6
0 5
8 10
6 7
6 11
2 3
4 8
3 4
4 11
1 11
9 10
8 11
2 8
4 6
3 9
4 9
3 8
1 8
0 2
5 8
3 7
1 7
2 10
8 9
2 11
1 5
10 11
1 9
1 10
4 10
7 9
9 11
5 9
3 10
6 9
2 7
0 10

output:

332640

result:

ok 1 number(s): "332640"

Test #64:

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

input:

13 78
1 9
1 3
1 12
6 11
8 11
2 6
0 10
5 6
0 9
9 12
7 8
3 4
2 4
2 8
0 11
5 8
2 7
3 5
0 6
6 10
3 10
3 6
4 7
2 3
2 11
1 5
2 5
5 7
0 8
11 12
1 8
2 9
4 5
0 5
6 9
9 11
3 12
3 7
1 7
1 2
6 12
0 2
1 4
9 10
7 11
4 10
6 8
2 10
3 8
8 10
6 7
8 12
3 11
4 8
4 9
5 11
0 4
2 12
5 9
1 6
5 10
8 9
4 11
0 3
10 12
5 12
7 ...

output:

617760

result:

ok 1 number(s): "617760"

Test #65:

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

input:

14 91
8 13
10 12
0 3
4 9
1 2
4 7
5 6
3 12
7 10
0 1
8 9
2 13
0 12
2 3
9 10
4 5
10 13
7 9
9 11
7 13
1 11
3 5
7 11
1 7
0 5
0 11
2 5
0 13
3 4
2 12
1 4
3 6
6 11
6 9
5 12
4 13
0 2
3 9
2 10
8 12
7 8
9 12
1 3
4 6
6 7
0 8
6 10
5 7
11 13
2 6
3 13
0 6
7 12
11 12
6 13
1 9
4 10
1 6
0 10
0 9
3 8
10 11
1 8
6 8
2 4...

output:

1081080

result:

ok 1 number(s): "1081080"

Test #66:

score: 0
Accepted
time: 2ms
memory: 9924kb

input:

15 105
6 9
3 14
0 2
0 5
7 10
5 7
1 3
9 11
1 12
3 4
0 4
1 9
3 11
3 13
0 14
5 9
10 11
8 10
1 11
2 12
7 13
11 12
12 14
7 8
5 11
5 14
2 13
0 8
9 12
2 14
6 10
0 9
2 3
3 10
8 12
6 8
3 9
4 9
3 6
11 14
5 8
10 13
1 14
4 6
3 5
0 13
6 7
6 13
4 13
2 11
1 10
1 6
3 8
4 12
1 7
1 2
5 13
2 10
9 14
0 7
11 13
4 8
6 11...

output:

1801800

result:

ok 1 number(s): "1801800"

Test #67:

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

input:

16 120
4 15
1 14
1 3
6 10
1 8
8 10
1 11
9 14
2 6
3 8
7 12
5 8
8 11
5 6
1 6
0 13
2 8
3 7
1 15
0 9
0 2
6 14
4 8
1 9
0 8
0 6
11 15
12 13
1 5
8 9
12 14
2 13
7 13
1 10
7 10
1 2
2 4
2 15
10 11
5 12
5 15
5 9
3 4
9 11
0 10
4 11
1 4
10 13
6 12
10 15
4 6
3 9
7 11
9 13
2 12
3 6
1 12
6 8
3 12
4 5
7 8
8 15
4 10
...

output:

2882880

result:

ok 1 number(s): "2882880"

Test #68:

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

input:

17 136
3 14
4 12
7 10
0 4
6 16
7 13
2 16
4 8
13 15
1 11
0 10
10 16
7 16
4 7
7 12
0 13
0 3
8 12
4 13
6 8
0 7
5 7
1 13
5 14
6 11
12 13
8 16
6 7
1 2
0 1
11 12
11 14
14 15
10 13
3 10
4 14
8 14
3 6
11 16
10 14
4 9
1 6
9 14
2 8
9 16
7 15
0 11
6 12
1 5
4 5
11 15
8 11
3 11
2 12
2 9
12 16
0 9
4 15
0 15
6 9
5...

output:

4455360

result:

ok 1 number(s): "4455360"

Test #69:

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

input:

18 153
3 4
7 15
3 7
3 10
4 17
11 17
2 7
8 10
1 13
14 15
11 12
0 6
13 16
3 12
11 13
5 11
0 13
1 10
3 15
11 16
2 9
6 14
3 14
10 15
5 8
8 16
7 13
12 13
5 10
7 8
1 9
0 10
9 15
6 12
0 17
6 11
9 13
3 5
7 16
3 6
9 12
3 17
5 15
9 16
2 4
1 2
1 5
2 5
0 2
10 14
14 16
2 16
2 12
16 17
5 6
4 15
12 15
1 7
4 10
12 ...

output:

6683040

result:

ok 1 number(s): "6683040"

Test #70:

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

input:

19 171
8 15
11 17
1 12
6 13
4 11
3 17
5 6
1 16
1 3
0 17
3 14
9 10
2 5
6 12
5 9
0 13
1 7
14 16
0 4
0 11
12 15
12 13
5 8
2 11
11 14
11 13
11 16
7 16
13 18
2 3
7 15
1 9
1 5
5 10
16 17
0 7
9 11
3 12
13 15
0 10
7 9
4 18
1 8
1 10
0 18
6 9
1 11
9 17
2 17
6 7
3 11
8 18
11 15
8 10
0 5
13 17
1 2
6 14
3 4
4 16...

output:

9767520

result:

ok 1 number(s): "9767520"

Test #71:

score: 0
Accepted
time: 0ms
memory: 8312kb

input:

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

output:

13953600

result:

ok 1 number(s): "13953600"

Test #72:

score: 0
Accepted
time: 1242ms
memory: 11488kb

input:

420 87990
66 338
323 336
186 376
318 325
284 379
21 410
374 376
39 343
259 398
79 393
58 126
178 296
77 110
70 299
77 172
56 395
191 302
2 238
191 318
61 152
270 397
121 287
141 291
140 343
168 212
25 303
302 363
18 359
175 341
140 202
189 190
316 339
299 396
129 280
119 224
110 279
190 418
306 417
...

output:

405528396

result:

ok 1 number(s): "405528396"

Test #73:

score: 0
Accepted
time: 1222ms
memory: 11208kb

input:

421 88410
95 388
24 103
78 185
22 336
18 156
64 301
151 210
195 303
385 401
164 189
269 280
146 181
373 401
301 343
78 219
300 406
64 345
47 228
3 148
146 324
203 288
110 250
132 416
173 215
123 345
0 46
352 361
112 269
52 305
195 264
187 342
71 216
74 132
77 330
41 251
84 238
213 236
183 357
182 23...

output:

346445439

result:

ok 1 number(s): "346445439"

Test #74:

score: 0
Accepted
time: 1247ms
memory: 11832kb

input:

422 88831
380 382
357 394
20 158
199 229
279 405
302 307
159 180
31 230
22 399
33 89
9 368
150 206
354 409
108 130
281 344
109 270
31 200
27 225
36 199
105 321
15 80
71 270
28 141
136 144
19 153
166 298
70 182
29 181
75 381
13 180
242 377
271 327
128 157
51 418
68 375
113 357
115 201
202 218
158 398...

output:

212263949

result:

ok 1 number(s): "212263949"

Test #75:

score: 0
Accepted
time: 1275ms
memory: 11200kb

input:

423 89253
280 354
1 102
281 282
52 284
189 242
22 213
159 343
153 262
204 319
149 191
126 332
150 368
123 194
105 110
61 157
226 259
4 55
22 259
31 146
159 366
173 303
377 421
206 419
232 391
256 391
30 378
136 235
20 32
327 396
253 318
44 60
59 163
9 272
334 416
278 408
168 236
133 240
65 93
134 15...

output:

423584914

result:

ok 1 number(s): "423584914"

Test #76:

score: 0
Accepted
time: 1264ms
memory: 11532kb

input:

424 89676
98 126
370 395
211 375
129 235
49 144
35 202
197 254
121 394
47 116
85 110
83 423
310 412
359 370
176 408
111 217
217 249
243 329
1 127
269 394
15 35
103 112
204 265
11 73
252 383
165 269
374 381
159 354
9 257
266 287
76 359
177 178
0 96
51 263
61 159
55 394
67 90
126 407
216 388
89 179
34...

output:

434441369

result:

ok 1 number(s): "434441369"

Test #77:

score: 0
Accepted
time: 1287ms
memory: 11656kb

input:

425 90100
170 175
103 247
15 89
103 418
190 269
94 199
79 379
62 187
181 357
91 315
164 402
58 91
38 172
13 74
75 242
164 415
321 398
85 153
294 329
119 184
335 343
128 210
238 422
57 308
166 270
159 180
329 394
104 157
155 229
2 232
66 213
319 359
20 175
45 139
41 121
93 327
360 369
230 393
14 408
...

output:

728938302

result:

ok 1 number(s): "728938302"

Test #78:

score: 0
Accepted
time: 1284ms
memory: 10788kb

input:

426 90525
191 227
225 274
52 54
272 295
108 215
15 193
174 214
82 420
107 354
225 346
151 230
120 269
147 336
212 409
121 329
128 363
122 213
404 405
108 116
14 416
153 381
226 290
170 316
187 423
211 375
373 378
198 268
8 160
135 253
66 425
377 392
122 332
336 401
185 343
250 391
3 149
66 223
228 4...

output:

824915508

result:

ok 1 number(s): "824915508"

Test #79:

score: 0
Accepted
time: 1289ms
memory: 11056kb

input:

427 90951
71 136
123 269
254 352
34 237
225 235
206 230
22 92
40 191
219 359
190 268
51 109
210 224
32 279
119 246
56 83
218 368
4 337
26 38
42 279
18 123
33 330
368 382
224 235
368 379
31 268
230 291
211 415
153 364
234 396
112 196
173 398
139 174
30 346
171 307
242 380
321 326
168 413
163 269
165 ...

output:

272343862

result:

ok 1 number(s): "272343862"

Test #80:

score: 0
Accepted
time: 1268ms
memory: 12500kb

input:

428 91378
5 359
57 229
153 254
93 406
30 255
228 375
181 370
158 400
34 322
124 144
91 110
258 274
51 424
24 237
11 342
22 281
56 373
17 167
286 424
267 306
296 402
129 319
318 357
170 424
11 404
43 241
346 350
208 246
268 411
153 291
89 191
148 356
140 378
147 231
22 363
76 174
370 398
172 225
52 3...

output:

649966305

result:

ok 1 number(s): "649966305"

Test #81:

score: 0
Accepted
time: 1286ms
memory: 12252kb

input:

429 91806
265 394
334 412
75 252
228 422
123 259
200 361
240 409
321 339
93 234
213 344
332 384
63 111
188 231
289 410
18 51
40 288
163 219
177 235
71 259
42 355
4 421
95 205
131 265
115 201
138 325
38 240
54 103
143 319
92 368
97 181
31 301
16 124
195 254
59 405
60 183
62 93
9 197
32 189
213 316
11...

output:

574228719

result:

ok 1 number(s): "574228719"

Test #82:

score: 0
Accepted
time: 1351ms
memory: 12528kb

input:

430 92235
246 272
182 211
289 429
149 342
120 314
284 341
30 293
23 245
98 156
61 169
115 348
151 243
273 332
199 204
63 405
3 63
21 220
242 359
32 42
44 95
167 318
17 294
65 299
333 418
65 409
25 245
149 283
38 326
94 163
8 211
321 323
70 308
16 317
3 346
13 324
149 335
133 228
139 210
193 325
131 ...

output:

690654692

result:

ok 1 number(s): "690654692"

Test #83:

score: 0
Accepted
time: 1318ms
memory: 12248kb

input:

431 92665
213 311
105 317
148 180
278 303
46 348
98 112
101 309
319 350
22 81
212 244
202 253
235 281
201 424
149 366
43 210
155 168
56 215
187 262
206 334
302 356
9 220
61 399
71 285
187 310
134 184
260 365
11 34
203 418
232 271
76 425
174 426
203 342
120 216
149 406
194 210
127 221
1 305
214 231
1...

output:

679265819

result:

ok 1 number(s): "679265819"

Test #84:

score: 0
Accepted
time: 1374ms
memory: 11848kb

input:

432 93096
210 297
274 405
100 246
126 209
228 347
199 344
293 381
136 396
176 189
228 427
129 258
246 253
3 44
60 115
298 361
363 414
268 362
81 346
16 130
111 318
253 405
174 181
121 333
63 290
285 390
75 414
204 420
8 215
267 279
307 334
61 329
3 39
120 419
154 200
55 160
43 160
185 360
57 206
102...

output:

252979775

result:

ok 1 number(s): "252979775"

Test #85:

score: 0
Accepted
time: 1348ms
memory: 12540kb

input:

433 93528
325 369
406 424
275 298
36 272
53 97
217 334
25 305
303 427
268 398
311 400
349 358
31 357
329 361
231 296
8 42
221 399
15 36
193 407
35 142
125 400
284 291
48 168
76 351
205 370
4 134
181 361
113 173
276 316
314 421
194 335
144 151
194 373
165 267
126 351
250 343
73 336
48 294
120 268
318...

output:

156008748

result:

ok 1 number(s): "156008748"

Test #86:

score: 0
Accepted
time: 1358ms
memory: 12560kb

input:

434 93961
153 408
208 395
117 366
229 267
35 102
127 242
78 141
135 279
220 402
14 228
83 423
285 373
0 294
213 242
41 294
55 131
208 246
72 327
192 316
59 73
224 358
83 113
142 392
38 254
332 375
131 342
245 351
12 103
135 207
171 335
254 306
386 410
327 331
26 358
273 368
1 262
127 181
293 346
365...

output:

167525173

result:

ok 1 number(s): "167525173"

Test #87:

score: 0
Accepted
time: 1382ms
memory: 11228kb

input:

435 94395
30 318
248 358
113 309
5 192
192 300
316 422
116 254
16 95
114 291
145 406
143 364
62 346
72 243
266 417
51 332
43 197
65 75
168 238
32 375
174 203
100 307
290 406
121 315
62 252
105 375
100 157
32 353
99 418
28 385
217 253
97 143
49 325
383 434
171 345
52 66
205 394
54 239
100 165
60 106
...

output:

100060885

result:

ok 1 number(s): "100060885"

Test #88:

score: 0
Accepted
time: 1392ms
memory: 12532kb

input:

436 94830
71 275
172 261
172 177
107 344
6 21
79 354
348 377
47 390
200 273
360 434
220 282
162 229
27 325
15 179
132 427
33 191
13 111
95 279
195 369
212 398
165 430
9 242
5 267
294 412
2 363
16 151
371 390
32 279
163 287
261 292
429 432
6 395
91 395
129 356
116 386
54 363
201 210
121 381
364 382
5...

output:

797906632

result:

ok 1 number(s): "797906632"

Test #89:

score: 0
Accepted
time: 1417ms
memory: 12696kb

input:

437 95266
30 90
6 284
94 359
246 385
250 303
202 221
128 255
67 311
96 166
44 230
248 367
215 434
22 73
69 151
73 252
183 305
371 409
10 210
140 354
281 363
281 410
121 343
66 299
74 346
219 353
139 222
126 369
118 395
143 301
239 388
50 344
44 155
215 335
129 237
228 303
106 408
57 279
74 398
312 3...

output:

144290183

result:

ok 1 number(s): "144290183"

Test #90:

score: 0
Accepted
time: 1401ms
memory: 12128kb

input:

438 95703
67 188
25 397
324 413
205 420
286 409
80 282
37 308
41 107
34 240
351 422
51 98
111 140
17 100
326 376
109 283
96 305
145 415
220 282
192 249
259 329
150 184
394 397
74 432
35 390
314 422
340 417
222 242
310 420
244 277
130 318
67 397
40 349
85 204
149 162
46 263
247 323
41 407
58 183
300 ...

output:

49242679

result:

ok 1 number(s): "49242679"

Test #91:

score: 0
Accepted
time: 1409ms
memory: 12564kb

input:

439 96141
57 236
142 183
56 371
233 310
253 339
400 412
51 242
173 292
45 358
139 216
151 373
226 289
49 100
171 297
139 208
189 399
343 436
3 8
43 327
178 410
166 270
82 307
386 398
116 295
75 234
272 411
40 118
107 427
365 366
117 260
160 179
243 303
188 211
183 229
147 237
71 185
7 177
120 187
57...

output:

460288755

result:

ok 1 number(s): "460288755"

Test #92:

score: 0
Accepted
time: 1418ms
memory: 11592kb

input:

440 96580
277 399
239 323
19 350
184 387
341 436
19 298
129 247
90 127
201 364
57 277
202 205
363 379
234 259
112 209
121 286
112 316
5 397
14 338
259 405
300 358
207 249
114 304
170 389
248 361
351 419
197 201
120 188
47 374
181 328
61 357
305 411
110 206
26 372
183 237
179 186
55 82
141 307
23 350...

output:

360847493

result:

ok 1 number(s): "360847493"

Test #93:

score: 0
Accepted
time: 1424ms
memory: 12456kb

input:

441 97020
199 203
338 377
348 414
110 262
241 365
257 265
51 224
23 171
290 422
28 232
35 298
246 377
94 284
118 252
110 224
348 389
108 120
21 413
52 135
132 221
160 230
73 157
22 108
134 248
106 362
199 396
183 424
135 303
344 435
222 395
168 211
200 215
374 398
236 418
125 254
295 430
99 249
385 ...

output:

765122441

result:

ok 1 number(s): "765122441"

Test #94:

score: 0
Accepted
time: 1450ms
memory: 12060kb

input:

442 97461
28 39
99 119
63 352
131 389
306 327
135 147
213 329
338 427
42 117
278 440
9 382
312 404
268 326
297 305
31 291
124 272
203 380
154 182
3 20
44 81
245 321
255 410
43 136
300 340
198 427
382 401
99 229
35 110
278 292
21 381
339 441
125 196
17 153
174 372
135 278
191 382
6 328
87 292
1 372
1...

output:

725281521

result:

ok 1 number(s): "725281521"

Test #95:

score: 0
Accepted
time: 1436ms
memory: 12716kb

input:

443 97903
106 271
359 369
210 408
122 399
65 378
140 169
300 319
116 236
51 177
52 284
6 204
114 314
137 207
109 382
140 206
28 237
4 335
63 288
37 402
91 384
359 411
115 329
365 408
182 333
122 251
151 268
42 330
285 386
95 346
212 291
62 201
278 431
123 229
130 180
30 72
88 204
294 439
128 238
240...

output:

326347768

result:

ok 1 number(s): "326347768"

Test #96:

score: 0
Accepted
time: 1498ms
memory: 11828kb

input:

444 98346
397 439
69 109
42 418
41 242
68 108
56 287
140 316
37 274
26 229
155 296
336 387
17 51
204 346
147 264
106 395
174 362
237 283
15 85
60 417
77 203
334 400
83 143
184 227
124 332
2 322
153 384
49 365
81 186
161 263
77 243
135 330
110 188
33 308
57 135
212 289
25 353
161 255
359 413
366 440
...

output:

686357370

result:

ok 1 number(s): "686357370"

Test #97:

score: 0
Accepted
time: 1519ms
memory: 11052kb

input:

445 98790
157 394
55 122
14 50
216 356
240 277
90 180
0 17
317 323
165 291
125 329
111 318
228 398
205 378
14 377
90 157
123 251
229 388
164 283
4 135
259 367
172 407
217 364
314 368
285 358
237 401
131 382
115 408
410 444
125 441
312 354
151 368
195 369
253 348
136 365
32 412
175 251
39 394
33 320
...

output:

961785009

result:

ok 1 number(s): "961785009"

Test #98:

score: 0
Accepted
time: 1475ms
memory: 12384kb

input:

446 99235
57 203
289 377
180 438
286 350
65 395
351 415
111 349
49 434
351 386
225 418
235 440
129 145
316 420
135 310
88 329
121 296
0 335
210 229
314 352
224 308
320 394
48 438
322 427
1 271
150 321
113 295
65 247
74 409
37 137
78 150
198 413
47 50
71 110
417 434
265 300
198 353
43 272
334 400
58 ...

output:

344191327

result:

ok 1 number(s): "344191327"

Test #99:

score: 0
Accepted
time: 1481ms
memory: 12396kb

input:

447 99681
258 431
81 142
103 316
75 269
211 260
24 299
13 55
154 235
264 397
0 342
0 109
96 179
91 307
251 252
361 371
205 401
21 204
127 344
22 209
34 61
389 441
126 316
190 240
29 91
167 259
27 91
157 221
175 223
87 226
27 292
200 211
336 398
148 213
109 359
341 413
15 198
107 364
56 284
89 116
12...

output:

56870752

result:

ok 1 number(s): "56870752"

Test #100:

score: 0
Accepted
time: 79ms
memory: 12240kb

input:

10000 100000
3 677
6 5935
7 7112
10 4223
13 7922
16 3653
19 6616
20 7465
21 7773
22 4241
25 2598
26 3000
27 9877
28 9750
32 3334
33 6263
35 2557
37 962
40 6382
42 5835
43 2003
45 8236
47 1950
49 4207
52 6215
54 7400
55 1787
60 7471
62 3769
64 9018
66 1954
67 5578
70 5580
73 6835
75 8973
76 8937
77 9...

output:

29946588

result:

ok 1 number(s): "29946588"

Test #101:

score: 0
Accepted
time: 78ms
memory: 13392kb

input:

10001 100000
2002 8868
489 2225
1885 4283
8392 9206
4530 8787
4714 8503
1556 6084
2903 7189
7461 8825
1851 4462
101 6272
9369 9855
2738 9599
2557 9213
6543 8305
4872 8037
3108 4775
7789 7910
1080 6548
1910 2546
1206 2969
4514 7341
4234 9540
706 6597
3954 4799
8926 9341
5920 9109
60 9081
8589 9017
11...

output:

33760972

result:

ok 1 number(s): "33760972"

Test #102:

score: 0
Accepted
time: 77ms
memory: 12736kb

input:

10002 100000
2755 8957
1063 4219
2377 2900
1103 3880
2944 3528
126 9129
8464 8993
8411 8799
3769 8765
6779 9062
2440 5625
354 9833
2245 9747
1740 2177
4618 6977
3949 7290
635 9487
741 9114
2649 5026
578 4820
1496 5116
435 623
1180 8780
2713 5791
883 4472
908 2180
6147 9694
621 1635
331 7625
3477 775...

output:

31580205

result:

ok 1 number(s): "31580205"

Test #103:

score: 0
Accepted
time: 71ms
memory: 12196kb

input:

10003 100000
3140 8312
6895 9044
3149 5093
1323 5831
1192 3955
4442 7561
3849 5742
7777 9536
5347 8366
783 3534
849 8020
5668 6769
7664 8222
597 6306
21 7527
444 9973
1772 9074
6532 7068
2168 6371
4737 6364
2525 7754
5112 8837
2090 7906
7904 9734
2083 8551
8906 8924
4011 6824
5608 8107
6550 7424
384...

output:

32113443

result:

ok 1 number(s): "32113443"

Test #104:

score: 0
Accepted
time: 73ms
memory: 13468kb

input:

10004 100000
6799 8132
6158 7642
1193 1553
2545 8077
3357 6090
1234 3148
3888 8412
5997 9445
2358 9193
89 6211
4111 7945
5469 9297
380 8434
3917 5346
2023 9183
498 5321
5583 8677
2773 8536
4058 4697
1269 1551
4199 4846
1655 8892
6274 7634
4124 9774
146 3282
2117 4547
1187 9574
3899 6203
887 7111
389...

output:

31328844

result:

ok 1 number(s): "31328844"

Test #105:

score: 0
Accepted
time: 142ms
memory: 13460kb

input:

10005 100000
3 4211
7 621
8 7792
11 1080
15 8195
18 3522
19 1746
20 9091
25 684
26 7732
28 1806
35 3871
41 234
42 4315
44 8871
45 6037
46 8824
47 9965
56 9014
59 3258
60 5039
62 2518
65 4418
66 4522
69 2647
76 4569
77 1375
80 5484
83 1361
85 1536
87 7352
100 1913
104 8158
107 4579
115 9294
116 3834
...

output:

32083697

result:

ok 1 number(s): "32083697"

Test #106:

score: 0
Accepted
time: 79ms
memory: 13500kb

input:

10006 100000
2 1652
4 9655
5 7424
10 3700
11 7576
14 6604
15 5726
16 5953
17 2091
20 9485
22 7018
23 527
29 7248
34 8865
37 5634
39 6647
40 9049
42 8702
46 7988
53 9048
55 876
58 8352
59 9703
64 5113
67 9613
69 7958
75 1987
78 917
79 6643
81 5687
82 1967
84 3413
90 161
91 5462
92 353
93 9683
95 5600...

output:

30419437

result:

ok 1 number(s): "30419437"

Test #107:

score: 0
Accepted
time: 73ms
memory: 13516kb

input:

10007 100000
0 7300
1 3009
7 7943
9 3487
10 8837
12 927
13 9630
14 8998
16 8873
20 7974
21 968
23 6491
24 7314
33 9403
34 9067
38 4665
40 7267
41 3777
42 845
43 9032
44 3125
48 1036
49 2949
50 1422
51 4481
52 9723
58 1523
61 8988
62 4383
63 3464
65 6420
66 3792
67 3958
69 7370
77 7681
78 1169
82 591...

output:

33413748

result:

ok 1 number(s): "33413748"

Test #108:

score: 0
Accepted
time: 110ms
memory: 13836kb

input:

10008 100000
1273 8820
1608 4242
1419 7411
8944 9346
363 2536
1317 2721
1808 8501
377 8940
7102 8431
4741 5801
7511 9166
1329 4748
3210 7373
3085 6615
4959 6193
3041 8464
2608 5486
7094 7840
4992 8959
4896 9696
3254 9628
5570 7962
515 697
2753 5199
1776 6262
1382 3291
1196 4001
1093 9142
1507 8259
6...

output:

31764784

result:

ok 1 number(s): "31764784"

Test #109:

score: 0
Accepted
time: 77ms
memory: 13584kb

input:

10009 100000
3888 6431
1698 7526
1039 1631
999 7394
993 2542
1784 8458
657 4990
1939 3681
1430 4698
4921 6844
733 9413
872 9664
1177 8026
1202 7719
1446 2612
2001 7187
4563 6661
3225 7482
2340 2760
5407 9422
4171 5521
3239 7366
7726 9546
9 4952
1836 7257
3730 8086
3856 4628
5264 9268
5452 8355
261 1...

output:

31254299

result:

ok 1 number(s): "31254299"

Test #110:

score: 0
Accepted
time: 73ms
memory: 13460kb

input:

10010 100000
3 1683
4 3754
5 9378
9 4844
16 8334
20 1792
24 8977
25 8642
27 6171
29 2376
30 8428
34 3238
36 6914
41 9394
42 4483
45 4891
46 1156
48 8133
49 9589
50 817
51 8811
54 8514
56 1380
57 477
58 8565
59 5808
63 1572
64 9330
65 9296
67 7437
68 2843
70 8621
81 5375
82 2923
83 9713
85 4312
86 29...

output:

31023989

result:

ok 1 number(s): "31023989"

Test #111:

score: 0
Accepted
time: 59ms
memory: 13448kb

input:

29990 100000
0 23614
3 20157
5 17009
6 23838
7 21272
9 8502
15 5068
17 19354
20 12679
21 3056
24 17960
26 17119
28 24154
31 20439
32 3534
33 15940
36 28989
37 20526
40 13719
44 26053
49 22146
51 2266
59 25505
60 22733
61 5514
65 1573
71 4334
79 1038
80 9678
82 22704
83 8944
84 21274
89 26022
90 1085...

output:

31020

result:

ok 1 number(s): "31020"

Test #112:

score: 0
Accepted
time: 72ms
memory: 14008kb

input:

29991 100000
1336 7318
11058 11948
4811 26135
13082 18212
10337 11843
2899 10308
28010 29577
3429 5330
16329 22008
11550 27453
375 19084
2101 3865
14045 14792
1573 7056
9008 9738
8824 28392
1533 25188
14793 28708
18552 21864
5082 14362
15869 21621
11606 17111
8748 14839
7362 27687
24929 29814
5021 2...

output:

47704

result:

ok 1 number(s): "47704"

Test #113:

score: 0
Accepted
time: 71ms
memory: 14092kb

input:

29992 100000
16104 21621
4010 21793
25745 26688
2496 13669
1282 12907
4261 9255
1044 5283
15842 20121
8547 9030
5193 11565
3334 4360
1012 15444
22683 22925
7967 18214
6064 16995
19297 25302
5140 16010
11188 19569
5933 10411
25276 25365
10176 28293
1457 26003
22526 28078
11403 21110
16651 16800
17807...

output:

43330

result:

ok 1 number(s): "43330"

Test #114:

score: 0
Accepted
time: 62ms
memory: 13100kb

input:

29993 100000
3831 14159
2637 13169
22588 25533
4371 27371
2365 7623
7217 25341
8677 26555
6754 10880
14890 27844
10038 25108
4645 20626
7806 16651
8422 25376
904 1853
18553 22986
13799 16868
21537 29453
5889 10436
22226 27590
9217 24141
7701 27495
2788 19916
10600 11335
9665 24971
1552 19280
12642 2...

output:

30623

result:

ok 1 number(s): "30623"

Test #115:

score: 0
Accepted
time: 66ms
memory: 13100kb

input:

29994 100000
2 9875
4 23561
7 27500
9 7030
10 20663
13 22980
14 26742
19 20007
22 4395
26 5270
31 9665
33 11816
34 27195
36 16461
37 10933
41 1573
42 4639
47 25118
50 19812
51 22239
57 321
61 27034
64 23879
65 23123
66 2382
68 3086
72 28589
74 637
80 14036
83 10984
84 26318
86 14219
87 16610
88 2020...

output:

40432

result:

ok 1 number(s): "40432"

Test #116:

score: 0
Accepted
time: 64ms
memory: 14016kb

input:

29995 100000
918 4492
14385 19559
15086 21176
13221 28874
11244 20060
4592 25478
8250 9687
14558 17242
19413 26702
4588 22938
7599 27897
12832 18485
23751 24916
15300 26459
19920 23358
10739 10978
11523 19092
6427 6658
3999 17160
4935 5940
3934 23644
10760 29830
4799 27803
18922 21724
8380 15261
593...

output:

47580

result:

ok 1 number(s): "47580"

Test #117:

score: 0
Accepted
time: 73ms
memory: 13920kb

input:

29996 100000
13475 27199
2570 17414
11811 13492
4857 26631
16957 20798
6171 16471
15671 22709
1646 14918
11278 23555
21002 29314
8739 17612
8306 11165
12769 29043
6473 17228
15750 29866
18122 28203
6143 20302
20647 22407
7036 24139
253 6341
7638 16673
12813 19079
7515 7560
21069 29288
17335 23336
67...

output:

42240

result:

ok 1 number(s): "42240"

Test #118:

score: 0
Accepted
time: 64ms
memory: 13280kb

input:

29997 100000
18549 22756
3254 12171
5806 24422
26950 27195
3164 10868
5444 18633
15933 18704
556 11532
1352 29654
7656 19182
1374 24109
20582 27694
12636 19959
8290 21465
56 29088
6256 8522
9671 16743
12250 22011
17083 28925
6326 13010
582 17917
11011 25596
232 27419
9063 14129
10586 14601
4745 1888...

output:

52512

result:

ok 1 number(s): "52512"

Test #119:

score: 0
Accepted
time: 64ms
memory: 13352kb

input:

29998 100000
0 25507
1 17565
9 2728
12 20465
13 12119
18 24227
19 19559
20 7365
21 11591
22 12553
27 27652
28 11793
29 3526
33 12747
35 13722
37 9713
38 17380
40 17453
41 512
44 21748
45 15008
47 26412
51 21773
52 2516
55 6429
60 4056
61 21576
64 3473
67 14735
70 10645
71 26705
75 27093
78 19468
82 ...

output:

38530

result:

ok 1 number(s): "38530"

Test #120:

score: 0
Accepted
time: 67ms
memory: 13976kb

input:

29999 100000
2076 5691
6186 23168
6277 7271
4642 20234
623 3627
21176 23745
18025 29594
4732 23602
8849 27973
14111 29075
1324 11153
1911 6246
8655 10650
12176 23143
797 14645
10757 19312
7695 29627
11217 17937
87 16425
6734 11319
7974 28475
6797 7712
10130 25876
20914 22679
15970 25877
332 7332
196...

output:

45171

result:

ok 1 number(s): "45171"

Test #121:

score: 0
Accepted
time: 55ms
memory: 12900kb

input:

30000 100000
1565 5289
5315 17693
18744 28986
3541 22754
14321 15298
20791 24422
20656 23089
7966 22591
4408 22336
11205 15878
3308 10204
12515 22848
18449 21732
564 5733
2053 6297
3327 8449
1288 21908
5384 20218
19032 19648
8033 23785
17228 17880
6921 25596
11756 29231
5376 28181
5069 12707
20700 2...

output:

39534

result:

ok 1 number(s): "39534"

Test #122:

score: 0
Accepted
time: 69ms
memory: 15608kb

input:

99998 100000
1 54346
2 87173
3 30409
7 50220
8 12293
10 98578
11 24214
15 84307
16 7815
21 92990
24 89450
25 72604
27 79225
28 11029
29 11991
31 44486
32 85409
34 80634
38 89578
39 29927
41 18204
42 4678
44 74222
45 86604
46 23879
47 55018
48 92522
50 53414
51 49576
55 32778
57 24415
58 27557
65 851...

output:

0

result:

ok 1 number(s): "0"

Test #123:

score: 0
Accepted
time: 96ms
memory: 15368kb

input:

99999 100000
46767 84345
59882 75061
12955 47777
15168 45531
72646 93793
6461 70956
38556 72014
28931 77117
21766 36701
25599 66281
402 38453
3881 63868
33022 56354
69404 89410
87246 99301
12090 64363
25090 97225
11430 33669
45045 49499
50185 64664
55730 58239
51520 95017
2242 72890
32559 61742
4293...

output:

0

result:

ok 1 number(s): "0"

Test #124:

score: 0
Accepted
time: 83ms
memory: 15764kb

input:

100000 100000
23519 27719
15279 78819
49428 70525
40206 59232
59933 93428
8720 52202
27903 62635
15727 99881
28570 83200
9486 70241
42904 70489
27122 99917
92487 98743
24712 83616
11399 49132
51177 88500
68845 98856
40566 60657
5123 71422
15575 67563
43769 86079
73363 84433
4619 63811
78877 85791
54...

output:

0

result:

ok 1 number(s): "0"