QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#104314#6382. LaLa and Spirit SummoningchenshiAC ✓1408ms3176kbC++2.9kb2023-05-10 01:09:172023-05-10 01:09:21

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-10 01:09:21]
  • 评测
  • 测评结果:AC
  • 用时:1408ms
  • 内存:3176kb
  • [2023-05-10 01:09:17]
  • 提交

answer

//https://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=2C454AA83DC52FE7B02496D6A56F913F?doi=10.1.1.49.8756&rep=rep1&type=pdf
#include<cstdio>
#include<vector>
#include<array>
#include<queue>
using namespace std;
int n,m;vector<int> u,v,c;
struct color{
	vector<int> flg,c;
	color(int m,vector<int> c_):flg(m),c(c_){}
	inline bool chk(int t){return !flg[c[t]];}
	inline void ins(int t){flg[c[t]]=1;}
	inline void clear(){flg.assign(m,0);}
};
struct rigidity{
	int asd;vector<int> u,v,col,lst,frmx,frmt;vector<array<int,2> > pebble;queue<int> qx,qy;
	rigidity(int n,int m,vector<int> u_,vector<int> v_):u(u_),v(v_),col(n),lst(n),frmx(m),frmt(m),pebble(n,{-1,-1}){}
	inline bool push(int x,int y,int t){
		if(pebble[x][t]<0) return true;
		++asd;lst[x]=-1;
		int id=pebble[x][t];
		if((x^u[id]^v[id])==y) return false;
		col[x]=col[y]=col[x^u[id]^v[id]]=asd;
		queue<int>().swap(qx);queue<int>().swap(qy);
		qx.push(x);qy.push(t);
		for(;!qx.empty();qx.pop(),qy.pop()){
			id=pebble[x=qx.front()][t=qy.front()];
			col[y=(x^u[id]^v[id])]=asd;lst[y]=id;
			for(int i=0;i<2;++i){
				if(pebble[y][i]<0){
					for(x=y,t=i;lst[x]>=0;x=y,t=i)
						id=lst[x],y=frmx[id],i=frmt[id],pebble[frmx[id]=x][frmt[id]=t]=id;
					pebble[x][t]=-1;
					return true;
				}
				id=pebble[y][i];
				if(col[y^u[id]^v[id]]^asd) col[y^u[id]^v[id]]=asd,qx.push(y),qy.push(i);
			}
		}
		return false;
	}
	inline bool chk(int t){return push(u[t],v[t],0)&&push(u[t],v[t],1)&&push(v[t],u[t],0)&&push(v[t],u[t],1);}
	inline void ins(int t){push(u[t],v[t],0);pebble[frmx[t]=u[t]][frmt[t]=0]=t;}
	inline void clear(){pebble.assign(n,{-1,-1});}
};
template<class M1,class M2>struct MatroidIntersection{
	int n;M1 m1;M2 m2;vector<int> inI,lst;queue<int> q;
	MatroidIntersection(int n_,M1 m1_,M2 m2_):n(n_),m1(m1_),m2(m2_),inI(n_){}
	inline vector<int> RtoL(int t){
		vector<int> res;
		m1.clear();
		for(int i=0;i<n;++i) if(inI[i]&&i-t) m1.ins(i);
		for(int i=0;i<n;++i) if(!inI[i]&&lst[i]<0&&m1.chk(i)) res.push_back(i),lst[i]=t;
		return res;
	}
	inline int LtoR(int t){
		m2.clear();
		for(int i=0;i<2;++i) for(int j=0;j<n;++j) if((j==t||inI[j])&&(lst[j]<0)==i){
			if(!m2.chk(j))
				if(i){q.push(j);lst[j]=t;return j;}
				else return -1;
			m2.ins(j);
		}
		return n;
	}
	inline bool augment(){
		lst.assign(n,-1);queue<int>().swap(q);
		for(q.push(n);!q.empty();q.pop()) for(auto i:RtoL(q.front())) for(int j;(j=LtoR(i))>=0;) if(j==n){
			for(;i^n;i=lst[i]) inI[i]^=1;
			return true;
		}
		return false;
	}
	inline vector<int> slv(){
		for(int i=0;i<n;++i) if(m1.chk(i)&&m2.chk(i)) inI[i]=1,m1.ins(i),m2.ins(i);
		for(;augment(););
		vector<int> res;
		for(int i=0;i<n;++i) if(inI[i]) res.push_back(i);
		return res;
	}
};
int main(){
	scanf("%d%d",&n,&m);
	u.resize(m);v.resize(m);c.resize(m);
	for(int i=0;i<m;++i) scanf("%d%d%d",&u[i],&v[i],&c[i]);
	printf("%llu",n*2-MatroidIntersection(m,color(m,c),rigidity(n,m,u,v)).slv().size());
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 2972kb

input:

3 3
0 1 0
0 2 0
1 2 0

output:

5

result:

ok 1 number(s): "5"

Test #2:

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

input:

3 3
0 1 0
0 2 1
1 2 2

output:

3

result:

ok 1 number(s): "3"

Test #3:

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

input:

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

output:

4

result:

ok 1 number(s): "4"

Test #4:

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

input:

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

output:

6

result:

ok 1 number(s): "6"

Test #5:

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

input:

2 0

output:

4

result:

ok 1 number(s): "4"

Test #6:

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

input:

2 1
0 1 0

output:

3

result:

ok 1 number(s): "3"

Test #7:

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

input:

2 2
0 1 0
0 1 1

output:

3

result:

ok 1 number(s): "3"

Test #8:

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

input:

2 3
0 1 0
0 1 2
0 1 0

output:

3

result:

ok 1 number(s): "3"

Test #9:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #10:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #11:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #12:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #13:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #14:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #15:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #16:

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

input:

3 0

output:

6

result:

ok 1 number(s): "6"

Test #17:

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

input:

3 1
1 2 0

output:

5

result:

ok 1 number(s): "5"

Test #18:

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

input:

3 2
1 2 1
1 2 1

output:

5

result:

ok 1 number(s): "5"

Test #19:

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

input:

3 3
1 2 2
1 2 1
0 1 1

output:

4

result:

ok 1 number(s): "4"

Test #20:

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

input:

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

output:

4

result:

ok 1 number(s): "4"

Test #21:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #22:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #23:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #24:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #25:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #26:

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

input:

3 10
0 1 9
0 2 4
0 1 0
0 1 9
1 2 4
0 1 9
1 2 9
1 2 5
1 2 5
0 1 0

output:

3

result:

ok 1 number(s): "3"

Test #27:

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

input:

4 0

output:

8

result:

ok 1 number(s): "8"

Test #28:

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

input:

4 1
1 3 0

output:

7

result:

ok 1 number(s): "7"

Test #29:

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

input:

4 2
0 1 0
1 2 0

output:

7

result:

ok 1 number(s): "7"

Test #30:

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

input:

4 3
0 3 0
2 3 1
0 3 1

output:

6

result:

ok 1 number(s): "6"

Test #31:

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

input:

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

output:

6

result:

ok 1 number(s): "6"

Test #32:

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

input:

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

output:

5

result:

ok 1 number(s): "5"

Test #33:

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

input:

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

output:

5

result:

ok 1 number(s): "5"

Test #34:

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

input:

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

output:

4

result:

ok 1 number(s): "4"

Test #35:

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

input:

4 8
0 2 1
0 3 7
1 3 7
2 3 3
1 2 0
2 3 7
1 2 0
2 3 0

output:

4

result:

ok 1 number(s): "4"

Test #36:

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

input:

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

output:

3

result:

ok 1 number(s): "3"

Test #37:

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

input:

4 10
1 2 0
0 2 0
2 3 0
0 1 1
2 3 8
1 2 2
0 3 9
1 3 6
1 2 6
1 2 4

output:

3

result:

ok 1 number(s): "3"

Test #38:

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

input:

5 0

output:

10

result:

ok 1 number(s): "10"

Test #39:

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

input:

5 1
0 4 0

output:

9

result:

ok 1 number(s): "9"

Test #40:

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

input:

5 2
0 3 0
0 3 1

output:

9

result:

ok 1 number(s): "9"

Test #41:

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

input:

5 3
0 2 0
1 4 2
1 2 2

output:

8

result:

ok 1 number(s): "8"

Test #42:

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

input:

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

output:

8

result:

ok 1 number(s): "8"

Test #43:

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

input:

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

output:

7

result:

ok 1 number(s): "7"

Test #44:

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

input:

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

output:

6

result:

ok 1 number(s): "6"

Test #45:

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

input:

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

output:

7

result:

ok 1 number(s): "7"

Test #46:

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

input:

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

output:

4

result:

ok 1 number(s): "4"

Test #47:

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

input:

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

output:

6

result:

ok 1 number(s): "6"

Test #48:

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

input:

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

output:

5

result:

ok 1 number(s): "5"

Test #49:

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

input:

6 0

output:

12

result:

ok 1 number(s): "12"

Test #50:

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

input:

6 1
2 4 0

output:

11

result:

ok 1 number(s): "11"

Test #51:

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

input:

6 2
1 4 1
0 4 0

output:

10

result:

ok 1 number(s): "10"

Test #52:

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

input:

6 3
1 3 1
1 4 2
0 2 0

output:

9

result:

ok 1 number(s): "9"

Test #53:

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

input:

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

output:

10

result:

ok 1 number(s): "10"

Test #54:

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

input:

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

output:

9

result:

ok 1 number(s): "9"

Test #55:

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

input:

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

output:

9

result:

ok 1 number(s): "9"

Test #56:

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

input:

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

output:

7

result:

ok 1 number(s): "7"

Test #57:

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

input:

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

output:

7

result:

ok 1 number(s): "7"

Test #58:

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

input:

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

output:

7

result:

ok 1 number(s): "7"

Test #59:

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

input:

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

output:

7

result:

ok 1 number(s): "7"

Test #60:

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

input:

7 0

output:

14

result:

ok 1 number(s): "14"

Test #61:

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

input:

7 1
0 5 0

output:

13

result:

ok 1 number(s): "13"

Test #62:

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

input:

7 2
2 6 0
5 6 0

output:

13

result:

ok 1 number(s): "13"

Test #63:

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

input:

7 3
5 6 1
0 6 0
2 4 0

output:

12

result:

ok 1 number(s): "12"

Test #64:

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

input:

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

output:

12

result:

ok 1 number(s): "12"

Test #65:

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

input:

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

output:

10

result:

ok 1 number(s): "10"

Test #66:

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

input:

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

output:

10

result:

ok 1 number(s): "10"

Test #67:

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

input:

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

output:

9

result:

ok 1 number(s): "9"

Test #68:

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

input:

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

output:

10

result:

ok 1 number(s): "10"

Test #69:

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

input:

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

output:

8

result:

ok 1 number(s): "8"

Test #70:

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

input:

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

output:

8

result:

ok 1 number(s): "8"

Test #71:

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

input:

8 0

output:

16

result:

ok 1 number(s): "16"

Test #72:

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

input:

8 1
0 3 0

output:

15

result:

ok 1 number(s): "15"

Test #73:

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

input:

8 2
0 6 1
5 7 1

output:

15

result:

ok 1 number(s): "15"

Test #74:

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

input:

8 3
1 6 1
0 3 2
0 2 2

output:

14

result:

ok 1 number(s): "14"

Test #75:

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

input:

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

output:

13

result:

ok 1 number(s): "13"

Test #76:

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

input:

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

output:

12

result:

ok 1 number(s): "12"

Test #77:

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

input:

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

output:

12

result:

ok 1 number(s): "12"

Test #78:

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

input:

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

output:

11

result:

ok 1 number(s): "11"

Test #79:

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

input:

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

output:

10

result:

ok 1 number(s): "10"

Test #80:

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

input:

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

output:

11

result:

ok 1 number(s): "11"

Test #81:

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

input:

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

output:

10

result:

ok 1 number(s): "10"

Test #82:

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

input:

9 0

output:

18

result:

ok 1 number(s): "18"

Test #83:

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

input:

9 1
0 6 0

output:

17

result:

ok 1 number(s): "17"

Test #84:

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

input:

9 2
0 1 0
1 4 0

output:

17

result:

ok 1 number(s): "17"

Test #85:

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

input:

9 3
0 3 2
4 8 2
4 8 2

output:

17

result:

ok 1 number(s): "17"

Test #86:

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

input:

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

output:

15

result:

ok 1 number(s): "15"

Test #87:

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

input:

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

output:

16

result:

ok 1 number(s): "16"

Test #88:

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

input:

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

output:

15

result:

ok 1 number(s): "15"

Test #89:

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

input:

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

output:

14

result:

ok 1 number(s): "14"

Test #90:

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

input:

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

output:

14

result:

ok 1 number(s): "14"

Test #91:

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

input:

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

output:

13

result:

ok 1 number(s): "13"

Test #92:

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

input:

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

output:

11

result:

ok 1 number(s): "11"

Test #93:

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

input:

10 0

output:

20

result:

ok 1 number(s): "20"

Test #94:

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

input:

10 1
3 4 0

output:

19

result:

ok 1 number(s): "19"

Test #95:

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

input:

10 2
3 9 0
3 9 1

output:

19

result:

ok 1 number(s): "19"

Test #96:

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

input:

10 3
2 5 1
1 5 0
8 9 0

output:

18

result:

ok 1 number(s): "18"

Test #97:

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

input:

10 4
2 5 1
1 7 3
5 6 2
3 6 2

output:

17

result:

ok 1 number(s): "17"

Test #98:

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

input:

10 5
1 9 0
1 9 0
0 8 4
5 9 3
5 6 4

output:

17

result:

ok 1 number(s): "17"

Test #99:

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

input:

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

output:

16

result:

ok 1 number(s): "16"

Test #100:

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

input:

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

output:

15

result:

ok 1 number(s): "15"

Test #101:

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

input:

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

output:

14

result:

ok 1 number(s): "14"

Test #102:

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

input:

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

output:

14

result:

ok 1 number(s): "14"

Test #103:

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

input:

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

output:

14

result:

ok 1 number(s): "14"

Test #104:

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

input:

200 200
20 56 24
7 129 170
89 143 66
182 187 59
1 192 60
9 181 125
164 165 175
131 195 90
118 159 152
31 46 182
74 85 3
79 97 145
66 186 161
69 93 67
102 153 82
108 194 174
67 123 59
130 171 127
159 187 65
17 54 125
138 153 92
188 199 168
30 175 165
39 96 18
58 61 191
109 156 65
181 195 1
173 183 58...

output:

264

result:

ok 1 number(s): "264"

Test #105:

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

input:

200 400
6 148 31
37 91 362
22 116 182
168 173 279
140 149 370
55 176 208
96 115 21
65 109 58
52 180 342
46 112 203
97 116 237
151 187 77
63 151 132
35 49 75
115 120 151
188 197 194
13 138 68
32 40 113
60 69 284
127 151 73
189 194 351
125 191 188
103 166 355
79 174 161
57 149 158
15 185 238
39 52 343...

output:

131

result:

ok 1 number(s): "131"

Test #106:

score: 0
Accepted
time: 675ms
memory: 3056kb

input:

200 600
175 194 1
153 196 511
82 94 559
89 133 81
136 182 584
190 194 340
102 116 208
176 196 205
76 153 578
164 176 238
35 187 356
97 151 178
47 64 166
100 162 300
67 157 441
179 192 413
118 186 25
11 26 93
42 163 388
82 107 327
30 117 266
156 170 87
160 195 445
195 196 460
97 169 224
95 111 424
19...

output:

32

result:

ok 1 number(s): "32"

Test #107:

score: 0
Accepted
time: 880ms
memory: 3060kb

input:

200 800
122 187 20
94 196 260
141 150 535
10 149 283
132 163 47
126 176 71
109 177 44
110 180 704
100 194 767
83 171 673
149 179 124
67 115 230
31 98 599
142 183 77
20 34 682
147 156 184
25 32 781
189 193 521
46 57 92
37 180 229
70 179 181
188 199 785
17 197 182
113 156 311
113 197 291
176 190 258
1...

output:

13

result:

ok 1 number(s): "13"

Test #108:

score: 0
Accepted
time: 418ms
memory: 3140kb

input:

200 1000
184 193 429
135 150 202
15 155 569
84 189 84
106 176 82
168 192 364
126 169 236
100 182 42
175 196 660
21 109 64
51 145 994
174 198 829
111 180 136
16 194 734
12 126 609
96 141 637
45 77 165
181 183 228
59 169 689
164 170 88
8 63 249
117 121 904
0 17 192
39 156 84
196 198 860
29 51 256
108 ...

output:

6

result:

ok 1 number(s): "6"

Test #109:

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

input:

200 200
161 179 158
126 174 172
170 177 70
182 197 69
145 169 191
73 90 172
96 113 104
16 102 80
3 7 107
179 199 183
36 82 196
141 162 145
22 163 105
110 122 137
43 86 194
105 187 101
123 130 64
94 158 83
158 187 159
90 175 148
74 181 53
63 105 67
93 192 18
94 175 164
69 140 64
131 140 143
64 190 15...

output:

267

result:

ok 1 number(s): "267"

Test #110:

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

input:

200 400
146 182 165
179 194 364
81 167 387
168 181 289
85 162 301
119 123 256
28 33 197
126 149 49
160 167 249
194 196 4
59 153 382
190 194 325
19 91 228
76 150 346
78 193 214
186 193 369
92 190 120
19 28 21
59 172 377
0 75 248
149 179 113
198 199 136
143 169 209
134 168 107
45 136 231
14 87 164
121...

output:

146

result:

ok 1 number(s): "146"

Test #111:

score: 0
Accepted
time: 833ms
memory: 3060kb

input:

200 600
116 174 135
96 187 313
140 177 563
89 149 443
81 124 164
32 84 387
34 110 185
60 155 596
161 188 86
136 188 238
173 181 349
160 198 377
3 64 310
141 155 523
8 61 104
153 160 541
197 198 29
197 199 249
63 68 481
155 170 350
189 196 27
30 194 34
0 112 299
52 193 558
84 160 297
95 114 550
103 1...

output:

35

result:

ok 1 number(s): "35"

Test #112:

score: 0
Accepted
time: 988ms
memory: 3120kb

input:

200 800
63 70 554
37 182 662
1 117 339
186 191 245
77 81 778
167 183 519
41 100 621
193 196 695
185 196 322
55 140 473
111 133 668
106 189 77
186 199 344
183 193 348
160 163 345
144 155 760
104 169 785
177 190 478
67 103 186
110 158 404
7 71 342
62 190 333
57 92 436
169 185 609
100 127 12
0 13 536
6...

output:

7

result:

ok 1 number(s): "7"

Test #113:

score: 0
Accepted
time: 688ms
memory: 3076kb

input:

200 1000
125 182 915
78 140 4
96 143 773
61 133 694
51 182 213
10 186 212
58 119 612
183 191 432
60 83 215
192 194 217
189 193 338
14 93 277
67 123 680
57 123 5
152 176 472
93 164 564
101 134 369
146 176 584
80 184 535
60 153 511
144 177 210
14 39 451
63 81 46
95 130 982
184 197 581
29 50 982
14 20 ...

output:

5

result:

ok 1 number(s): "5"

Test #114:

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

input:

200 200
102 121 93
69 105 127
29 131 75
160 194 79
89 113 170
114 120 20
29 55 80
99 191 71
111 167 14
150 174 183
174 176 141
180 192 144
177 187 49
151 198 8
7 44 57
79 132 77
3 153 68
82 121 191
179 186 4
163 183 124
34 56 14
136 143 14
132 134 72
150 197 62
56 176 186
131 139 69
147 197 61
131 1...

output:

273

result:

ok 1 number(s): "273"

Test #115:

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

input:

200 400
88 122 251
99 164 319
139 193 191
169 187 251
29 39 232
160 170 304
159 196 326
11 126 39
46 163 204
165 171 204
21 73 175
30 33 125
174 199 372
117 158 168
19 144 277
183 187 97
148 187 124
7 85 377
80 157 22
73 138 71
85 146 274
72 146 83
183 188 63
190 193 5
55 89 352
14 25 42
4 119 203
7...

output:

148

result:

ok 1 number(s): "148"

Test #116:

score: 0
Accepted
time: 753ms
memory: 3048kb

input:

200 600
58 190 270
39 43 468
22 118 567
67 180 453
25 156 95
96 174 435
166 169 162
144 191 386
69 168 441
84 169 239
135 199 94
0 128 225
158 165 206
182 183 393
171 178 367
150 177 316
54 63 33
185 192 157
84 165 327
28 84 125
125 191 389
104 146 581
40 185 400
107 189 56
71 97 19
118 181 428
185 ...

output:

29

result:

ok 1 number(s): "29"

Test #117:

score: 0
Accepted
time: 1130ms
memory: 3124kb

input:

200 800
4 29 288
155 162 265
82 100 144
187 191 655
21 54 358
9 12 519
172 178 397
55 193 685
93 95 229
3 57 274
50 69 413
168 173 277
119 161 88
25 101 618
123 171 8
141 179 87
159 176 790
164 165 786
65 99 631
182 193 228
165 186 503
158 167 680
120 189 690
25 103 555
88 134 85
198 199 461
168 171...

output:

8

result:

ok 1 number(s): "8"

Test #118:

score: 0
Accepted
time: 920ms
memory: 3056kb

input:

200 1000
66 137 49
197 198 807
155 168 330
62 173 304
194 196 992
51 197 59
190 196 989
45 162 823
168 189 122
164 166 17
151 185 331
53 112 76
23 162 224
98 154 627
115 153 336
68 191 139
180 198 573
133 178 292
101 165 28
133 193 286
104 189 172
87 100 998
103 124 900
150 151 528
171 197 654
51 14...

output:

4

result:

ok 1 number(s): "4"

Test #119:

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

input:

200 200
44 181 179
11 99 130
87 134 31
160 166 41
34 79 101
155 196 20
160 174 57
160 187 61
196 199 169
122 164 135
136 178 86
21 52 192
133 161 193
191 195 30
147 163 120
77 104 4
58 178 72
69 198 148
1 172 50
36 125 147
170 177 128
33 182 161
195 196 126
6 63 160
43 78 59
131 138 147
53 152 15
19...

output:

275

result:

ok 1 number(s): "275"

Test #120:

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

input:

200 400
29 167 385
42 160 322
21 84 396
146 193 261
173 197 163
2 6 304
92 123 103
71 144 30
153 180 111
137 196 5
159 169 319
93 194 372
129 176 116
158 169 39
182 195 388
157 192 224
5 47 129
193 198 285
101 189 68
146 155 247
45 163 35
169 179 30
47 191 317
69 156 303
43 132 26
36 119 368
110 160...

output:

149

result:

ok 1 number(s): "149"

Test #121:

score: 0
Accepted
time: 909ms
memory: 3028kb

input:

200 600
198 199 404
158 160 271
80 115 572
67 171 463
169 177 26
137 163 235
98 113 138
5 10 177
177 198 548
56 173 239
97 122 439
39 156 424
114 167 350
1 116 264
111 152 30
148 155 443
110 142 37
172 182 313
106 160 172
101 115 149
62 177 150
1 86 529
103 144 254
186 192 402
59 164 340
117 195 554...

output:

20

result:

ok 1 number(s): "20"

Test #122:

score: 0
Accepted
time: 995ms
memory: 3072kb

input:

200 800
145 159 22
98 187 220
140 171 748
187 197 617
165 199 289
73 95 167
104 172 174
138 158 676
178 197 584
174 185 74
11 108 158
8 118 125
75 148 632
66 131 441
64 157 472
115 189 214
16 184 794
151 161 742
87 171 277
56 178 403
102 124 664
32 172 227
160 179 592
104 144 53
98 166 607
198 199 7...

output:

8

result:

ok 1 number(s): "8"

Test #123:

score: 0
Accepted
time: 763ms
memory: 3064kb

input:

200 1000
8 26 183
140 181 962
14 72 534
62 72 266
139 193 123
92 194 907
122 190 718
128 137 213
77 136 677
135 167 818
113 148 676
115 146 524
177 180 768
139 196 898
56 103 199
65 143 67
37 128 777
121 159 0
123 156 874
7 60 710
40 112 133
160 190 545
166 174 753
30 36 426
159 196 376
51 196 786
1...

output:

6

result:

ok 1 number(s): "6"

Test #124:

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

input:

200 200
184 197 113
130 182 85
169 186 36
160 184 51
2 117 32
196 197 68
115 197 34
45 128 52
105 127 76
94 172 136
98 104 31
60 157 192
89 134 137
33 129 101
87 137 183
51 187 131
114 191 76
34 161 56
23 154 143
132 135 122
129 168 89
106 163 109
36 71 28
62 153 106
31 169 180
130 147 73
135 187 12...

output:

276

result:

ok 1 number(s): "276"

Test #125:

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

input:

200 400
170 180 120
161 180 277
79 115 200
146 169 271
118 187 142
43 152 352
47 146 279
155 190 20
39 172 66
109 161 205
121 162 64
132 176 172
85 137 260
0 43 309
122 195 52
154 195 399
60 100 133
157 189 241
123 187 161
19 177 70
181 192 196
43 162 377
87 194 171
125 150 249
30 138 147
36 58 246
...

output:

163

result:

ok 1 number(s): "163"

Test #126:

score: 0
Accepted
time: 383ms
memory: 3028kb

input:

200 600
140 147 538
101 121 426
139 157 576
44 122 225
114 129 557
178 182 283
30 56 115
89 189 567
63 181 303
28 179 240
36 78 184
101 184 272
70 183 494
42 87 486
75 83 293
122 142 570
166 176 289
137 165 221
127 171 266
174 194 524
22 155 511
74 162 476
143 179 108
42 75 500
46 114 414
117 160 43...

output:

30

result:

ok 1 number(s): "30"

Test #127:

score: 0
Accepted
time: 680ms
memory: 3160kb

input:

200 800
86 160 109
18 143 623
198 199 105
164 193 227
133 171 220
114 139 614
36 191 303
0 92 666
87 141 491
146 177 674
172 194 703
48 168 324
31 176 728
107 166 711
5 88 135
113 156 789
95 174 798
116 184 250
108 178 370
129 199 226
62 162 26
106 171 126
1 130 45
159 172 351
85 149 680
197 198 665...

output:

13

result:

ok 1 number(s): "13"

Test #128:

score: 0
Accepted
time: 506ms
memory: 3068kb

input:

200 1000
148 195 317
60 192 765
95 166 739
39 113 876
84 158 255
133 185 107
54 133 94
189 194 604
162 198 584
107 128 618
52 86 21
155 178 323
133 163 664
180 189 168
20 86 710
62 111 994
92 100 629
108 198 356
144 161 719
79 174 485
0 50 94
35 142 92
7 147 607
85 196 324
146 183 97
50 95 864
86 14...

output:

8

result:

ok 1 number(s): "8"

Test #129:

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

input:

200 200
125 154 47
73 158 88
28 146 40
138 180 13
145 197 11
38 124 116
47 196 10
105 182 42
190 198 31
66 128 136
59 73 176
122 174 39
45 78 33
74 142 123
51 128 46
48 72 106
193 196 80
21 145 12
44 70 189
6 114 98
66 107 50
180 193 56
76 96 82
117 193 4
18 184 102
130 149 150
42 78 27
132 174 128
...

output:

272

result:

ok 1 number(s): "272"

Test #130:

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

input:

200 400
111 127 254
104 148 280
160 165 4
124 168 233
62 80 73
84 186 399
178 186 56
39 99 11
147 184 373
81 89 5
83 92 209
171 198 372
41 64 4
41 115 132
86 106 115
151 187 126
139 187 137
145 147 149
144 174 207
92 153 245
140 148 310
116 139 324
127 133 24
180 188 147
17 70 269
36 150 172
75 129 ...

output:

158

result:

ok 1 number(s): "158"

Test #131:

score: 0
Accepted
time: 710ms
memory: 3024kb

input:

200 600
81 180 72
21 184 229
21 184 581
45 174 235
58 148 136
20 92 331
161 194 92
149 155 358
171 185 410
0 87 240
197 199 529
140 178 472
25 176 38
83 97 357
16 26 556
119 120 97
45 188 294
124 151 378
148 185 111
47 199 547
157 172 272
148 176 423
7 198 562
98 100 598
57 198 135
116 196 557
58 15...

output:

26

result:

ok 1 number(s): "26"

Test #132:

score: 0
Accepted
time: 1081ms
memory: 3052kb

input:

200 800
28 111 643
160 177 578
80 129 709
165 169 189
77 94 151
155 187 262
167 175 79
84 102 657
172 192 47
118 138 475
111 187 448
87 179 172
186 195 472
148 190 182
167 198 598
87 196 117
151 165 2
103 188 558
130 165 16
2 48 402
197 199 187
179 191 473
64 110 299
16 97 297
73 136 401
197 198 143...

output:

9

result:

ok 1 number(s): "9"

Test #133:

score: 0
Accepted
time: 634ms
memory: 3044kb

input:

200 1000
90 132 452
3 181 920
153 157 943
40 146 838
28 84 34
174 189 955
185 189 471
73 151 994
71 97 139
79 145 418
14 40 366
194 195 123
89 141 208
22 117 791
159 164 573
36 171 569
148 180 833
72 187 64
165 182 213
152 192 908
136 164 55
131 194 640
47 150 461
141 156 870
157 188 170
50 74 589
1...

output:

7

result:

ok 1 number(s): "7"

Test #134:

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

input:

200 200
67 153 181
192 196 43
109 124 44
138 187 23
90 130 143
79 182 164
178 199 187
189 199 33
99 124 139
38 192 137
197 199 120
161 176 39
177 179 178
115 144 194
191 198 109
45 116 33
50 100 84
8 90 120
66 166 34
78 185 121
26 100 11
54 196 3
139 198 135
173 198 102
29 137 175
129 132 76
124 160...

output:

274

result:

ok 1 number(s): "274"

Test #135:

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

input:

200 400
53 90 388
23 173 234
20 178 209
124 160 243
7 91 4
125 152 47
110 139 233
100 192 1
33 175 329
53 134 206
45 137 354
11 18 219
196 199 149
82 188 2
27 50 178
126 178 253
195 198 141
132 186 105
166 173 300
165 183 69
77 143 71
190 195 272
190 193 278
37 164 45
28 170 342
35 66 50
181 190 276...

output:

143

result:

ok 1 number(s): "143"

Test #136:

score: 0
Accepted
time: 872ms
memory: 3040kb

input:

200 600
23 115 558
163 168 32
79 123 585
45 47 597
26 119 67
61 198 379
116 135 68
34 159 148
57 111 517
171 186 240
159 197 273
180 187 319
180 191 182
124 160 227
178 195 219
116 153 473
101 193 298
111 185 286
170 175 205
120 166 323
117 154 34
45 158 370
47 121 416
153 154 344
44 122 208
116 155...

output:

26

result:

ok 1 number(s): "26"

Test #137:

score: 0
Accepted
time: 1408ms
memory: 3116kb

input:

200 800
168 197 377
80 103 181
139 157 513
142 193 599
22 145 530
197 198 710
99 158 656
144 184 647
81 96 754
90 103 275
73 160 193
149 182 371
142 189 216
189 190 4
108 171 261
84 127 244
8 179 6
90 92 514
151 162 109
75 110 225
157 166 348
76 180 21
103 122 553
71 82 595
60 122 475
196 197 69
122...

output:

10

result:

ok 1 number(s): "10"

Test #138:

score: 0
Accepted
time: 831ms
memory: 3040kb

input:

200 1000
31 98 938
122 129 722
12 51 147
17 73 448
172 178 165
16 53 803
117 198 847
157 185 385
156 172 46
51 194 219
174 181 711
34 171 571
45 66 752
39 97 61
123 143 436
33 182 496
28 176 38
60 122 420
187 191 58
26 156 684
95 127 17
5 179 187
110 168 963
196 199 768
144 169 892
49 94 667
74 191 ...

output:

8

result:

ok 1 number(s): "8"

Test #139:

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

input:

200 200
8 105 116
135 192 45
167 185 49
115 127 185
35 180 74
121 133 11
110 137 164
50 81 23
183 188 46
9 36 137
159 168 65
1 178 86
132 175 122
156 194 64
154 159 172
19 52 161
106 176 137
195 199 76
87 161 128
151 163 96
161 171 173
150 158 150
179 189 189
29 114 48
16 192 96
152 191 154
8 111 88...

output:

272

result:

ok 1 number(s): "272"

Test #140:

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

input:

200 400
193 197 74
165 199 237
78 126 13
124 173 205
151 196 384
167 173 95
42 91 9
183 199 392
141 187 236
24 135 6
183 199 99
73 96 19
152 193 293
123 196 273
167 177 241
123 138 29
52 77 145
97 127 13
187 190 346
38 43 244
37 78 232
87 120 219
31 148 180
92 140 391
15 184 63
35 120 375
64 95 230
...

output:

152

result:

ok 1 number(s): "152"

Test #141:

score: 0
Accepted
time: 1146ms
memory: 3064kb

input:

200 600
163 185 93
83 186 186
137 142 342
22 49 7
170 180 598
103 163 178
48 108 397
94 164 539
165 179 272
142 179 241
121 168 18
20 114 519
113 175 327
165 168 450
119 138 483
91 191 0
157 166 302
76 133 442
168 182 50
192 195 346
54 105 395
118 153 317
87 188 269
10 92 442
31 56 530
115 194 561
4...

output:

24

result:

ok 1 number(s): "24"

Test #142:

score: 0
Accepted
time: 818ms
memory: 3176kb

input:

200 800
110 122 111
23 125 135
197 198 318
142 196 209
166 198 461
39 57 710
55 69 432
29 68 638
165 184 309
61 71 75
35 102 386
188 195 219
97 124 760
31 100 275
72 79 372
81 157 19
63 195 458
55 182 22
172 173 554
148 149 400
94 171 509
149 194 368
143 173 7
127 136 93
48 81 196
196 197 347
28 129...

output:

8

result:

ok 1 number(s): "8"

Test #143:

score: 0
Accepted
time: 376ms
memory: 3004kb

input:

200 1000
172 194 72
65 117 877
94 100 352
17 121 410
117 190 296
58 84 650
72 82 224
19 165 775
64 85 601
23 43 19
113 166 56
96 146 370
1 10 296
80 133 684
64 101 299
31 149 423
84 180 242
47 74 128
9 105 551
98 143 107
32 45 978
79 124 734
150 168 817
53 94 666
131 180 965
49 170 393
157 194 499
8...

output:

5

result:

ok 1 number(s): "5"

Test #144:

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

input:

200 200
149 179 2
55 195 0
26 91 53
116 142 195
179 185 5
162 190 11
42 46 140
134 174 14
92 106 1
180 186 137
121 144 10
64 85 86
88 106 66
197 199 87
95 123 36
17 39 136
161 185 141
159 192 184
108 123 173
25 161 120
121 181 134
25 199 98
20 92 43
85 171 146
4 16 170
151 175 80
113 115 42
133 143 ...

output:

275

result:

ok 1 number(s): "275"

Test #145:

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

input:

200 400
135 151 208
108 139 192
159 198 218
102 169 215
118 140 315
9 176 95
173 182 186
45 146 382
50 71 191
195 196 206
145 154 244
113 186 266
108 162 389
164 185 95
130 173 304
97 124 156
131 144 150
84 115 322
9 48 391
111 194 67
172 184 393
160 166 166
71 95 34
148 161 289
3 47 137
34 131 253
...

output:

143

result:

ok 1 number(s): "143"

Test #146:

score: 0
Accepted
time: 735ms
memory: 3072kb

input:

200 600
104 140 227
25 102 589
20 179 346
23 160 369
114 163 178
144 193 226
179 183 373
178 186 329
50 184 379
114 167 241
60 111 11
82 88 118
69 148 471
7 63 320
83 180 146
88 168 127
37 79 306
63 124 350
189 195 496
66 76 121
13 128 156
191 192 265
150 157 123
66 74 540
19 51 3
138 176 439
129 19...

output:

27

result:

ok 1 number(s): "27"

Test #147:

score: 0
Accepted
time: 655ms
memory: 3080kb

input:

200 800
51 77 645
165 185 538
79 123 122
120 121 171
110 117 392
80 177 358
186 192 209
112 127 628
74 158 216
33 148 676
196 197 131
28 124 419
53 58 505
49 63 97
13 40 35
55 132 146
142 167 463
42 194 778
194 198 200
21 197 224
53 195 671
24 193 715
7 144 261
182 188 39
58 128 717
20 114 273
111 1...

output:

11

result:

ok 1 number(s): "11"

Test #148:

score: 0
Accepted
time: 581ms
memory: 3064kb

input:

200 1000
113 123 206
7 40 680
152 153 556
18 151 20
61 103 427
122 140 498
4 100 601
102 157 166
149 178 508
193 198 819
75 194 400
135 154 818
156 169 841
121 172 954
5 28 162
5 103 999
140 173 446
12 153 484
8 141 397
171 196 882
191 197 939
175 192 281
189 199 670
108 180 212
119 163 687
72 154 4...

output:

5

result:

ok 1 number(s): "5"

Test #149:

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

input:

200 200
90 183 136
197 199 3
108 121 58
116 170 5
123 146 184
4 28 59
173 180 69
18 134 4
1 75 108
152 197 138
60 181 3
103 172 134
44 194 10
39 62 157
59 74 99
14 172 63
41 54 145
147 182 92
130 177 66
97 185 95
58 104 95
98 186 45
83 195 97
163 191 44
190 198 91
151 194 158
195 196 148
1 148 5
40 ...

output:

269

result:

ok 1 number(s): "269"

Test #150:

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

input:

200 400
76 125 342
28 30 195
18 62 22
102 143 177
63 167 246
50 97 143
105 157 362
128 185 373
134 188 98
167 181 7
107 150 37
152 154 66
64 68 133
5 130 366
71 110 367
94 167 283
186 195 202
71 194 278
31 121 85
184 193 243
109 120 155
34 85 113
133 170 287
4 120 187
189 198 258
57 162 179
53 86 90...

output:

151

result:

ok 1 number(s): "151"

Test #151:

score: 0
Accepted
time: 982ms
memory: 3020kb

input:

200 600
46 145 361
167 171 144
78 178 350
0 102 379
59 183 109
185 187 274
112 167 350
63 96 120
158 182 134
86 119 242
22 41 356
121 192 566
25 172 15
47 123 543
24 199 409
85 166 502
93 116 310
50 196 506
12 165 589
139 193 145
149 187 517
66 102 212
190 193 225
121 151 286
29 166 324
138 173 565
...

output:

28

result:

ok 1 number(s): "28"

Test #152:

score: 0
Accepted
time: 891ms
memory: 3032kb

input:

200 800
192 194 731
85 134 493
137 195 727
120 144 581
55 144 771
121 145 6
118 187 786
173 197 619
182 189 571
5 189 476
135 145 675
90 158 266
9 141 249
89 145 368
175 184 498
53 146 273
198 199 467
30 185 286
16 136 293
94 125 399
189 198 32
97 166 262
47 107 514
39 45 337
45 196 791
19 149 551
1...

output:

7

result:

ok 1 number(s): "7"

Test #153:

score: 0
Accepted
time: 849ms
memory: 3068kb

input:

200 1000
55 154 340
126 129 835
34 187 761
194 195 630
29 111 206
163 187 698
135 159 977
163 196 556
58 84 64
165 175 620
37 72 745
175 197 617
112 167 385
162 181 224
167 190 26
2 138 926
20 36 650
198 199 193
29 78 242
45 150 306
127 180 900
49 63 829
53 178 524
164 179 110
129 178 760
71 72 197
...

output:

8

result:

ok 1 number(s): "8"