QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#751301#8650. Island Hopping275307894a100 ✓6ms3964kbC++141.3kb2024-11-15 18:01:162024-11-15 18:01:17

Judging History

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

  • [2024-11-15 18:01:17]
  • 评测
  • 测评结果:100
  • 用时:6ms
  • 内存:3964kb
  • [2024-11-15 18:01:16]
  • 提交

answer

#include "island.h"
#include<bits/stdc++.h>
#define Gc() getchar()
#define Me(x,y) memset(x,y,sizeof(x))
#define Mc(x,y) memcpy(x,y,sizeof(x))
#define d(x,y) ((m)*(x-1)+(y))
#define R(n) (rnd()%(n)+1)
#define Pc(x) putchar(x)
#define LB lower_bound
#define UB upper_bound
#define fi first
#define se second
#define eb emplace_back
#define all(x) x.begin(),x.end()
using namespace std;using ll=long long;using db=double;using lb=long db;using ui=unsigned;using ull=unsigned long long;using pii=pair<int,int>;
const int N=1e5+5,M=N*4+5,K=1000+5,mod=1e9+7,Mod=mod-1;const db eps=1e-9;const int INF=1e9+7;mt19937 rnd(28382);
#define Tp template<typename T>
#define Ts template<typename T,typename... Ar>
namespace Debug{
	Tp void _debug(char* f,T t){cerr<<f<<'='<<t<<endl;}
	Ts void _debug(char* f,T x,Ar... y){while(*f!=',') cerr<<*f++;cerr<<'='<<x<<",";_debug(f+1,y...);}
	#ifdef LOCAL
	#define gdb(...) _debug((char*)#__VA_ARGS__,__VA_ARGS__)
	#else 
	#define gdb(...) void()
	#endif
}using namespace Debug;
int n,vis[N];
void solve(int nn, int lim) {
	n=nn;vis[1]=1;
	for(int i=1;i<n;i++){
		int x=query(1,i);
		if(!vis[x]){
			for(int j=1;;j++){
				int y=query(x,j);gdb(x,y);
				answer(y,x);
				if(vis[y])break;
				vis[y]=1;
			}
			vis[x]=1;
		}
	}
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 2
Accepted

Test #1:

score: 2
Accepted
time: 1ms
memory: 3772kb

input:

3 9
3
1
0
2
3
0

output:

1 1
3 1
-1 3
1 2
2 1
-2 3
0 0

result:

ok 

Test #2:

score: 2
Accepted
time: 1ms
memory: 3772kb

input:

3 9
3
1
0
2
3
0

output:

1 1
3 1
-1 3
1 2
2 1
-2 3
0 0

result:

ok 

Test #3:

score: 2
Accepted
time: 1ms
memory: 3780kb

input:

3 9
2
1
0
3
2
0

output:

1 1
2 1
-1 2
1 2
3 1
-2 3
0 0

result:

ok 

Subtask #2:

score: 4
Accepted

Test #4:

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

input:

299 89401
79
1
0
213
1
0
20
89
0
213
0
253
77
0
79
0
77
89
93
77
0
221
89
0
164
75
0
221
0
256
93
0
75
208
211
0
256
0
152
75
0
211
237
68
0
211
0
298
152
0
68
233
5
0
298
0
5
210
68
0
99
5
0
283
210
0
178
52
0
99
0
240
171
0
283
0
52
171
185
52
0
281
140
0
171
0
140
296
185
0
205
230
0
296
0
248
14...

output:

1 1
79 1
-1 79
1 2
213 1
-1 213
1 3
20 1
-20 89
20 2
-20 213
1 4
253 1
-77 253
253 2
-79 253
1 5
1 6
1 7
93 1
-77 93
1 8
221 1
-89 221
1 9
164 1
-75 164
164 2
-164 221
1 10
256 1
-93 256
1 11
1 12
208 1
-208 211
208 2
-208 256
1 13
152 1
-75 152
1 14
1 15
237 1
-68 237
237 2
-211 237
1 16
298 1
-152...

result:

ok 

Test #5:

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

input:

300 90000
15
1
0
220
1
0
55
27
0
220
0
199
15
0
27
123
90
0
199
0
90
163
27
0
151
91
0
163
0
208
11
0
90
0
11
91
56
91
0
79
11
0
139
56
0
205
79
0
105
52
0
205
0
222
139
0
52
265
23
0
222
0
23
75
52
0
185
23
0
209
75
0
76
112
0
209
0
299
47
0
185
0
47
112
141
47
0
290
112
0
130
2
0
290
0
155
141
0
2...

output:

1 1
15 1
-1 15
1 2
220 1
-1 220
1 3
55 1
-27 55
55 2
-55 220
1 4
199 1
-15 199
1 5
1 6
123 1
-90 123
123 2
-123 199
1 7
1 8
163 1
-27 163
1 9
151 1
-91 151
151 2
-151 163
1 10
208 1
-11 208
208 2
-90 208
1 11
1 12
1 13
56 1
-56 91
1 14
79 1
-11 79
1 15
139 1
-56 139
1 16
205 1
-79 205
1 17
105 1
-52...

result:

ok 

Test #6:

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

input:

300 90000
171
1
0
201
1
0
22
57
0
171
0
37
136
0
201
0
57
136
191
58
0
136
0
250
4
0
57
0
4
58
17
4
0
180
58
0
111
36
0
180
0
272
17
0
36
42
139
0
272
0
21
36
0
139
130
139
0
237
21
0
69
234
0
237
0
199
130
0
234
244
199
0
222
89
0
234
0
286
232
0
244
0
89
232
102
232
0
268
89
0
115
160
0
268
0
274
...

output:

1 1
171 1
-1 171
1 2
201 1
-1 201
1 3
22 1
-22 57
22 2
-22 171
1 4
37 1
-37 136
37 2
-37 201
1 5
1 6
1 7
191 1
-58 191
191 2
-136 191
1 8
250 1
-4 250
250 2
-57 250
1 9
1 10
1 11
17 1
-4 17
1 12
180 1
-58 180
1 13
111 1
-36 111
111 2
-111 180
1 14
272 1
-17 272
1 15
1 16
42 1
-42 139
42 2
-42 272
1 ...

result:

ok 

Test #7:

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

input:

300 90000
176
1
0
297
1
0
55
275
0
297
0
135
63
0
176
0
63
275
99
267
0
275
0
296
63
0
258
278
0
296
0
267
186
179
0
267
0
278
178
243
0
278
0
179
98
179
0
243
118
40
0
243
0
184
98
0
40
123
184
0
239
40
0
280
123
0
159
279
0
280
0
180
239
0
268
89
0
180
0
279
89
127
166
0
279
0
134
89
0
166
18
90
0...

output:

1 1
176 1
-1 176
1 2
297 1
-1 297
1 3
55 1
-55 275
55 2
-55 297
1 4
135 1
-63 135
135 2
-135 176
1 5
1 6
1 7
99 1
-99 267
99 2
-99 275
1 8
296 1
-63 296
1 9
258 1
-258 278
258 2
-258 296
1 10
1 11
186 1
-179 186
186 2
-186 267
1 12
1 13
178 1
-178 243
178 2
-178 278
1 14
1 15
98 1
-98 179
1 16
1 17
...

result:

ok 

Test #8:

score: 4
Accepted
time: 3ms
memory: 3828kb

input:

300 90000
96
1
0
162
1
0
26
162
0
255
96
0
195
26
0
287
215
0
255
0
32
104
0
195
0
215
104
267
27
0
215
0
27
189
104
0
118
27
0
136
189
0
256
52
0
136
0
263
77
0
118
0
52
77
22
77
0
273
52
0
171
22
0
179
137
0
273
0
137
143
171
0
240
143
0
269
86
0
137
0
86
285
240
0
51
86
0
279
105
0
285
0
105
297
...

output:

1 1
96 1
-1 96
1 2
162 1
-1 162
1 3
26 1
-26 162
1 4
255 1
-96 255
1 5
195 1
-26 195
1 6
287 1
-215 287
287 2
-255 287
1 7
32 1
-32 104
32 2
-32 195
1 8
1 9
1 10
267 1
-27 267
267 2
-215 267
1 11
1 12
189 1
-104 189
1 13
118 1
-27 118
1 14
136 1
-136 189
1 15
256 1
-52 256
256 2
-136 256
1 16
263 1
...

result:

ok 

Subtask #3:

score: 7
Accepted

Test #9:

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

input:

299 598
43
1
0
151
1
0
66
43
0
284
151
0
128
66
0
188
238
0
284
0
238
278
128
0
70
22
0
238
0
183
141
0
278
0
22
141
144
22
0
236
141
0
134
144
0
201
236
0
273
134
0
296
201
0
180
62
0
273
0
263
165
0
296
0
62
165
146
30
0
62
0
277
165
0
30
230
277
0
140
30
0
294
110
0
230
0
89
140
0
110
153
24
0
11...

output:

1 1
43 1
-1 43
1 2
151 1
-1 151
1 3
66 1
-43 66
1 4
284 1
-151 284
1 5
128 1
-66 128
1 6
188 1
-188 238
188 2
-188 284
1 7
1 8
278 1
-128 278
1 9
70 1
-22 70
70 2
-70 238
1 10
183 1
-141 183
183 2
-183 278
1 11
1 12
1 13
144 1
-22 144
1 14
236 1
-141 236
1 15
134 1
-134 144
1 16
201 1
-201 236
1 17
...

result:

ok 

Test #10:

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

input:

300 600
26
1
0
95
1
0
80
26
0
99
95
0
41
80
0
295
99
0
150
41
0
182
143
0
295
0
117
150
0
143
151
104
0
143
0
278
117
0
104
252
36
0
278
0
36
162
104
0
211
162
0
264
36
0
112
21
0
264
0
246
165
0
211
0
21
165
14
165
0
200
21
0
185
89
0
200
0
203
14
0
89
293
203
0
170
89
0
218
106
0
293
0
106
297
35
...

output:

1 1
26 1
-1 26
1 2
95 1
-1 95
1 3
80 1
-26 80
1 4
99 1
-95 99
1 5
41 1
-41 80
1 6
295 1
-99 295
1 7
150 1
-41 150
1 8
182 1
-143 182
182 2
-182 295
1 9
117 1
-117 150
1 10
1 11
151 1
-104 151
151 2
-143 151
1 12
278 1
-117 278
1 13
1 14
252 1
-36 252
252 2
-252 278
1 15
1 16
162 1
-104 162
1 17
211 ...

result:

ok 

Test #11:

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

input:

300 600
44
1
0
267
1
0
49
14
0
44
0
150
151
0
267
0
14
151
83
14
0
233
73
0
151
0
72
83
0
73
240
72
0
257
25
0
73
0
25
208
159
0
240
0
156
25
0
159
26
159
0
147
61
0
156
0
61
236
26
0
63
218
0
236
0
85
61
0
131
23
0
85
0
218
23
211
10
0
218
0
10
143
23
0
138
10
0
96
71
0
138
0
71
31
71
0
275
22
0
31...

output:

1 1
44 1
-1 44
1 2
267 1
-1 267
1 3
49 1
-14 49
49 2
-44 49
1 4
150 1
-150 151
150 2
-150 267
1 5
1 6
1 7
83 1
-14 83
1 8
233 1
-73 233
233 2
-151 233
1 9
72 1
-72 83
1 10
1 11
240 1
-72 240
1 12
257 1
-25 257
257 2
-73 257
1 13
1 14
208 1
-159 208
208 2
-208 240
1 15
156 1
-25 156
1 16
1 17
26 1
-2...

result:

ok 

Test #12:

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

input:

300 600
30
1
0
281
1
0
112
30
0
217
14
0
281
0
14
64
112
0
43
14
0
257
64
0
52
43
0
116
84
0
257
0
67
40
0
52
0
84
40
218
84
0
247
40
0
252
218
0
169
62
0
247
0
269
222
0
252
0
62
222
156
222
0
161
16
0
62
0
16
264
156
0
105
16
0
260
24
0
264
0
24
194
105
0
271
24
0
300
80
0
194
0
80
178
226
0
271
0...

output:

1 1
30 1
-1 30
1 2
281 1
-1 281
1 3
112 1
-30 112
1 4
217 1
-14 217
217 2
-217 281
1 5
1 6
64 1
-64 112
1 7
43 1
-14 43
1 8
257 1
-64 257
1 9
52 1
-43 52
1 10
116 1
-84 116
116 2
-116 257
1 11
67 1
-40 67
67 2
-52 67
1 12
1 13
1 14
218 1
-84 218
1 15
247 1
-40 247
1 16
252 1
-218 252
1 17
169 1
-62 ...

result:

ok 

Test #13:

score: 7
Accepted
time: 2ms
memory: 3880kb

input:

300 600
75
1
0
115
1
0
32
115
0
212
75
0
181
32
0
182
41
0
212
0
41
199
181
0
173
41
0
255
147
0
199
0
147
253
173
0
207
47
0
253
0
264
136
0
147
0
47
136
60
47
0
216
136
0
171
89
0
216
0
213
60
0
63
178
0
213
0
89
7
35
0
89
0
178
35
70
59
0
178
0
59
106
35
0
107
58
0
106
0
233
59
0
58
68
128
0
233
...

output:

1 1
75 1
-1 75
1 2
115 1
-1 115
1 3
32 1
-32 115
1 4
212 1
-75 212
1 5
181 1
-32 181
1 6
182 1
-41 182
182 2
-182 212
1 7
1 8
199 1
-181 199
1 9
173 1
-41 173
1 10
255 1
-147 255
255 2
-199 255
1 11
1 12
253 1
-173 253
1 13
207 1
-47 207
207 2
-207 253
1 14
264 1
-136 264
264 2
-147 264
1 15
1 16
1 ...

result:

ok 

Test #14:

score: 7
Accepted
time: 2ms
memory: 3916kb

input:

300 600
232
1
0
264
1
0
90
142
0
232
0
104
141
0
264
0
141
142
244
142
0
267
141
0
193
58
0
267
0
219
64
0
244
0
58
64
215
58
0
286
64
0
111
86
0
286
0
133
123
0
215
0
86
123
205
71
0
86
0
218
123
0
71
230
218
0
54
13
0
71
0
220
191
0
230
0
13
191
134
191
0
258
13
0
242
11
0
258
0
257
60
0
134
0
11
...

output:

1 1
232 1
-1 232
1 2
264 1
-1 264
1 3
90 1
-90 142
90 2
-90 232
1 4
104 1
-104 141
104 2
-104 264
1 5
1 6
1 7
244 1
-142 244
1 8
267 1
-141 267
1 9
193 1
-58 193
193 2
-193 267
1 10
219 1
-64 219
219 2
-219 244
1 11
1 12
1 13
215 1
-58 215
1 14
286 1
-64 286
1 15
111 1
-86 111
111 2
-111 286
1 16
13...

result:

ok 

Subtask #4:

score: 9
Accepted

Test #15:

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

input:

299 89401
29
1
0
35
1
0
171
1
0
87
35
0
101
171
0
122
29
0
59
99
0
122
0
96
87
0
297
101
0
99
109
96
0
144
172
0
297
0
72
99
0
106
109
0
172
160
106
0
194
57
0
72
0
196
152
0
172
0
57
113
126
0
160
0
152
71
152
0
126
268
57
0
178
71
0
203
126
0
250
9
0
268
0
9
162
203
0
273
178
0
8
9
0
238
162
0
275...

output:

1 1
29 1
-1 29
1 2
35 1
-1 35
1 3
171 1
-1 171
1 4
87 1
-35 87
1 5
101 1
-101 171
1 6
122 1
-29 122
1 7
59 1
-59 99
59 2
-59 122
1 8
96 1
-87 96
1 9
297 1
-101 297
1 10
1 11
109 1
-96 109
1 12
144 1
-144 172
144 2
-144 297
1 13
72 1
-72 99
1 14
106 1
-106 109
1 15
1 16
160 1
-106 160
1 17
194 1
-57 ...

result:

ok 

Test #16:

score: 9
Accepted
time: 5ms
memory: 3920kb

input:

300 90000
28
1
0
60
1
0
183
1
0
26
60
0
199
109
0
183
0
209
28
0
49
209
0
109
254
26
0
13
109
0
172
57
0
254
0
237
49
0
57
173
13
0
176
237
0
143
119
0
173
0
244
11
0
57
0
247
113
0
176
0
11
113
119
7
119
0
63
113
0
285
11
0
163
7
0
189
202
0
285
0
195
63
0
137
184
0
195
0
171
163
0
202
88
110
0
202...

output:

1 1
28 1
-1 28
1 2
60 1
-1 60
1 3
183 1
-1 183
1 4
26 1
-26 60
1 5
199 1
-109 199
199 2
-183 199
1 6
209 1
-28 209
1 7
49 1
-49 209
1 8
1 9
254 1
-26 254
1 10
13 1
-13 109
1 11
172 1
-57 172
172 2
-172 254
1 12
237 1
-49 237
1 13
1 14
173 1
-13 173
1 15
176 1
-176 237
1 16
143 1
-119 143
143 2
-143 ...

result:

ok 

Test #17:

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

input:

300 90000
24
1
0
162
1
0
167
1
0
16
72
0
167
0
183
162
0
202
24
0
72
252
96
0
202
0
260
7
0
183
0
7
71
72
0
96
19
7
0
77
96
0
277
71
0
126
13
0
19
0
132
277
0
289
77
0
13
164
135
0
289
0
290
104
0
132
0
37
13
0
104
135
118
104
0
123
37
0
300
135
0
163
296
0
300
0
169
114
0
118
0
193
98
0
123
0
98
11...

output:

1 1
24 1
-1 24
1 2
162 1
-1 162
1 3
167 1
-1 167
1 4
16 1
-16 72
16 2
-16 167
1 5
183 1
-162 183
1 6
202 1
-24 202
1 7
1 8
252 1
-96 252
252 2
-202 252
1 9
260 1
-7 260
260 2
-183 260
1 10
1 11
71 1
-71 72
1 12
1 13
19 1
-7 19
1 14
77 1
-77 96
1 15
277 1
-71 277
1 16
126 1
-13 126
126 2
-19 126
1 17...

result:

ok 

Test #18:

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

input:

300 90000
107
1
0
138
1
0
277
1
0
62
33
0
277
0
125
2
0
138
0
238
107
0
2
33
244
24
0
238
0
24
32
33
0
178
2
0
68
19
0
178
0
146
32
0
267
24
0
19
133
38
0
146
0
208
267
0
38
189
19
0
300
148
0
208
0
104
38
0
148
168
189
0
35
21
0
148
0
60
46
0
104
0
248
18
0
168
0
18
21
46
11
18
0
124
21
0
290
46
0
...

output:

1 1
107 1
-1 107
1 2
138 1
-1 138
1 3
277 1
-1 277
1 4
62 1
-33 62
62 2
-62 277
1 5
125 1
-2 125
125 2
-125 138
1 6
238 1
-107 238
1 7
1 8
1 9
244 1
-24 244
244 2
-238 244
1 10
1 11
32 1
-32 33
1 12
178 1
-2 178
1 13
68 1
-19 68
68 2
-68 178
1 14
146 1
-32 146
1 15
267 1
-24 267
1 16
1 17
133 1
-38 ...

result:

ok 

Test #19:

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

input:

300 90000
65
1
0
88
1
0
283
1
0
4
232
0
283
0
16
21
0
65
0
204
14
0
88
0
14
21
232
41
14
0
61
21
0
120
97
0
232
0
86
42
0
61
0
97
272
41
0
42
200
97
0
246
7
0
272
0
7
128
5
0
42
0
163
175
0
200
0
5
175
243
7
0
81
5
0
194
11
0
243
0
268
122
0
175
0
11
80
81
0
122
19
11
0
124
25
0
80
0
215
122
0
25
24...

output:

1 1
65 1
-1 65
1 2
88 1
-1 88
1 3
283 1
-1 283
1 4
4 1
-4 232
4 2
-4 283
1 5
16 1
-16 21
16 2
-16 65
1 6
204 1
-14 204
204 2
-88 204
1 7
1 8
1 9
1 10
41 1
-14 41
1 11
61 1
-21 61
1 12
120 1
-97 120
120 2
-120 232
1 13
86 1
-42 86
86 2
-61 86
1 14
1 15
272 1
-41 272
1 16
1 17
200 1
-97 200
1 18
246 1...

result:

ok 

Test #20:

score: 9
Accepted
time: 4ms
memory: 3892kb

input:

299 89401
124
1
0
149
1
0
153
1
0
13
124
0
133
153
0
289
75
0
149
0
75
180
13
0
280
133
0
83
29
0
180
0
161
231
0
280
0
193
6
0
75
0
6
29
231
112
6
0
237
33
0
231
0
274
29
0
33
90
112
0
222
49
0
274
0
49
253
90
0
276
33
0
236
49
0
243
69
0
276
0
255
53
0
253
0
53
69
192
236
0
167
22
0
53
0
272
110
0...

output:

1 1
124 1
-1 124
1 2
149 1
-1 149
1 3
153 1
-1 153
1 4
13 1
-13 124
1 5
133 1
-133 153
1 6
289 1
-75 289
289 2
-149 289
1 7
1 8
180 1
-13 180
1 9
280 1
-133 280
1 10
83 1
-29 83
83 2
-83 180
1 11
161 1
-161 231
161 2
-161 280
1 12
193 1
-6 193
193 2
-75 193
1 13
1 14
1 15
1 16
112 1
-6 112
1 17
237 ...

result:

ok 

Test #21:

score: 9
Accepted
time: 6ms
memory: 3832kb

input:

300 90000
107
1
0
159
1
0
183
1
0
224
63
0
107
0
241
159
0
267
183
0
63
167
144
0
241
0
247
69
0
267
0
69
144
155
63
0
158
69
0
172
144
0
223
155
0
196
3
0
223
0
286
6
0
158
0
298
59
0
172
0
3
6
59
198
6
0
210
3
0
249
59
0
20
26
0
198
0
44
179
0
210
0
162
185
0
249
0
26
179
185
139
52
0
179
0
245
39...

output:

1 1
107 1
-1 107
1 2
159 1
-1 159
1 3
183 1
-1 183
1 4
224 1
-63 224
224 2
-107 224
1 5
241 1
-159 241
1 6
267 1
-183 267
1 7
1 8
167 1
-144 167
167 2
-167 241
1 9
247 1
-69 247
247 2
-247 267
1 10
1 11
1 12
155 1
-63 155
1 13
158 1
-69 158
1 14
172 1
-144 172
1 15
223 1
-155 223
1 16
196 1
-3 196
1...

result:

ok 

Test #22:

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

input:

300 90000
38
1
0
112
1
0
211
1
0
50
38
0
141
112
0
273
130
0
211
0
130
156
141
0
162
8
0
50
0
8
55
39
0
130
0
180
156
0
39
61
8
0
232
82
0
180
0
75
39
0
82
166
61
0
157
82
0
278
75
0
283
166
0
177
9
0
157
0
182
197
0
283
0
190
35
0
278
0
9
35
197
11
137
0
197
0
76
9
0
138
35
0
137
196
138
0
281
76
0...

output:

1 1
38 1
-1 38
1 2
112 1
-1 112
1 3
211 1
-1 211
1 4
50 1
-38 50
1 5
141 1
-112 141
1 6
273 1
-130 273
273 2
-211 273
1 7
1 8
156 1
-141 156
1 9
162 1
-8 162
162 2
-50 162
1 10
1 11
55 1
-39 55
55 2
-55 130
1 12
180 1
-156 180
1 13
1 14
61 1
-8 61
1 15
232 1
-82 232
232 2
-180 232
1 16
75 1
-39 75
1...

result:

ok 

Subtask #5:

score: 13
Accepted

Test #23:

score: 13
Accepted
time: 4ms
memory: 3916kb

input:

299 897
140
1
0
269
1
0
276
1
0
57
256
0
276
0
125
107
0
269
0
288
56
0
140
0
56
107
256
104
236
0
256
0
137
107
0
138
56
0
228
137
0
236
247
123
0
138
0
123
169
54
0
236
0
200
228
0
54
227
8
0
123
0
243
170
0
200
0
8
86
3
0
54
0
170
3
132
98
0
170
0
237
8
0
67
3
0
98
152
15
0
237
0
15
37
98
0
280
6...

output:

1 1
140 1
-1 140
1 2
269 1
-1 269
1 3
276 1
-1 276
1 4
57 1
-57 256
57 2
-57 276
1 5
125 1
-107 125
125 2
-125 269
1 6
288 1
-56 288
288 2
-140 288
1 7
1 8
1 9
1 10
104 1
-104 236
104 2
-104 256
1 11
137 1
-107 137
1 12
138 1
-56 138
1 13
228 1
-137 228
1 14
1 15
247 1
-123 247
247 2
-138 247
1 16
1...

result:

ok 

Test #24:

score: 13
Accepted
time: 5ms
memory: 3912kb

input:

300 900
46
1
0
127
1
0
191
1
0
86
127
0
249
121
0
191
0
298
46
0
121
163
78
0
86
0
282
18
0
298
0
18
78
248
103
0
121
0
22
18
0
103
148
78
0
139
19
0
103
0
184
22
0
289
141
0
148
0
19
118
65
0
184
0
141
37
19
0
65
296
98
0
141
0
98
166
65
0
199
37
0
63
196
0
199
0
100
5
0
98
0
220
129
0
166
0
5
129
...

output:

1 1
46 1
-1 46
1 2
127 1
-1 127
1 3
191 1
-1 191
1 4
86 1
-86 127
1 5
249 1
-121 249
249 2
-191 249
1 6
298 1
-46 298
1 7
1 8
163 1
-78 163
163 2
-86 163
1 9
282 1
-18 282
282 2
-282 298
1 10
1 11
1 12
248 1
-103 248
248 2
-121 248
1 13
22 1
-18 22
1 14
1 15
148 1
-78 148
1 16
139 1
-19 139
139 2
-1...

result:

ok 

Test #25:

score: 13
Accepted
time: 5ms
memory: 3960kb

input:

300 900
60
1
0
131
1
0
298
1
0
23
119
0
131
0
59
106
0
298
0
114
60
0
106
119
291
114
0
48
119
0
130
106
0
224
272
0
291
0
184
48
0
239
105
0
130
0
272
62
79
0
272
0
65
172
0
184
0
105
79
133
40
0
105
0
172
18
79
0
40
211
172
0
92
40
0
214
207
0
211
0
216
18
0
32
151
0
216
0
189
92
0
207
97
28
0
189...

output:

1 1
60 1
-1 60
1 2
131 1
-1 131
1 3
298 1
-1 298
1 4
23 1
-23 119
23 2
-23 131
1 5
59 1
-59 106
59 2
-59 298
1 6
114 1
-60 114
1 7
1 8
1 9
291 1
-114 291
1 10
48 1
-48 119
1 11
130 1
-106 130
1 12
224 1
-224 272
224 2
-224 291
1 13
184 1
-48 184
1 14
239 1
-105 239
239 2
-130 239
1 15
1 16
62 1
-62 ...

result:

ok 

Test #26:

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

input:

300 900
8
1
0
179
1
0
200
1
0
73
115
0
200
0
132
8
0
238
179
0
115
174
13
0
132
0
261
238
0
13
257
76
0
115
0
295
162
0
261
0
59
13
0
76
162
35
59
0
133
28
0
76
0
228
78
0
162
0
28
78
222
35
0
64
78
0
67
196
0
222
0
130
28
0
103
54
0
64
0
196
253
48
0
130
0
48
54
250
106
0
196
0
75
29
0
48
0
106
284...

output:

1 1
8 1
-1 8
1 2
179 1
-1 179
1 3
200 1
-1 200
1 4
73 1
-73 115
73 2
-73 200
1 5
132 1
-8 132
1 6
238 1
-179 238
1 7
1 8
174 1
-13 174
174 2
-132 174
1 9
261 1
-238 261
1 10
1 11
257 1
-76 257
257 2
-115 257
1 12
295 1
-162 295
295 2
-261 295
1 13
59 1
-13 59
1 14
1 15
1 16
35 1
-35 59
1 17
133 1
-2...

result:

ok 

Test #27:

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

input:

300 900
94
1
0
172
1
0
267
1
0
20
71
0
94
0
136
150
0
267
0
204
132
0
172
0
71
132
150
28
150
0
127
120
0
132
0
155
71
0
110
155
0
120
229
28
0
195
124
0
229
0
198
110
0
257
23
0
120
0
23
124
146
60
0
198
0
60
101
113
0
124
0
290
23
0
113
137
167
0
290
0
223
60
0
167
196
7
0
113
0
289
56
0
223
0
7
5...

output:

1 1
94 1
-1 94
1 2
172 1
-1 172
1 3
267 1
-1 267
1 4
20 1
-20 71
20 2
-20 94
1 5
136 1
-136 150
136 2
-136 267
1 6
204 1
-132 204
204 2
-172 204
1 7
1 8
1 9
1 10
28 1
-28 150
1 11
127 1
-120 127
127 2
-127 132
1 12
155 1
-71 155
1 13
110 1
-110 155
1 14
1 15
229 1
-28 229
1 16
195 1
-124 195
195 2
-...

result:

ok 

Test #28:

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

input:

300 900
4
1
0
12
1
0
58
1
0
36
4
0
57
58
0
293
12
0
140
57
0
171
36
0
211
131
0
293
0
47
163
0
171
0
131
232
140
0
134
131
0
163
164
208
0
232
0
178
134
0
208
236
2
0
163
0
2
194
208
0
258
90
0
178
0
90
179
2
0
255
80
0
194
0
46
90
0
80
143
179
0
176
80
0
209
143
0
262
46
0
186
209
0
278
176
0
282
2...

output:

1 1
4 1
-1 4
1 2
12 1
-1 12
1 3
58 1
-1 58
1 4
36 1
-4 36
1 5
57 1
-57 58
1 6
293 1
-12 293
1 7
140 1
-57 140
1 8
171 1
-36 171
1 9
211 1
-131 211
211 2
-211 293
1 10
47 1
-47 163
47 2
-47 171
1 11
1 12
232 1
-140 232
1 13
134 1
-131 134
1 14
1 15
164 1
-164 208
164 2
-164 232
1 16
178 1
-134 178
1 ...

result:

ok 

Test #29:

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

input:

299 897
56
1
0
138
1
0
273
1
0
27
273
0
51
56
0
144
113
0
138
0
113
128
51
0
279
27
0
182
77
0
128
0
195
112
0
113
0
206
88
0
279
0
77
88
112
79
58
0
88
0
80
77
0
247
112
0
58
220
63
0
80
0
230
92
0
247
0
63
92
299
58
0
19
63
0
40
92
0
99
23
0
299
0
23
209
19
0
250
40
0
37
209
0
53
16
0
250
0
103
23...

output:

1 1
56 1
-1 56
1 2
138 1
-1 138
1 3
273 1
-1 273
1 4
27 1
-27 273
1 5
51 1
-51 56
1 6
144 1
-113 144
144 2
-138 144
1 7
1 8
128 1
-51 128
1 9
279 1
-27 279
1 10
182 1
-77 182
182 2
-128 182
1 11
195 1
-112 195
195 2
-113 195
1 12
206 1
-88 206
206 2
-206 279
1 13
1 14
1 15
1 16
79 1
-58 79
79 2
-79 ...

result:

ok 

Test #30:

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

input:

300 900
127
1
0
219
1
0
267
1
0
199
151
0
219
0
216
25
0
127
0
240
115
0
267
0
25
115
151
17
25
0
109
16
0
115
0
112
151
0
16
107
17
0
286
40
0
112
0
40
117
16
0
278
107
0
95
40
0
113
158
0
278
0
298
117
0
158
176
284
0
298
0
178
69
0
95
0
69
82
158
0
284
217
69
0
232
11
0
284
0
273
82
0
11
110
229
...

output:

1 1
127 1
-1 127
1 2
219 1
-1 219
1 3
267 1
-1 267
1 4
199 1
-151 199
199 2
-199 219
1 5
216 1
-25 216
216 2
-127 216
1 6
240 1
-115 240
240 2
-240 267
1 7
1 8
1 9
1 10
17 1
-17 25
1 11
109 1
-16 109
109 2
-109 115
1 12
112 1
-112 151
1 13
1 14
107 1
-17 107
1 15
286 1
-40 286
286 2
-112 286
1 16
1 ...

result:

ok 

Test #31:

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

input:

300 900
96
1
0
144
1
0
170
1
0
161
144
0
180
96
0
261
104
0
170
0
104
192
180
0
224
121
0
161
0
121
235
95
0
104
0
276
18
0
192
0
18
61
8
0
121
0
95
8
198
95
0
217
18
0
62
8
0
204
198
0
264
19
0
217
0
19
67
62
0
274
126
0
204
0
126
132
2
0
19
0
164
37
0
67
0
2
37
179
108
0
126
0
7
2
0
108
162
11
0
3...

output:

1 1
96 1
-1 96
1 2
144 1
-1 144
1 3
170 1
-1 170
1 4
161 1
-144 161
1 5
180 1
-96 180
1 6
261 1
-104 261
261 2
-170 261
1 7
1 8
192 1
-180 192
1 9
224 1
-121 224
224 2
-161 224
1 10
1 11
235 1
-95 235
235 2
-104 235
1 12
276 1
-18 276
276 2
-192 276
1 13
1 14
61 1
-8 61
61 2
-61 121
1 15
1 16
1 17
1...

result:

ok 

Subtask #6:

score: 15
Accepted

Test #32:

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

input:

300 90000
133
1
0
179
1
0
89
133
0
197
21
0
179
0
271
10
0
179
0
290
133
0
10
21
139
290
0
230
197
0
253
88
0
89
0
284
262
0
270
0
290
0
88
109
10
0
160
21
0
229
21
0
231
10
0
239
201
0
230
0
262
270
51
109
0
98
229
0
108
15
0
231
0
121
99
0
124
0
231
0
201
217
109
0
224
92
0
101
0
160
0
236
102
0
2...

output:

1 1
133 1
-1 133
1 2
179 1
-1 179
1 3
89 1
-89 133
1 4
197 1
-21 197
197 2
-179 197
1 5
271 1
-10 271
271 2
-179 271
1 6
290 1
-133 290
1 7
1 8
1 9
139 1
-139 290
1 10
230 1
-197 230
1 11
253 1
-88 253
253 2
-89 253
1 12
284 1
-262 284
284 2
-270 284
284 3
-284 290
1 13
1 14
109 1
-10 109
1 15
160 1...

result:

ok 

Test #33:

score: 15
Accepted
time: 1ms
memory: 3920kb

input:

300 90000
293
1
0
136
88
0
261
0
293
0
88
261
139
88
0
267
98
0
203
0
261
0
98
167
30
0
139
0
203
30
72
16
0
203
0
207
167
0
222
66
0
98
0
300
160
0
203
0
16
66
160
201
30
0
279
72
0
289
36
0
138
0
222
0
36
131
168
0
192
0
279
0
132
12
0
66
0
138
153
16
0
252
201
0
292
279
0
295
66
0
12
113
116
0
13...

output:

1 1
293 1
-1 293
1 2
136 1
-88 136
136 2
-136 261
136 3
-136 293
1 3
1 4
1 5
139 1
-88 139
1 6
267 1
-98 267
267 2
-203 267
267 3
-261 267
1 7
1 8
167 1
-30 167
167 2
-139 167
1 9
1 10
1 11
72 1
-16 72
72 2
-72 203
1 12
207 1
-167 207
1 13
222 1
-66 222
222 2
-98 222
1 14
300 1
-160 300
300 2
-203 3...

result:

ok 

Test #34:

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

input:

300 90000
14
1
0
84
1
0
62
84
0
180
14
0
184
14
0
212
84
0
22
180
0
104
212
0
199
180
0
221
60
0
212
0
60
201
9
0
199
0
229
104
0
271
104
0
9
47
60
0
204
25
0
242
0
271
0
254
76
0
229
0
25
76
242
258
254
0
98
242
0
298
130
0
258
0
130
292
106
0
274
0
298
0
106
133
121
0
123
0
130
0
274
45
106
0
121
...

output:

1 1
14 1
-1 14
1 2
84 1
-1 84
1 3
62 1
-62 84
1 4
180 1
-14 180
1 5
184 1
-14 184
1 6
212 1
-84 212
1 7
22 1
-22 180
1 8
104 1
-104 212
1 9
199 1
-180 199
1 10
221 1
-60 221
221 2
-212 221
1 11
1 12
201 1
-9 201
201 2
-199 201
1 13
229 1
-104 229
1 14
271 1
-104 271
1 15
1 16
47 1
-47 60
1 17
204 1
...

result:

ok 

Test #35:

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

input:

300 90000
79
1
0
293
79
0
297
79
0
87
33
0
54
0
293
0
96
121
0
276
0
293
0
33
54
121
276
4
15
0
54
0
55
54
0
213
33
0
257
33
0
15
83
213
0
137
2
0
55
0
154
55
0
185
4
0
210
257
0
256
213
0
275
257
0
2
24
15
0
82
15
0
102
137
0
129
85
0
154
0
167
74
0
185
0
172
147
0
154
0
189
133
0
185
0
22
64
0
82
...

output:

1 1
79 1
-1 79
1 2
293 1
-79 293
1 3
297 1
-79 297
1 4
87 1
-33 87
87 2
-54 87
87 3
-87 293
1 5
96 1
-96 121
96 2
-96 276
96 3
-96 293
1 6
1 7
1 8
1 9
1 10
4 1
-4 15
4 2
-4 54
1 11
55 1
-54 55
1 12
213 1
-33 213
1 13
257 1
-33 257
1 14
1 15
83 1
-83 213
1 16
137 1
-2 137
137 2
-55 137
1 17
154 1
-55...

result:

ok 

Test #36:

score: 15
Accepted
time: 2ms
memory: 3844kb

input:

300 90000
67
1
0
154
1
0
241
1
0
142
67
0
153
67
0
92
142
0
106
153
0
194
53
0
153
0
236
142
0
53
197
60
0
106
0
222
194
0
266
72
0
106
0
60
72
196
222
0
198
222
0
265
53
0
274
53
0
298
119
0
206
0
266
0
299
156
0
197
0
44
8
0
60
0
115
60
0
119
156
205
72
0
206
254
28
0
38
0
299
0
291
72
0
8
28
38
6...

output:

1 1
67 1
-1 67
1 2
154 1
-1 154
1 3
241 1
-1 241
1 4
142 1
-67 142
1 5
153 1
-67 153
1 6
92 1
-92 142
1 7
106 1
-106 153
1 8
194 1
-53 194
194 2
-153 194
1 9
236 1
-142 236
1 10
1 11
197 1
-60 197
197 2
-106 197
1 12
222 1
-194 222
1 13
266 1
-72 266
266 2
-106 266
1 14
1 15
1 16
196 1
-196 222
1 17...

result:

ok 

Test #37:

score: 15
Accepted
time: 5ms
memory: 3832kb

input:

300 90000
248
1
0
285
1
0
290
1
0
209
64
0
255
0
285
0
225
62
0
259
0
285
0
62
64
255
259
78
62
0
131
62
0
149
72
0
208
0
259
0
261
246
0
259
0
72
185
63
0
131
0
195
131
0
208
246
282
261
0
284
78
0
292
44
0
78
0
44
63
140
36
0
185
0
177
181
0
205
0
292
0
247
122
0
173
0
284
0
253
87
0
284
0
254
82
...

output:

1 1
248 1
-1 248
1 2
285 1
-1 285
1 3
290 1
-1 290
1 4
209 1
-64 209
209 2
-209 255
209 3
-209 285
1 5
225 1
-62 225
225 2
-225 259
225 3
-225 285
1 6
1 7
1 8
1 9
1 10
78 1
-62 78
1 11
131 1
-62 131
1 12
149 1
-72 149
149 2
-149 208
149 3
-149 259
1 13
261 1
-246 261
261 2
-259 261
1 14
1 15
185 1
-...

result:

ok 

Test #38:

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

input:

299 89401
75
1
0
202
1
0
85
121
0
202
0
115
75
0
121
290
84
0
115
0
84
266
121
0
210
266
0
298
22
0
84
0
22
299
19
0
210
0
12
22
0
19
186
12
0
293
19
0
104
44
0
293
0
130
71
0
186
0
44
71
88
44
0
295
71
0
184
58
0
295
0
263
88
0
58
181
263
0
126
58
0
273
181
0
73
126
0
270
136
0
273
0
136
180
73
0
3...

output:

1 1
75 1
-1 75
1 2
202 1
-1 202
1 3
85 1
-85 121
85 2
-85 202
1 4
115 1
-75 115
1 5
1 6
290 1
-84 290
290 2
-115 290
1 7
1 8
266 1
-121 266
1 9
210 1
-210 266
1 10
298 1
-22 298
298 2
-84 298
1 11
1 12
299 1
-19 299
299 2
-210 299
1 13
12 1
-12 22
1 14
1 15
186 1
-12 186
1 16
293 1
-19 293
1 17
104 ...

result:

ok 

Test #39:

score: 15
Accepted
time: 4ms
memory: 3916kb

input:

300 90000
243
1
0
3
243
0
4
243
0
9
243
0
10
243
0
12
243
0
14
243
0
15
243
0
18
243
0
19
243
0
21
243
0
23
243
0
25
243
0
26
243
0
29
243
0
32
243
0
35
243
0
36
17
0
243
0
40
243
0
43
243
0
45
243
0
46
243
0
47
243
0
49
243
0
50
243
0
51
243
0
53
243
0
54
243
0
55
243
0
56
243
0
59
243
0
62
243
0
6...

output:

1 1
243 1
-1 243
1 2
3 1
-3 243
1 3
4 1
-4 243
1 4
9 1
-9 243
1 5
10 1
-10 243
1 6
12 1
-12 243
1 7
14 1
-14 243
1 8
15 1
-15 243
1 9
18 1
-18 243
1 10
19 1
-19 243
1 11
21 1
-21 243
1 12
23 1
-23 243
1 13
25 1
-25 243
1 14
26 1
-26 243
1 15
29 1
-29 243
1 16
32 1
-32 243
1 17
35 1
-35 243
1 18
36 1...

result:

ok 

Test #40:

score: 15
Accepted
time: 2ms
memory: 3776kb

input:

300 90000
2
1
0
5
2
0
8
5
0
9
8
0
10
7
0
9
0
7
12
10
0
6
4
0
7
0
11
12
0
15
12
0
4
18
15
0
3
4
0
16
14
0
18
0
21
18
0
14
24
21
0
13
14
0
22
19
0
24
0
26
24
0
19
28
26
0
31
28
0
34
31
0
32
34
0
35
34
0
36
33
0
35
0
33
39
36
0
30
29
0
33
0
37
39
0
40
38
0
39
0
29
38
42
40
0
27
25
0
29
0
43
42
0
25
45
...

output:

1 1
2 1
-1 2
1 2
5 1
-2 5
1 3
8 1
-5 8
1 4
9 1
-8 9
1 5
10 1
-7 10
10 2
-9 10
1 6
1 7
12 1
-10 12
1 8
6 1
-4 6
6 2
-6 7
1 9
11 1
-11 12
1 10
15 1
-12 15
1 11
1 12
18 1
-15 18
1 13
3 1
-3 4
1 14
16 1
-14 16
16 2
-16 18
1 15
21 1
-18 21
1 16
1 17
24 1
-21 24
1 18
13 1
-13 14
1 19
22 1
-19 22
22 2
-22 ...

result:

ok 

Test #41:

score: 15
Accepted
time: 4ms
memory: 3896kb

input:

300 90000
123
1
0
89
123
0
188
65
0
123
0
65
267
188
0
194
53
0
267
0
271
226
0
267
0
53
226
299
215
0
235
0
259
0
271
0
135
69
0
226
0
215
235
259
276
169
0
185
0
299
0
295
170
0
299
0
300
222
0
278
0
279
0
286
0
289
0
294
0
297
0
298
0
299
0
69
122
259
0
140
55
0
70
0
235
0
154
54
0
215
0
169
170
...

output:

1 1
123 1
-1 123
1 2
89 1
-89 123
1 3
188 1
-65 188
188 2
-123 188
1 4
1 5
267 1
-188 267
1 6
194 1
-53 194
194 2
-194 267
1 7
271 1
-226 271
271 2
-267 271
1 8
1 9
1 10
299 1
-215 299
299 2
-235 299
299 3
-259 299
299 4
-271 299
1 11
135 1
-69 135
135 2
-135 226
1 12
1 13
1 14
1 15
276 1
-169 276
2...

result:

ok 

Test #42:

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

input:

300 90000
265
1
0
106
265
0
269
261
0
265
0
261
297
201
0
259
0
269
0
201
231
185
0
229
0
261
0
259
274
63
0
151
0
273
0
297
0
295
254
0
285
0
297
0
298
4
0
169
0
243
0
297
0
4
63
105
12
0
24
0
201
0
151
166
153
0
201
0
169
185
229
243
254
273
285
300
121
0
266
0
276
0
290
0
294
0
296
0
298
0
7
229
...

output:

1 1
265 1
-1 265
1 2
106 1
-106 265
1 3
269 1
-261 269
269 2
-265 269
1 4
1 5
297 1
-201 297
297 2
-259 297
297 3
-269 297
1 6
1 7
231 1
-185 231
231 2
-229 231
231 3
-231 261
1 8
1 9
274 1
-63 274
274 2
-151 274
274 3
-273 274
274 4
-274 297
1 10
295 1
-254 295
295 2
-285 295
295 3
-295 297
1 11
29...

result:

ok 

Test #43:

score: 15
Accepted
time: 5ms
memory: 3892kb

input:

299 89401
89
1
0
149
1
0
253
1
0
291
1
0
297
1
0
298
1
0
299
1
0
103
53
0
149
0
139
291
0
142
28
0
131
0
291
0
166
109
0
120
0
291
0
172
140
0
253
0
216
135
0
291
0
242
164
0
217
0
229
0
291
0
255
61
0
213
0
291
0
257
141
0
187
0
189
0
297
0
263
27
0
298
0
270
191
0
224
0
291
0
274
297
0
278
84
0
15...

output:

1 1
89 1
-1 89
1 2
149 1
-1 149
1 3
253 1
-1 253
1 4
291 1
-1 291
1 5
297 1
-1 297
1 6
298 1
-1 298
1 7
299 1
-1 299
1 8
103 1
-53 103
103 2
-103 149
1 9
139 1
-139 291
1 10
142 1
-28 142
142 2
-131 142
142 3
-142 291
1 11
166 1
-109 166
166 2
-120 166
166 3
-166 291
1 12
172 1
-140 172
172 2
-172 2...

result:

ok 

Test #44:

score: 15
Accepted
time: 5ms
memory: 3908kb

input:

300 90000
150
1
0
223
1
0
279
1
0
280
1
0
287
1
0
290
1
0
295
1
0
298
1
0
299
1
0
300
1
0
60
295
0
143
39
0
150
0
156
148
0
279
0
162
280
0
163
149
0
295
0
168
280
0
179
81
0
280
0
181
61
0
290
0
188
290
0
192
290
0
216
134
0
155
0
300
0
226
185
0
298
0
236
138
0
300
0
239
73
0
212
0
225
0
295
0
245...

output:

1 1
150 1
-1 150
1 2
223 1
-1 223
1 3
279 1
-1 279
1 4
280 1
-1 280
1 5
287 1
-1 287
1 6
290 1
-1 290
1 7
295 1
-1 295
1 8
298 1
-1 298
1 9
299 1
-1 299
1 10
300 1
-1 300
1 11
60 1
-60 295
1 12
143 1
-39 143
143 2
-143 150
1 13
156 1
-148 156
156 2
-156 279
1 14
162 1
-162 280
1 15
163 1
-149 163
16...

result:

ok 

Test #45:

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

input:

299 89401
202
1
0
235
3
0
4
0
5
0
6
0
9
0
11
0
12
0
14
0
16
0
17
0
18
0
19
0
20
0
25
0
26
0
28
0
30
0
31
0
33
0
34
0
35
0
36
0
39
0
41
0
43
0
45
0
46
0
49
0
50
0
51
0
52
0
55
0
56
0
58
0
63
0
64
0
65
0
67
0
69
0
70
0
72
0
73
0
75
0
76
0
77
0
79
0
80
0
82
0
83
0
87
0
88
0
92
0
99
0
102
0
103
0
104
0
...

output:

1 1
202 1
-1 202
1 2
235 1
-3 235
235 2
-4 235
235 3
-5 235
235 4
-6 235
235 5
-9 235
235 6
-11 235
235 7
-12 235
235 8
-14 235
235 9
-16 235
235 10
-17 235
235 11
-18 235
235 12
-19 235
235 13
-20 235
235 14
-25 235
235 15
-26 235
235 16
-28 235
235 17
-30 235
235 18
-31 235
235 19
-33 235
235 20
-...

result:

ok 

Test #46:

score: 15
Accepted
time: 6ms
memory: 3916kb

input:

300 90000
142
1
0
94
2
0
3
0
4
0
6
0
9
0
11
0
15
0
16
0
17
0
21
0
23
0
25
0
26
0
28
0
30
0
32
0
35
0
39
0
41
0
42
0
44
0
45
0
48
0
50
0
52
0
54
0
55
0
56
0
64
0
67
0
68
0
73
0
74
0
75
0
76
0
77
0
78
0
81
0
87
0
91
0
93
0
96
0
97
0
99
0
101
0
105
0
106
0
110
0
111
0
112
0
113
0
116
0
118
0
121
0
124
...

output:

1 1
142 1
-1 142
1 2
94 1
-2 94
94 2
-3 94
94 3
-4 94
94 4
-6 94
94 5
-9 94
94 6
-11 94
94 7
-15 94
94 8
-16 94
94 9
-17 94
94 10
-21 94
94 11
-23 94
94 12
-25 94
94 13
-26 94
94 14
-28 94
94 15
-30 94
94 16
-32 94
94 17
-35 94
94 18
-39 94
94 19
-41 94
94 20
-42 94
94 21
-44 94
94 22
-45 94
94 23
-...

result:

ok 

Test #47:

score: 15
Accepted
time: 5ms
memory: 3904kb

input:

300 90000
6
1
0
255
1
0
108
67
0
255
0
179
6
0
67
184
115
0
179
0
115
120
115
0
298
120
0
261
103
0
298
0
103
65
103
0
177
2
0
65
0
2
4
2
0
25
2
0
33
2
0
39
2
0
71
2
0
84
2
0
86
2
0
100
2
0
101
2
0
126
2
0
130
2
0
152
2
0
157
2
0
162
2
0
167
2
0
199
2
0
226
2
0
228
2
0
232
2
0
234
2
0
262
2
0
263
2
...

output:

1 1
6 1
-1 6
1 2
255 1
-1 255
1 3
108 1
-67 108
108 2
-108 255
1 4
179 1
-6 179
1 5
1 6
184 1
-115 184
184 2
-179 184
1 7
1 8
120 1
-115 120
1 9
298 1
-120 298
1 10
261 1
-103 261
261 2
-261 298
1 11
1 12
65 1
-65 103
1 13
177 1
-2 177
177 2
-65 177
1 14
1 15
4 1
-2 4
1 16
25 1
-2 25
1 17
33 1
-2 33...

result:

ok 

Test #48:

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

input:

300 90000
2
1
0
236
1
0
3
2
0
9
2
0
12
2
0
30
2
0
39
2
0
51
2
0
74
2
0
87
2
0
94
2
0
97
2
0
104
2
0
106
2
0
127
2
0
151
2
0
163
2
0
180
2
0
199
2
0
238
2
0
252
2
0
260
55
0
236
0
272
2
0
297
2
0
14
87
0
19
47
0
74
0
20
12
0
25
13
0
199
0
26
44
0
163
0
48
94
0
55
57
168
0
297
0
64
63
0
180
0
73
127
0...

output:

1 1
2 1
-1 2
1 2
236 1
-1 236
1 3
3 1
-2 3
1 4
9 1
-2 9
1 5
12 1
-2 12
1 6
30 1
-2 30
1 7
39 1
-2 39
1 8
51 1
-2 51
1 9
74 1
-2 74
1 10
87 1
-2 87
1 11
94 1
-2 94
1 12
97 1
-2 97
1 13
104 1
-2 104
1 14
106 1
-2 106
1 15
127 1
-2 127
1 16
151 1
-2 151
1 17
163 1
-2 163
1 18
180 1
-2 180
1 19
199 1
-2...

result:

ok 

Test #49:

score: 15
Accepted
time: 5ms
memory: 3812kb

input:

299 89401
17
1
0
19
1
0
69
1
0
239
1
0
2
239
0
52
19
0
86
19
0
91
6
0
17
0
216
239
0
270
17
0
277
97
0
239
0
6
30
112
0
117
0
270
0
97
169
4
0
52
0
251
79
0
270
0
4
23
97
0
53
97
0
79
112
117
119
26
0
97
0
178
67
0
97
0
212
169
0
238
169
0
266
6
0
271
97
0
279
169
0
3
117
0
26
67
76
79
0
100
79
0
18...

output:

1 1
17 1
-1 17
1 2
19 1
-1 19
1 3
69 1
-1 69
1 4
239 1
-1 239
1 5
2 1
-2 239
1 6
52 1
-19 52
1 7
86 1
-19 86
1 8
91 1
-6 91
91 2
-17 91
1 9
216 1
-216 239
1 10
270 1
-17 270
1 11
277 1
-97 277
277 2
-239 277
1 12
1 13
30 1
-30 112
30 2
-30 117
30 3
-30 270
1 14
1 15
169 1
-4 169
169 2
-52 169
1 16
2...

result:

ok 

Test #50:

score: 15
Accepted
time: 5ms
memory: 3892kb

input:

300 90000
55
1
0
253
1
0
261
1
0
58
144
0
253
0
168
261
0
300
187
0
253
0
144
187
221
147
0
187
0
293
31
0
141
0
187
0
31
141
147
254
154
0
197
0
206
0
264
0
293
0
154
197
206
241
31
0
264
2
39
0
206
0
72
11
0
264
0
145
154
0
167
37
0
52
0
89
0
264
0
173
28
0
87
0
163
0
241
0
207
264
0
227
91
0
131
...

output:

1 1
55 1
-1 55
1 2
253 1
-1 253
1 3
261 1
-1 261
1 4
58 1
-58 144
58 2
-58 253
1 5
168 1
-168 261
1 6
300 1
-187 300
300 2
-253 300
1 7
1 8
1 9
221 1
-147 221
221 2
-187 221
1 10
293 1
-31 293
293 2
-141 293
293 3
-187 293
1 11
1 12
1 13
1 14
254 1
-154 254
254 2
-197 254
254 3
-206 254
254 4
-254 2...

result:

ok 

Test #51:

score: 15
Accepted
time: 1ms
memory: 3908kb

input:

300 90000
70
1
0
126
1
0
125
126
0
220
29
0
32
0
126
0
255
6
0
70
0
6
29
32
135
224
0
255
0
184
255
0
208
130
0
255
0
271
62
0
85
0
100
0
207
0
220
0
62
67
6
0
85
100
130
141
29
0
207
224
257
29
0
264
184
0
16
224
0
18
64
0
100
0
74
51
0
206
0
207
0
131
49
0
100
0
163
67
0
171
17
0
36
0
67
0
178
62
...

output:

1 1
70 1
-1 70
1 2
126 1
-1 126
1 3
125 1
-125 126
1 4
220 1
-29 220
220 2
-32 220
220 3
-126 220
1 5
255 1
-6 255
255 2
-70 255
1 6
1 7
1 8
1 9
135 1
-135 224
135 2
-135 255
1 10
184 1
-184 255
1 11
208 1
-130 208
208 2
-208 255
1 12
271 1
-62 271
271 2
-85 271
271 3
-100 271
271 4
-207 271
271 5
-...

result:

ok 

Test #52:

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

input:

300 90000
297
1
0
55
267
0
297
0
176
63
0
135
0
297
0
63
135
267
186
179
0
267
0
258
135
0
296
63
0
178
243
0
258
0
179
275
186
0
278
258
0
99
179
0
123
98
0
159
0
179
0
243
40
180
0
239
0
243
0
98
118
243
0
159
127
90
0
159
0
180
184
159
0
239
268
40
0
89
239
0
90
134
256
0
268
0
205
136
0
268
0
27...

output:

1 1
297 1
-1 297
1 2
55 1
-55 267
55 2
-55 297
1 3
176 1
-63 176
176 2
-135 176
176 3
-176 297
1 4
1 5
1 6
1 7
186 1
-179 186
186 2
-186 267
1 8
258 1
-135 258
1 9
296 1
-63 296
1 10
178 1
-178 243
178 2
-178 258
1 11
1 12
275 1
-186 275
1 13
278 1
-258 278
1 14
99 1
-99 179
1 15
123 1
-98 123
123 2...

result:

ok 

Test #53:

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

input:

300 90000
7
1
0
96
1
0
162
1
0
105
37
0
96
0
112
88
0
96
0
122
96
0
142
15
0
96
0
220
96
0
232
96
0
270
82
0
162
0
15
37
82
88
115
142
0
143
36
0
77
0
105
0
187
220
0
189
6
0
16
0
105
0
190
104
0
105
0
222
63
0
270
0
253
232
0
6
16
36
63
77
104
136
83
0
189
0
140
190
0
218
15
0
221
93
0
190
0
269
98...

output:

1 1
7 1
-1 7
1 2
96 1
-1 96
1 3
162 1
-1 162
1 4
105 1
-37 105
105 2
-96 105
1 5
112 1
-88 112
112 2
-96 112
1 6
122 1
-96 122
1 7
142 1
-15 142
142 2
-96 142
1 8
220 1
-96 220
1 9
232 1
-96 232
1 10
270 1
-82 270
270 2
-162 270
1 11
1 12
1 13
1 14
1 15
115 1
-115 142
1 16
143 1
-36 143
143 2
-77 14...

result:

ok 

Test #54:

score: 15
Accepted
time: 1ms
memory: 3956kb

input:

300 90000
190
1
0
221
88
0
119
0
122
0
190
0
88
119
122
37
88
0
40
119
0
112
73
0
76
0
119
0
143
88
0
159
9
0
119
0
247
88
0
285
119
0
9
73
76
131
159
0
142
143
0
163
23
0
112
0
213
43
0
159
0
265
47
0
285
0
271
112
0
275
218
0
285
0
20
45
0
76
0
23
43
47
124
127
0
163
0
130
102
0
163
0
203
51
0
133...

output:

1 1
190 1
-1 190
1 2
221 1
-88 221
221 2
-119 221
221 3
-122 221
221 4
-190 221
1 3
1 4
1 5
1 6
37 1
-37 88
1 7
40 1
-40 119
1 8
112 1
-73 112
112 2
-76 112
112 3
-112 119
1 9
143 1
-88 143
1 10
159 1
-9 159
159 2
-119 159
1 11
247 1
-88 247
1 12
285 1
-119 285
1 13
1 14
1 15
1 16
131 1
-131 159
1 1...

result:

ok 

Test #55:

score: 15
Accepted
time: 5ms
memory: 3916kb

input:

300 90000
6
1
0
255
1
0
108
67
0
255
0
179
6
0
67
184
115
0
179
0
115
120
115
0
298
120
0
261
103
0
298
0
103
65
103
0
177
2
0
65
0
2
4
2
0
25
2
0
33
2
0
39
2
0
71
2
0
84
2
0
86
2
0
100
2
0
101
2
0
126
2
0
130
2
0
152
2
0
157
2
0
162
2
0
167
2
0
199
2
0
226
2
0
228
2
0
232
2
0
234
2
0
262
2
0
263
2
...

output:

1 1
6 1
-1 6
1 2
255 1
-1 255
1 3
108 1
-67 108
108 2
-108 255
1 4
179 1
-6 179
1 5
1 6
184 1
-115 184
184 2
-179 184
1 7
1 8
120 1
-115 120
1 9
298 1
-120 298
1 10
261 1
-103 261
261 2
-261 298
1 11
1 12
65 1
-65 103
1 13
177 1
-2 177
177 2
-65 177
1 14
1 15
4 1
-2 4
1 16
25 1
-2 25
1 17
33 1
-2 33...

result:

ok 

Test #56:

score: 15
Accepted
time: 3ms
memory: 3916kb

input:

300 90000
2
1
0
236
1
0
3
2
0
9
2
0
12
2
0
30
2
0
39
2
0
51
2
0
74
2
0
87
2
0
94
2
0
97
2
0
104
2
0
106
2
0
127
2
0
151
2
0
163
2
0
180
2
0
199
2
0
238
2
0
252
2
0
260
55
0
236
0
272
2
0
297
2
0
14
87
0
19
47
0
74
0
20
12
0
25
13
0
199
0
26
44
0
163
0
48
94
0
55
57
168
0
297
0
64
63
0
180
0
73
127
0...

output:

1 1
2 1
-1 2
1 2
236 1
-1 236
1 3
3 1
-2 3
1 4
9 1
-2 9
1 5
12 1
-2 12
1 6
30 1
-2 30
1 7
39 1
-2 39
1 8
51 1
-2 51
1 9
74 1
-2 74
1 10
87 1
-2 87
1 11
94 1
-2 94
1 12
97 1
-2 97
1 13
104 1
-2 104
1 14
106 1
-2 106
1 15
127 1
-2 127
1 16
151 1
-2 151
1 17
163 1
-2 163
1 18
180 1
-2 180
1 19
199 1
-2...

result:

ok 

Test #57:

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

input:

300 90000
103
1
0
231
1
0
193
2
0
231
0
293
103
0
2
244
133
0
293
0
8
2
0
20
2
0
58
2
0
83
2
0
101
2
0
102
2
0
115
2
0
133
139
2
0
149
2
0
165
2
0
178
2
0
198
2
0
203
2
0
205
2
0
221
2
0
228
2
0
243
2
0
250
2
0
261
2
0
290
2
0
294
2
0
298
2
0
5
57
0
115
0
34
169
0
228
0
41
128
0
290
0
47
83
0
51
46
...

output:

1 1
103 1
-1 103
1 2
231 1
-1 231
1 3
193 1
-2 193
193 2
-193 231
1 4
293 1
-103 293
1 5
1 6
244 1
-133 244
244 2
-244 293
1 7
8 1
-2 8
1 8
20 1
-2 20
1 9
58 1
-2 58
1 10
83 1
-2 83
1 11
101 1
-2 101
1 12
102 1
-2 102
1 13
115 1
-2 115
1 14
1 15
139 1
-2 139
1 16
149 1
-2 149
1 17
165 1
-2 165
1 18
...

result:

ok 

Subtask #7:

score: 22
Accepted

Test #58:

score: 22
Accepted
time: 0ms
memory: 3832kb

input:

300 900
201
1
0
228
1
0
171
10
0
137
0
228
0
222
73
0
109
0
228
0
10
73
109
137
37
109
0
76
10
0
162
137
0
215
73
0
258
125
0
137
0
274
73
0
298
53
0
109
0
40
76
0
53
125
182
33
0
215
0
199
76
0
213
85
0
158
0
274
0
221
211
0
260
0
274
0
266
162
0
271
37
0
275
37
0
283
240
0
258
0
33
38
31
0
174
0
2...

output:

1 1
201 1
-1 201
1 2
228 1
-1 228
1 3
171 1
-10 171
171 2
-137 171
171 3
-171 228
1 4
222 1
-73 222
222 2
-109 222
222 3
-222 228
1 5
1 6
1 7
1 8
1 9
37 1
-37 109
1 10
76 1
-10 76
1 11
162 1
-137 162
1 12
215 1
-73 215
1 13
258 1
-125 258
258 2
-137 258
1 14
274 1
-73 274
1 15
298 1
-53 298
298 2
-1...

result:

ok 

Test #59:

score: 22
Accepted
time: 3ms
memory: 3916kb

input:

300 900
58
1
0
104
1
0
139
1
0
246
104
0
269
25
0
34
0
104
0
25
34
203
220
0
230
0
246
0
212
136
0
246
0
10
25
0
66
16
0
34
0
136
215
34
0
220
230
16
40
220
0
47
75
0
136
0
54
158
0
215
0
101
48
0
194
0
230
0
122
105
0
220
0
153
230
0
202
136
0
264
215
0
271
66
0
48
75
105
146
47
0
152
42
0
90
0
271...

output:

1 1
58 1
-1 58
1 2
104 1
-1 104
1 3
139 1
-1 139
1 4
246 1
-104 246
1 5
269 1
-25 269
269 2
-34 269
269 3
-104 269
1 6
1 7
1 8
203 1
-203 220
203 2
-203 230
203 3
-203 246
1 9
212 1
-136 212
212 2
-212 246
1 10
10 1
-10 25
1 11
66 1
-16 66
66 2
-34 66
1 12
1 13
215 1
-34 215
1 14
1 15
1 16
1 17
40 1...

result:

ok 

Test #60:

score: 22
Accepted
time: 5ms
memory: 3856kb

input:

300 900
7
1
0
28
7
0
191
7
0
140
191
0
198
191
0
289
8
0
69
0
140
0
8
69
85
69
0
104
68
0
69
0
258
8
0
68
75
68
0
99
68
0
166
99
0
187
75
0
293
75
0
214
187
0
231
54
0
187
0
54
217
231
0
139
54
0
222
54
0
269
128
0
213
0
217
0
58
222
0
128
213
226
97
0
139
0
80
39
0
128
0
97
249
52
0
128
0
39
52
161...

output:

1 1
7 1
-1 7
1 2
28 1
-7 28
1 3
191 1
-7 191
1 4
140 1
-140 191
1 5
198 1
-191 198
1 6
289 1
-8 289
289 2
-69 289
289 3
-140 289
1 7
1 8
1 9
85 1
-69 85
1 10
104 1
-68 104
104 2
-69 104
1 11
258 1
-8 258
1 12
1 13
75 1
-68 75
1 14
99 1
-68 99
1 15
166 1
-99 166
1 16
187 1
-75 187
1 17
293 1
-75 293
...

result:

ok 

Test #61:

score: 22
Accepted
time: 5ms
memory: 3912kb

input:

300 900
176
1
0
196
1
0
257
1
0
128
49
0
196
0
286
160
0
184
0
196
0
49
160
184
268
15
0
128
0
15
119
49
0
133
137
0
260
0
268
0
271
49
0
65
15
0
137
173
87
0
119
0
198
88
0
102
0
119
0
206
18
0
271
0
222
58
0
172
0
271
0
260
288
15
0
18
58
87
88
102
130
56
0
155
0
173
0
172
273
80
0
206
0
56
80
105...

output:

1 1
176 1
-1 176
1 2
196 1
-1 196
1 3
257 1
-1 257
1 4
128 1
-49 128
128 2
-128 196
1 5
286 1
-160 286
286 2
-184 286
286 3
-196 286
1 6
1 7
1 8
1 9
268 1
-15 268
268 2
-128 268
1 10
1 11
119 1
-49 119
1 12
133 1
-133 137
133 2
-133 260
133 3
-133 268
1 13
271 1
-49 271
1 14
65 1
-15 65
1 15
1 16
17...

result:

ok 

Test #62:

score: 22
Accepted
time: 5ms
memory: 3896kb

input:

300 900
21
1
0
93
1
0
280
1
0
43
93
0
220
54
0
93
0
54
190
220
0
193
27
0
43
0
273
43
0
27
55
183
0
193
0
137
35
0
273
0
262
85
0
149
0
273
0
35
85
116
27
0
143
27
0
149
183
246
55
0
287
56
0
91
0
137
0
41
37
0
149
0
56
86
149
0
91
133
85
0
151
16
0
35
0
163
35
0
200
85
0
16
37
97
133
0
102
200
0
11...

output:

1 1
21 1
-1 21
1 2
93 1
-1 93
1 3
280 1
-1 280
1 4
43 1
-43 93
1 5
220 1
-54 220
220 2
-93 220
1 6
1 7
190 1
-190 220
1 8
193 1
-27 193
193 2
-43 193
1 9
273 1
-43 273
1 10
1 11
55 1
-55 183
55 2
-55 193
1 12
137 1
-35 137
137 2
-137 273
1 13
262 1
-85 262
262 2
-149 262
262 3
-262 273
1 14
1 15
1 1...

result:

ok 

Test #63:

score: 22
Accepted
time: 0ms
memory: 3896kb

input:

300 900
174
1
0
200
1
0
216
1
0
93
53
0
216
0
201
30
0
112
0
216
0
30
53
112
227
93
0
37
53
0
136
53
0
193
60
0
215
0
227
0
249
183
0
227
0
60
96
136
0
162
37
0
183
215
248
37
0
293
136
0
299
58
0
191
0
249
0
15
114
0
215
0
54
19
0
60
0
58
111
50
0
183
0
180
135
0
183
0
191
235
45
0
215
0
288
29
0
6...

output:

1 1
174 1
-1 174
1 2
200 1
-1 200
1 3
216 1
-1 216
1 4
93 1
-53 93
93 2
-93 216
1 5
201 1
-30 201
201 2
-112 201
201 3
-201 216
1 6
1 7
1 8
1 9
227 1
-93 227
1 10
37 1
-37 53
1 11
136 1
-53 136
1 12
193 1
-60 193
193 2
-193 215
193 3
-193 227
1 13
249 1
-183 249
249 2
-227 249
1 14
1 15
96 1
-96 136...

result:

ok 

Test #64:

score: 22
Accepted
time: 0ms
memory: 3816kb

input:

299 897
33
1
0
3
33
0
4
33
0
5
33
0
8
33
0
9
33
0
11
33
0
13
33
0
14
33
0
22
33
0
23
33
0
25
33
0
26
33
0
27
33
0
29
33
0
42
33
0
43
33
0
45
33
0
46
33
0
47
33
0
48
33
0
51
33
0
53
33
0
56
33
0
57
33
0
58
33
0
62
33
0
63
33
0
65
33
0
66
33
0
68
33
0
70
33
0
72
33
0
73
33
0
75
33
0
77
33
0
79
33
0
80...

output:

1 1
33 1
-1 33
1 2
3 1
-3 33
1 3
4 1
-4 33
1 4
5 1
-5 33
1 5
8 1
-8 33
1 6
9 1
-9 33
1 7
11 1
-11 33
1 8
13 1
-13 33
1 9
14 1
-14 33
1 10
22 1
-22 33
1 11
23 1
-23 33
1 12
25 1
-25 33
1 13
26 1
-26 33
1 14
27 1
-27 33
1 15
29 1
-29 33
1 16
42 1
-33 42
1 17
43 1
-33 43
1 18
45 1
-33 45
1 19
46 1
-33 ...

result:

ok 

Test #65:

score: 22
Accepted
time: 0ms
memory: 3812kb

input:

300 900
101
1
0
2
101
0
5
101
0
8
101
0
9
101
0
12
101
0
13
101
0
14
101
0
15
101
0
16
101
0
17
101
0
18
101
0
19
101
0
20
101
0
21
101
0
22
101
0
25
101
0
28
101
0
29
101
0
30
101
0
31
101
0
35
101
0
36
101
0
37
101
0
38
101
0
40
101
0
42
101
0
46
101
0
47
101
0
50
101
0
52
101
0
58
101
0
59
101
0
...

output:

1 1
101 1
-1 101
1 2
2 1
-2 101
1 3
5 1
-5 101
1 4
8 1
-8 101
1 5
9 1
-9 101
1 6
12 1
-12 101
1 7
13 1
-13 101
1 8
14 1
-14 101
1 9
15 1
-15 101
1 10
16 1
-16 101
1 11
17 1
-17 101
1 12
18 1
-18 101
1 13
19 1
-19 101
1 14
20 1
-20 101
1 15
21 1
-21 101
1 16
22 1
-22 101
1 17
25 1
-25 101
1 18
28 1
-...

result:

ok 

Test #66:

score: 22
Accepted
time: 0ms
memory: 3828kb

input:

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

output:

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

result:

ok 

Test #67:

score: 22
Accepted
time: 5ms
memory: 3788kb

input:

300 900
12
1
0
93
12
0
225
93
0
280
225
0
266
255
0
259
0
280
0
289
183
0
221
0
267
0
275
0
280
0
183
221
255
259
267
275
295
210
0
254
0
289
0
129
275
0
172
73
0
136
0
138
0
259
0
177
183
0
185
255
0
210
234
113
0
168
0
173
0
232
0
267
0
238
237
0
255
0
242
130
0
208
0
267
0
246
213
0
230
0
259
0
2...

output:

1 1
12 1
-1 12
1 2
93 1
-12 93
1 3
225 1
-93 225
1 4
280 1
-225 280
1 5
266 1
-255 266
266 2
-259 266
266 3
-266 280
1 6
289 1
-183 289
289 2
-221 289
289 3
-267 289
289 4
-275 289
289 5
-280 289
1 7
1 8
1 9
1 10
1 11
1 12
1 13
295 1
-210 295
295 2
-254 295
295 3
-289 295
1 14
129 1
-129 275
1 15
17...

result:

ok 

Test #68:

score: 22
Accepted
time: 5ms
memory: 3856kb

input:

300 900
110
1
0
36
110
0
284
87
0
110
0
87
252
25
0
284
0
275
89
0
227
0
249
0
272
0
284
0
293
33
0
230
0
263
0
284
0
25
33
34
87
0
89
227
230
249
263
272
291
293
0
295
6
0
215
0
250
0
260
0
283
0
293
0
4
25
0
6
136
249
0
141
131
0
249
0
145
249
0
168
52
0
80
0
272
0
174
249
0
186
137
0
249
0
187
18...

output:

1 1
110 1
-1 110
1 2
36 1
-36 110
1 3
284 1
-87 284
284 2
-110 284
1 4
1 5
252 1
-25 252
252 2
-252 284
1 6
275 1
-89 275
275 2
-227 275
275 3
-249 275
275 4
-272 275
275 5
-275 284
1 7
293 1
-33 293
293 2
-230 293
293 3
-263 293
293 4
-284 293
1 8
1 9
1 10
34 1
-34 87
1 11
1 12
1 13
1 14
1 15
1 16
...

result:

ok 

Test #69:

score: 22
Accepted
time: 0ms
memory: 3952kb

input:

299 897
121
1
0
266
1
0
276
1
0
290
1
0
294
1
0
296
1
0
298
1
0
299
1
0
4
298
0
21
296
0
82
69
0
299
0
94
72
0
276
0
108
294
0
115
290
0
127
296
0
130
41
0
102
0
294
0
139
296
0
169
29
0
298
0
191
290
0
223
290
0
230
67
0
196
0
299
0
236
136
0
299
0
243
20
0
25
0
210
0
225
0
233
0
298
0
244
98
0
159...

output:

1 1
121 1
-1 121
1 2
266 1
-1 266
1 3
276 1
-1 276
1 4
290 1
-1 290
1 5
294 1
-1 294
1 6
296 1
-1 296
1 7
298 1
-1 298
1 8
299 1
-1 299
1 9
4 1
-4 298
1 10
21 1
-21 296
1 11
82 1
-69 82
82 2
-82 299
1 12
94 1
-72 94
94 2
-94 276
1 13
108 1
-108 294
1 14
115 1
-115 290
1 15
127 1
-127 296
1 16
130 1
...

result:

ok 

Test #70:

score: 22
Accepted
time: 0ms
memory: 3916kb

input:

300 900
289
1
0
297
1
0
300
1
0
154
289
0
230
66
0
127
0
289
0
241
159
0
161
0
190
0
297
0
265
238
0
297
0
267
132
0
289
0
273
245
0
300
0
287
52
0
111
0
166
0
189
0
256
0
263
0
275
0
280
0
285
0
289
0
291
170
0
202
0
233
0
239
0
300
0
292
250
0
300
0
294
120
0
297
0
299
158
0
192
0
207
0
237
0
282
...

output:

1 1
289 1
-1 289
1 2
297 1
-1 297
1 3
300 1
-1 300
1 4
154 1
-154 289
1 5
230 1
-66 230
230 2
-127 230
230 3
-230 289
1 6
241 1
-159 241
241 2
-161 241
241 3
-190 241
241 4
-241 297
1 7
265 1
-238 265
265 2
-265 297
1 8
267 1
-132 267
267 2
-267 289
1 9
273 1
-245 273
273 2
-273 300
1 10
287 1
-52 2...

result:

ok 

Test #71:

score: 22
Accepted
time: 2ms
memory: 3872kb

input:

299 897
162
1
0
210
9
0
10
0
11
0
12
0
14
0
15
0
18
0
19
0
21
0
22
0
23
0
25
0
27
0
29
0
34
0
35
0
36
0
42
0
44
0
46
0
47
0
48
0
49
0
50
0
53
0
54
0
55
0
56
0
57
0
58
0
59
0
60
0
61
0
62
0
64
0
65
0
66
0
72
0
74
0
75
0
77
0
79
0
80
0
83
0
84
0
85
0
86
0
88
0
90
0
92
0
95
0
96
0
98
0
99
0
101
0
103
0...

output:

1 1
162 1
-1 162
1 2
210 1
-9 210
210 2
-10 210
210 3
-11 210
210 4
-12 210
210 5
-14 210
210 6
-15 210
210 7
-18 210
210 8
-19 210
210 9
-21 210
210 10
-22 210
210 11
-23 210
210 12
-25 210
210 13
-27 210
210 14
-29 210
210 15
-34 210
210 16
-35 210
210 17
-36 210
210 18
-42 210
210 19
-44 210
210 ...

result:

ok 

Test #72:

score: 22
Accepted
time: 1ms
memory: 3896kb

input:

300 900
286
1
0
87
2
0
5
0
6
0
9
0
11
0
12
0
17
0
24
0
25
0
26
0
29
0
32
0
34
0
35
0
36
0
43
0
45
0
46
0
47
0
48
0
50
0
51
0
53
0
54
0
56
0
57
0
58
0
59
0
62
0
64
0
65
0
67
0
71
0
73
0
76
0
78
0
82
0
84
0
85
0
86
0
88
0
90
0
93
0
95
0
96
0
97
0
98
0
99
0
100
0
101
0
104
0
107
0
108
0
113
0
114
0
116...

output:

1 1
286 1
-1 286
1 2
87 1
-2 87
87 2
-5 87
87 3
-6 87
87 4
-9 87
87 5
-11 87
87 6
-12 87
87 7
-17 87
87 8
-24 87
87 9
-25 87
87 10
-26 87
87 11
-29 87
87 12
-32 87
87 13
-34 87
87 14
-35 87
87 15
-36 87
87 16
-43 87
87 17
-45 87
87 18
-46 87
87 19
-47 87
87 20
-48 87
87 21
-50 87
87 22
-51 87
87 23
...

result:

ok 

Test #73:

score: 22
Accepted
time: 5ms
memory: 3908kb

input:

300 900
103
1
0
231
1
0
193
2
0
231
0
293
103
0
2
244
133
0
293
0
8
2
0
20
2
0
58
2
0
83
2
0
101
2
0
102
2
0
115
2
0
133
139
2
0
149
2
0
165
2
0
178
2
0
198
2
0
203
2
0
205
2
0
221
2
0
228
2
0
243
2
0
250
2
0
261
2
0
290
2
0
294
2
0
298
2
0
5
57
0
115
0
34
169
0
228
0
41
128
0
290
0
47
83
0
51
46
0
...

output:

1 1
103 1
-1 103
1 2
231 1
-1 231
1 3
193 1
-2 193
193 2
-193 231
1 4
293 1
-103 293
1 5
1 6
244 1
-133 244
244 2
-244 293
1 7
8 1
-2 8
1 8
20 1
-2 20
1 9
58 1
-2 58
1 10
83 1
-2 83
1 11
101 1
-2 101
1 12
102 1
-2 102
1 13
115 1
-2 115
1 14
1 15
139 1
-2 139
1 16
149 1
-2 149
1 17
165 1
-2 165
1 18
...

result:

ok 

Test #74:

score: 22
Accepted
time: 0ms
memory: 3948kb

input:

300 900
145
1
0
166
1
0
126
15
0
145
0
210
166
0
15
203
6
0
210
0
3
15
0
5
15
0
6
12
15
0
19
15
0
21
15
0
61
15
0
82
15
0
88
15
0
108
15
0
111
15
0
132
15
0
153
15
0
160
15
0
162
15
0
173
15
0
179
15
0
200
15
0
201
15
0
208
15
0
237
15
0
266
11
0
15
0
288
15
0
11
17
101
0
153
0
25
7
0
162
0
32
3
0
3...

output:

1 1
145 1
-1 145
1 2
166 1
-1 166
1 3
126 1
-15 126
126 2
-126 145
1 4
210 1
-166 210
1 5
1 6
203 1
-6 203
203 2
-203 210
1 7
3 1
-3 15
1 8
5 1
-5 15
1 9
1 10
12 1
-12 15
1 11
19 1
-15 19
1 12
21 1
-15 21
1 13
61 1
-15 61
1 14
82 1
-15 82
1 15
88 1
-15 88
1 16
108 1
-15 108
1 17
111 1
-15 111
1 18
1...

result:

ok 

Test #75:

score: 22
Accepted
time: 0ms
memory: 3828kb

input:

300 900
18
1
0
227
1
0
29
18
0
49
61
0
163
0
227
0
52
53
0
227
0
69
18
0
81
18
0
20
69
0
53
57
29
0
61
97
81
0
163
164
81
0
168
81
0
253
49
0
70
20
0
90
61
0
104
97
0
116
129
0
163
0
141
26
0
61
0
155
35
0
140
0
168
0
158
94
0
164
0
197
61
0
204
97
0
217
53
0
251
53
0
259
38
0
168
0
265
97
0
266
97
...

output:

1 1
18 1
-1 18
1 2
227 1
-1 227
1 3
29 1
-18 29
1 4
49 1
-49 61
49 2
-49 163
49 3
-49 227
1 5
52 1
-52 53
52 2
-52 227
1 6
69 1
-18 69
1 7
81 1
-18 81
1 8
20 1
-20 69
1 9
1 10
57 1
-29 57
1 11
1 12
97 1
-81 97
1 13
1 14
164 1
-81 164
1 15
168 1
-81 168
1 16
253 1
-49 253
1 17
70 1
-20 70
1 18
90 1
-...

result:

ok 

Test #76:

score: 22
Accepted
time: 4ms
memory: 3832kb

input:

300 900
65
1
0
215
1
0
269
1
0
98
53
0
190
0
269
0
100
24
0
265
0
269
0
134
50
0
269
0
24
50
53
190
265
46
26
0
53
0
91
50
0
227
265
0
26
255
46
0
262
46
0
60
7
0
124
0
175
0
182
0
255
0
7
124
175
182
294
60
0
138
182
0
192
124
0
225
175
0
232
7
0
61
232
0
139
232
0
145
232
0
229
157
0
232
0
279
225...

output:

1 1
65 1
-1 65
1 2
215 1
-1 215
1 3
269 1
-1 269
1 4
98 1
-53 98
98 2
-98 190
98 3
-98 269
1 5
100 1
-24 100
100 2
-100 265
100 3
-100 269
1 6
134 1
-50 134
134 2
-134 269
1 7
1 8
1 9
1 10
1 11
1 12
46 1
-26 46
46 2
-46 53
1 13
91 1
-50 91
1 14
227 1
-227 265
1 15
1 16
255 1
-46 255
1 17
262 1
-46 2...

result:

ok 

Test #77:

score: 22
Accepted
time: 3ms
memory: 3888kb

input:

300 900
220
1
0
263
1
0
265
1
0
130
29
0
155
0
265
0
272
263
0
275
248
0
263
0
29
155
248
266
130
0
3
29
0
135
29
0
231
64
0
155
0
271
29
0
297
144
0
266
0
35
135
0
48
271
0
64
86
135
0
140
39
0
135
0
144
180
135
0
197
104
0
135
0
11
34
0
53
0
59
0
64
0
39
62
64
0
104
171
140
0
225
64
0
242
54
0
140...

output:

1 1
220 1
-1 220
1 2
263 1
-1 263
1 3
265 1
-1 265
1 4
130 1
-29 130
130 2
-130 155
130 3
-130 265
1 5
272 1
-263 272
1 6
275 1
-248 275
275 2
-263 275
1 7
1 8
1 9
1 10
266 1
-130 266
1 11
3 1
-3 29
1 12
135 1
-29 135
1 13
231 1
-64 231
231 2
-155 231
1 14
271 1
-29 271
1 15
297 1
-144 297
297 2
-26...

result:

ok 

Test #78:

score: 22
Accepted
time: 0ms
memory: 3892kb

input:

300 900
80
1
0
95
1
0
26
80
0
117
41
0
80
0
295
95
0
41
99
26
0
151
162
0
295
0
278
117
0
143
99
0
150
278
0
162
182
99
0
252
112
0
278
0
104
182
0
112
211
162
0
246
162
0
165
14
0
211
0
200
21
0
89
0
112
0
14
21
89
264
200
0
293
106
0
165
0
36
21
0
106
170
89
0
203
14
0
224
227
0
293
0
218
156
0
20...

output:

1 1
80 1
-1 80
1 2
95 1
-1 95
1 3
26 1
-26 80
1 4
117 1
-41 117
117 2
-80 117
1 5
295 1
-95 295
1 6
1 7
99 1
-26 99
1 8
151 1
-151 162
151 2
-151 295
1 9
278 1
-117 278
1 10
143 1
-99 143
1 11
150 1
-150 278
1 12
1 13
182 1
-99 182
1 14
252 1
-112 252
252 2
-252 278
1 15
104 1
-104 182
1 16
1 17
211...

result:

ok 

Test #79:

score: 22
Accepted
time: 3ms
memory: 3892kb

input:

300 900
35
1
0
133
13
0
35
0
13
94
133
0
101
133
0
221
133
0
259
133
0
41
10
0
13
0
54
13
0
58
13
0
62
13
0
67
13
0
77
9
0
13
0
182
56
0
94
0
193
13
0
243
40
0
94
0
252
221
0
274
94
0
297
94
0
9
10
15
77
0
21
77
0
33
29
0
58
0
40
50
67
0
52
20
0
58
0
56
60
67
0
76
77
0
86
54
0
104
106
0
134
0
193
0
...

output:

1 1
35 1
-1 35
1 2
133 1
-13 133
133 2
-35 133
1 3
1 4
94 1
-94 133
1 5
101 1
-101 133
1 6
221 1
-133 221
1 7
259 1
-133 259
1 8
41 1
-10 41
41 2
-13 41
1 9
54 1
-13 54
1 10
58 1
-13 58
1 11
62 1
-13 62
1 12
67 1
-13 67
1 13
77 1
-9 77
77 2
-13 77
1 14
182 1
-56 182
182 2
-94 182
1 15
193 1
-13 193
...

result:

ok 

Test #80:

score: 22
Accepted
time: 0ms
memory: 3888kb

input:

300 900
196
1
0
64
196
0
90
196
0
246
114
0
127
0
182
0
196
0
287
17
0
61
0
196
0
288
196
0
17
61
114
127
182
217
288
0
258
287
0
277
287
0
286
245
0
246
0
16
114
0
48
182
0
49
5
0
61
0
57
114
0
100
30
0
63
0
73
0
182
0
165
17
0
167
127
0
173
11
0
54
0
104
0
182
0
245
260
127
0
289
127
0
5
11
30
54
...

output:

1 1
196 1
-1 196
1 2
64 1
-64 196
1 3
90 1
-90 196
1 4
246 1
-114 246
246 2
-127 246
246 3
-182 246
246 4
-196 246
1 5
287 1
-17 287
287 2
-61 287
287 3
-196 287
1 6
288 1
-196 288
1 7
1 8
1 9
1 10
1 11
1 12
217 1
-217 288
1 13
258 1
-258 287
1 14
277 1
-277 287
1 15
286 1
-245 286
286 2
-246 286
1 ...

result:

ok 

Test #81:

score: 22
Accepted
time: 4ms
memory: 3812kb

input:

300 900
145
1
0
166
1
0
126
15
0
145
0
210
166
0
15
203
6
0
210
0
3
15
0
5
15
0
6
12
15
0
19
15
0
21
15
0
61
15
0
82
15
0
88
15
0
108
15
0
111
15
0
132
15
0
153
15
0
160
15
0
162
15
0
173
15
0
179
15
0
200
15
0
201
15
0
208
15
0
237
15
0
266
11
0
15
0
288
15
0
11
17
101
0
153
0
25
7
0
162
0
32
3
0
3...

output:

1 1
145 1
-1 145
1 2
166 1
-1 166
1 3
126 1
-15 126
126 2
-126 145
1 4
210 1
-166 210
1 5
1 6
203 1
-6 203
203 2
-203 210
1 7
3 1
-3 15
1 8
5 1
-5 15
1 9
1 10
12 1
-12 15
1 11
19 1
-15 19
1 12
21 1
-15 21
1 13
61 1
-15 61
1 14
82 1
-15 82
1 15
88 1
-15 88
1 16
108 1
-15 108
1 17
111 1
-15 111
1 18
1...

result:

ok 

Test #82:

score: 22
Accepted
time: 5ms
memory: 3892kb

input:

300 900
45
1
0
95
1
0
2
6
0
33
0
50
0
51
0
63
0
82
0
86
0
95
0
65
45
0
6
33
50
51
63
82
86
97
65
0
101
2
0
109
2
0
117
2
0
122
2
0
149
2
0
162
2
0
163
2
0
184
2
0
201
2
0
219
2
0
228
2
0
233
2
0
249
2
0
4
82
0
8
164
0
233
0
9
162
0
17
94
0
201
0
31
33
0
44
184
0
67
163
0
116
109
0
134
149
0
144
228
...

output:

1 1
45 1
-1 45
1 2
95 1
-1 95
1 3
2 1
-2 6
2 2
-2 33
2 3
-2 50
2 4
-2 51
2 5
-2 63
2 6
-2 82
2 7
-2 86
2 8
-2 95
1 4
65 1
-45 65
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
97 1
-65 97
1 13
101 1
-2 101
1 14
109 1
-2 109
1 15
117 1
-2 117
1 16
122 1
-2 122
1 17
149 1
-2 149
1 18
162 1
-2 162
1 19
163 1
-2 16...

result:

ok 

Test #83:

score: 22
Accepted
time: 6ms
memory: 3876kb

input:

300 900
41
1
0
76
1
0
198
76
0
81
180
0
198
0
180
202
180
0
291
202
0
239
131
0
291
0
131
36
2
0
131
0
2
24
2
0
37
2
0
44
2
0
80
2
0
90
2
0
95
2
0
99
2
0
101
2
0
103
2
0
114
2
0
119
2
0
136
2
0
139
2
0
148
2
0
177
2
0
179
2
0
192
2
0
225
2
0
230
2
0
261
2
0
284
2
0
285
2
0
286
2
0
5
21
0
148
0
35
19...

output:

1 1
41 1
-1 41
1 2
76 1
-1 76
1 3
198 1
-76 198
1 4
81 1
-81 180
81 2
-81 198
1 5
1 6
202 1
-180 202
1 7
291 1
-202 291
1 8
239 1
-131 239
239 2
-239 291
1 9
1 10
36 1
-2 36
36 2
-36 131
1 11
1 12
24 1
-2 24
1 13
37 1
-2 37
1 14
44 1
-2 44
1 15
80 1
-2 80
1 16
90 1
-2 90
1 17
95 1
-2 95
1 18
99 1
-2...

result:

ok 

Subtask #8:

score: 28
Accepted

Test #84:

score: 28
Accepted
time: 5ms
memory: 3852kb

input:

299 598
86
1
0
94
1
0
224
94
0
245
94
0
181
245
0
203
245
0
240
84
0
92
0
224
0
247
224
0
84
92
246
34
0
203
0
261
181
0
270
181
0
15
14
0
92
0
20
8
0
28
0
92
0
34
172
30
0
84
0
276
169
0
270
0
8
14
28
30
169
217
15
0
127
30
0
139
169
0
170
169
0
189
28
0
206
8
0
233
30
0
289
28
0
113
59
0
176
0
206...

output:

1 1
86 1
-1 86
1 2
94 1
-1 94
1 3
224 1
-94 224
1 4
245 1
-94 245
1 5
181 1
-181 245
1 6
203 1
-203 245
1 7
240 1
-84 240
240 2
-92 240
240 3
-224 240
1 8
247 1
-224 247
1 9
1 10
1 11
246 1
-34 246
246 2
-203 246
1 12
261 1
-181 261
1 13
270 1
-181 270
1 14
15 1
-14 15
15 2
-15 92
1 15
20 1
-8 20
20...

result:

ok 

Test #85:

score: 28
Accepted
time: 0ms
memory: 3952kb

input:

300 600
247
1
0
299
136
0
168
0
247
0
136
168
151
168
0
218
136
0
269
112
0
136
0
112
240
145
0
235
0
269
0
145
230
112
0
235
60
94
0
145
0
294
145
0
94
171
60
0
229
294
0
282
63
0
115
0
294
0
63
115
289
36
0
105
0
171
0
36
53
63
0
105
223
63
0
2
105
0
91
8
0
40
0
223
0
102
36
0
152
105
0
210
223
0
...

output:

1 1
247 1
-1 247
1 2
299 1
-136 299
299 2
-168 299
299 3
-247 299
1 3
1 4
1 5
151 1
-151 168
1 6
218 1
-136 218
1 7
269 1
-112 269
269 2
-136 269
1 8
1 9
240 1
-145 240
240 2
-235 240
240 3
-240 269
1 10
1 11
230 1
-112 230
1 12
1 13
60 1
-60 94
60 2
-60 145
1 14
294 1
-145 294
1 15
1 16
171 1
-60 1...

result:

ok 

Test #86:

score: 28
Accepted
time: 0ms
memory: 3916kb

input:

300 600
42
1
0
263
1
0
31
263
0
68
214
0
219
0
263
0
214
219
230
199
0
214
0
199
34
199
0
208
199
0
215
108
0
127
0
208
0
108
127
153
127
0
225
108
0
257
108
0
131
257
0
138
225
0
154
88
0
106
0
153
0
170
46
0
153
0
277
225
0
46
88
106
237
138
0
242
91
0
277
0
29
106
0
36
88
0
91
224
88
0
289
106
0
...

output:

1 1
42 1
-1 42
1 2
263 1
-1 263
1 3
31 1
-31 263
1 4
68 1
-68 214
68 2
-68 219
68 3
-68 263
1 5
1 6
1 7
230 1
-199 230
230 2
-214 230
1 8
1 9
34 1
-34 199
1 10
208 1
-199 208
1 11
215 1
-108 215
215 2
-127 215
215 3
-208 215
1 12
1 13
1 14
153 1
-127 153
1 15
225 1
-108 225
1 16
257 1
-108 257
1 17
...

result:

ok 

Test #87:

score: 28
Accepted
time: 5ms
memory: 3896kb

input:

300 600
63
1
0
172
1
0
163
63
0
173
44
0
60
0
172
0
44
60
43
5
0
44
0
285
44
0
5
222
67
0
194
0
285
0
242
216
0
228
0
285
0
293
23
0
43
0
23
67
131
174
0
227
0
293
0
194
216
228
2
71
0
228
0
11
23
0
12
87
0
143
0
216
0
88
216
0
166
67
0
174
227
71
87
96
174
0
112
81
0
118
0
227
0
143
287
2
0
6
71
0
...

output:

1 1
63 1
-1 63
1 2
172 1
-1 172
1 3
163 1
-63 163
1 4
173 1
-44 173
173 2
-60 173
173 3
-172 173
1 5
1 6
1 7
43 1
-5 43
43 2
-43 44
1 8
285 1
-44 285
1 9
1 10
222 1
-67 222
222 2
-194 222
222 3
-222 285
1 11
242 1
-216 242
242 2
-228 242
242 3
-242 285
1 12
293 1
-23 293
293 2
-43 293
1 13
1 14
1 15...

result:

ok 

Test #88:

score: 28
Accepted
time: 0ms
memory: 3912kb

input:

299 598
112
1
0
3
41
0
109
0
112
0
32
112
0
41
109
127
26
0
96
0
109
0
154
41
0
188
41
0
246
99
0
109
0
26
96
99
162
110
0
132
0
246
0
35
99
0
80
99
0
104
26
0
108
96
0
110
132
206
26
0
298
96
0
36
174
0
205
0
206
0
98
104
0
143
23
0
108
0
161
133
0
134
0
298
0
192
104
0
204
51
0
281
0
298
0
218
15
...

output:

1 1
112 1
-1 112
1 2
3 1
-3 41
3 2
-3 109
3 3
-3 112
1 3
32 1
-32 112
1 4
1 5
1 6
127 1
-26 127
127 2
-96 127
127 3
-109 127
1 7
154 1
-41 154
1 8
188 1
-41 188
1 9
246 1
-99 246
246 2
-109 246
1 10
1 11
1 12
1 13
162 1
-110 162
162 2
-132 162
162 3
-162 246
1 14
35 1
-35 99
1 15
80 1
-80 99
1 16
10...

result:

ok 

Test #89:

score: 28
Accepted
time: 4ms
memory: 3856kb

input:

300 600
77
1
0
246
1
0
259
1
0
76
17
0
199
0
246
0
162
6
0
77
0
214
153
0
259
0
249
39
0
45
0
246
0
285
22
0
77
0
295
62
0
116
0
259
0
6
17
22
39
45
62
105
190
0
240
0
285
0
116
153
199
271
108
0
162
0
277
10
0
146
0
214
0
10
12
39
0
60
199
0
63
62
0
71
153
0
92
153
0
96
22
0
100
17
0
108
146
147
17...

output:

1 1
77 1
-1 77
1 2
246 1
-1 246
1 3
259 1
-1 259
1 4
76 1
-17 76
76 2
-76 199
76 3
-76 246
1 5
162 1
-6 162
162 2
-77 162
1 6
214 1
-153 214
214 2
-214 259
1 7
249 1
-39 249
249 2
-45 249
249 3
-246 249
1 8
285 1
-22 285
285 2
-77 285
1 9
295 1
-62 295
295 2
-116 295
295 3
-259 295
1 10
1 11
1 12
1 ...

result:

ok 

Test #90:

score: 28
Accepted
time: 0ms
memory: 3896kb

input:

300 600
149
1
0
174
79
0
137
0
149
0
79
137
20
56
0
67
0
137
0
98
137
0
56
67
182
34
0
98
0
233
98
0
34
119
40
0
65
0
67
0
140
182
0
150
67
0
231
6
0
56
0
244
233
0
245
29
0
56
0
255
233
0
6
29
40
65
92
76
0
150
0
124
33
0
150
0
261
49
0
63
0
231
0
270
175
0
245
0
13
6
0
33
49
63
76
101
27
0
65
0
11...

output:

1 1
149 1
-1 149
1 2
174 1
-79 174
174 2
-137 174
174 3
-149 174
1 3
1 4
1 5
20 1
-20 56
20 2
-20 67
20 3
-20 137
1 6
98 1
-98 137
1 7
1 8
1 9
182 1
-34 182
182 2
-98 182
1 10
233 1
-98 233
1 11
1 12
119 1
-40 119
119 2
-65 119
119 3
-67 119
1 13
140 1
-140 182
1 14
150 1
-67 150
1 15
231 1
-6 231
2...

result:

ok 

Test #91:

score: 28
Accepted
time: 2ms
memory: 3956kb

input:

300 600
156
1
0
227
1
0
264
1
0
13
32
0
156
0
89
112
0
264
0
95
105
0
264
0
103
49
0
156
0
188
166
0
227
0
192
154
0
227
0
32
49
105
112
154
166
167
103
0
199
13
0
249
192
0
273
95
0
288
188
0
297
35
0
89
0
4
32
0
25
32
0
26
106
0
112
0
35
63
154
0
80
112
0
111
92
0
173
0
273
0
123
19
0
110
0
273
0
...

output:

1 1
156 1
-1 156
1 2
227 1
-1 227
1 3
264 1
-1 264
1 4
13 1
-13 32
13 2
-13 156
1 5
89 1
-89 112
89 2
-89 264
1 6
95 1
-95 105
95 2
-95 264
1 7
103 1
-49 103
103 2
-103 156
1 8
188 1
-166 188
188 2
-188 227
1 9
192 1
-154 192
192 2
-192 227
1 10
1 11
1 12
1 13
1 14
1 15
1 16
167 1
-103 167
1 17
199 ...

result:

ok 

Test #92:

score: 28
Accepted
time: 0ms
memory: 3952kb

input:

299 598
166
1
0
3
166
0
4
166
0
5
166
0
6
166
0
7
166
0
9
166
0
10
166
0
12
166
0
17
166
0
23
166
0
25
166
0
27
166
0
28
166
0
29
166
0
30
166
0
31
166
0
32
166
0
33
166
0
34
166
0
35
166
0
36
166
0
37
166
0
38
166
0
40
166
0
41
166
0
43
166
0
45
166
0
46
166
0
50
166
0
51
166
0
54
166
0
55
166
0
56...

output:

1 1
166 1
-1 166
1 2
3 1
-3 166
1 3
4 1
-4 166
1 4
5 1
-5 166
1 5
6 1
-6 166
1 6
7 1
-7 166
1 7
9 1
-9 166
1 8
10 1
-10 166
1 9
12 1
-12 166
1 10
17 1
-17 166
1 11
23 1
-23 166
1 12
25 1
-25 166
1 13
27 1
-27 166
1 14
28 1
-28 166
1 15
29 1
-29 166
1 16
30 1
-30 166
1 17
31 1
-31 166
1 18
32 1
-32 1...

result:

ok 

Test #93:

score: 28
Accepted
time: 0ms
memory: 3952kb

input:

300 600
272
1
0
2
272
0
3
272
0
4
272
0
5
272
0
6
272
0
7
272
0
8
272
0
10
272
0
12
272
0
13
272
0
14
272
0
17
272
0
20
272
0
21
272
0
22
272
0
24
272
0
25
272
0
26
272
0
27
272
0
28
272
0
32
272
0
33
272
0
35
272
0
36
272
0
37
272
0
38
272
0
39
272
0
41
272
0
42
272
0
43
272
0
44
272
0
46
272
0
47
...

output:

1 1
272 1
-1 272
1 2
2 1
-2 272
1 3
3 1
-3 272
1 4
4 1
-4 272
1 5
5 1
-5 272
1 6
6 1
-6 272
1 7
7 1
-7 272
1 8
8 1
-8 272
1 9
10 1
-10 272
1 10
12 1
-12 272
1 11
13 1
-13 272
1 12
14 1
-14 272
1 13
17 1
-17 272
1 14
20 1
-20 272
1 15
21 1
-21 272
1 16
22 1
-22 272
1 17
24 1
-24 272
1 18
25 1
-25 272...

result:

ok 

Test #94:

score: 28
Accepted
time: 2ms
memory: 3776kb

input:

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

output:

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

result:

ok 

Test #95:

score: 28
Accepted
time: 3ms
memory: 3956kb

input:

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

output:

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

result:

ok 

Test #96:

score: 28
Accepted
time: 5ms
memory: 3904kb

input:

300 600
55
1
0
95
55
0
212
95
0
264
137
0
212
0
137
253
264
0
284
161
0
162
0
193
0
241
0
251
0
264
0
161
162
193
241
251
274
250
0
272
0
284
0
288
152
0
269
0
279
0
280
0
283
0
284
0
61
162
0
122
30
0
161
0
152
250
269
272
279
280
283
294
194
0
225
0
288
0
12
152
0
19
152
0
30
57
36
0
51
0
152
0
14...

output:

1 1
55 1
-1 55
1 2
95 1
-55 95
1 3
212 1
-95 212
1 4
264 1
-137 264
264 2
-212 264
1 5
1 6
253 1
-253 264
1 7
284 1
-161 284
284 2
-162 284
284 3
-193 284
284 4
-241 284
284 5
-251 284
284 6
-264 284
1 8
1 9
1 10
1 11
1 12
1 13
274 1
-250 274
274 2
-272 274
274 3
-274 284
1 14
288 1
-152 288
288 2
-...

result:

ok 

Test #97:

score: 28
Accepted
time: 0ms
memory: 3776kb

input:

300 600
274
1
0
231
104
0
274
0
232
153
0
224
0
274
0
238
274
0
288
197
0
211
0
273
0
274
0
104
153
197
211
224
273
290
194
0
195
0
264
0
288
0
49
224
0
106
153
0
112
273
0
116
211
0
141
153
0
175
273
0
182
43
0
172
0
224
0
194
195
202
110
0
181
0
273
0
264
291
57
0
70
0
115
0
289
0
290
0
43
57
70
8...

output:

1 1
274 1
-1 274
1 2
231 1
-104 231
231 2
-231 274
1 3
232 1
-153 232
232 2
-224 232
232 3
-232 274
1 4
238 1
-238 274
1 5
288 1
-197 288
288 2
-211 288
288 3
-273 288
288 4
-274 288
1 6
1 7
1 8
1 9
1 10
1 11
1 12
290 1
-194 290
290 2
-195 290
290 3
-264 290
290 4
-288 290
1 13
49 1
-49 224
1 14
106...

result:

ok 

Test #98:

score: 28
Accepted
time: 0ms
memory: 3788kb

input:

299 598
297
1
0
298
1
0
299
1
0
294
297
0
295
292
0
293
0
297
0
296
297
0
292
293
290
287
0
289
0
292
0
291
288
0
292
0
287
288
289
285
284
0
288
0
286
289
0
284
281
279
0
284
0
282
284
0
283
280
0
284
0
279
280
278
275
0
276
0
277
0
279
0
275
276
277
272
270
0
275
0
273
271
0
276
0
274
276
0
270
27...

output:

1 1
297 1
-1 297
1 2
298 1
-1 298
1 3
299 1
-1 299
1 4
294 1
-294 297
1 5
295 1
-292 295
295 2
-293 295
295 3
-295 297
1 6
296 1
-296 297
1 7
1 8
1 9
290 1
-287 290
290 2
-289 290
290 3
-290 292
1 10
291 1
-288 291
291 2
-291 292
1 11
1 12
1 13
1 14
285 1
-284 285
285 2
-285 288
1 15
286 1
-286 289
...

result:

ok 

Test #99:

score: 28
Accepted
time: 0ms
memory: 3812kb

input:

300 600
298
1
0
299
1
0
300
1
0
295
294
0
298
0
296
293
0
299
0
297
300
0
293
294
290
287
0
289
0
293
0
292
291
0
294
0
287
289
291
285
282
0
284
0
287
0
286
289
0
288
291
0
282
284
280
278
0
282
0
283
281
0
284
0
278
281
279
277
0
281
0
277
274
271
0
273
0
277
0
275
272
0
277
0
276
277
0
271
272
27...

output:

1 1
298 1
-1 298
1 2
299 1
-1 299
1 3
300 1
-1 300
1 4
295 1
-294 295
295 2
-295 298
1 5
296 1
-293 296
296 2
-296 299
1 6
297 1
-297 300
1 7
1 8
1 9
290 1
-287 290
290 2
-289 290
290 3
-290 293
1 10
292 1
-291 292
292 2
-292 294
1 11
1 12
1 13
1 14
285 1
-282 285
285 2
-284 285
285 3
-285 287
1 15
...

result:

ok 

Test #100:

score: 28
Accepted
time: 5ms
memory: 3836kb

input:

300 600
211
1
0
283
1
0
300
1
0
195
160
0
211
0
240
230
0
300
0
260
300
0
266
259
0
300
0
282
300
0
296
234
0
237
0
300
0
299
162
0
193
0
285
0
290
0
298
0
300
0
160
162
193
230
234
237
259
285
290
298
34
160
0
45
22
0
162
0
51
162
0
71
11
0
15
0
162
0
88
32
0
57
0
237
0
147
43
0
285
0
148
298
0
153...

output:

1 1
211 1
-1 211
1 2
283 1
-1 283
1 3
300 1
-1 300
1 4
195 1
-160 195
195 2
-195 211
1 5
240 1
-230 240
240 2
-240 300
1 6
260 1
-260 300
1 7
266 1
-259 266
266 2
-266 300
1 8
282 1
-282 300
1 9
296 1
-234 296
296 2
-237 296
296 3
-296 300
1 10
299 1
-162 299
299 2
-193 299
299 3
-285 299
299 4
-290...

result:

ok 

Test #101:

score: 28
Accepted
time: 5ms
memory: 3892kb

input:

300 600
77
1
0
190
1
0
285
1
0
297
1
0
300
1
0
62
297
0
80
285
0
89
2
0
190
0
101
300
0
195
67
0
297
0
259
14
0
146
0
208
0
230
0
285
0
268
75
0
174
0
285
0
270
196
0
231
0
254
0
264
0
285
0
288
201
0
280
0
297
0
294
261
0
273
0
300
0
298
265
0
289
0
295
0
300
0
299
66
0
223
0
291
0
293
0
296
0
300
...

output:

1 1
77 1
-1 77
1 2
190 1
-1 190
1 3
285 1
-1 285
1 4
297 1
-1 297
1 5
300 1
-1 300
1 6
62 1
-62 297
1 7
80 1
-80 285
1 8
89 1
-2 89
89 2
-89 190
1 9
101 1
-101 300
1 10
195 1
-67 195
195 2
-195 297
1 11
259 1
-14 259
259 2
-146 259
259 3
-208 259
259 4
-230 259
259 5
-259 285
1 12
268 1
-75 268
268 ...

result:

ok 

Test #102:

score: 28
Accepted
time: 0ms
memory: 3964kb

input:

299 598
61
1
0
218
1
0
2
172
0
218
0
4
27
0
218
0
9
54
0
218
0
10
100
0
218
0
12
6
0
218
0
13
8
0
218
0
14
15
0
218
0
16
198
0
218
0
17
128
0
218
0
20
115
0
218
0
22
218
0
23
218
0
25
155
0
218
0
26
218
0
28
196
0
218
0
29
218
0
31
166
0
218
0
32
153
0
218
0
35
218
0
36
40
0
218
0
37
34
0
218
0
38
4...

output:

1 1
61 1
-1 61
1 2
218 1
-1 218
1 3
2 1
-2 172
2 2
-2 218
1 4
4 1
-4 27
4 2
-4 218
1 5
9 1
-9 54
9 2
-9 218
1 6
10 1
-10 100
10 2
-10 218
1 7
12 1
-6 12
12 2
-12 218
1 8
13 1
-8 13
13 2
-13 218
1 9
14 1
-14 15
14 2
-14 218
1 10
16 1
-16 198
16 2
-16 218
1 11
17 1
-17 128
17 2
-17 218
1 12
20 1
-20 1...

result:

ok 

Test #103:

score: 28
Accepted
time: 0ms
memory: 3952kb

input:

300 600
201
1
0
263
4
0
7
0
11
0
16
0
18
0
19
0
20
0
21
0
27
0
28
0
30
0
38
0
39
0
40
0
43
0
44
0
47
0
48
0
51
0
52
0
53
0
56
0
57
0
58
0
59
0
60
0
63
0
64
0
65
0
66
0
67
0
68
0
69
0
70
0
72
0
73
0
74
0
78
0
81
0
83
0
85
0
86
0
87
0
94
0
95
0
98
0
101
0
102
0
106
0
108
0
109
0
110
0
111
0
113
0
116
...

output:

1 1
201 1
-1 201
1 2
263 1
-4 263
263 2
-7 263
263 3
-11 263
263 4
-16 263
263 5
-18 263
263 6
-19 263
263 7
-20 263
263 8
-21 263
263 9
-27 263
263 10
-28 263
263 11
-30 263
263 12
-38 263
263 13
-39 263
263 14
-40 263
263 15
-43 263
263 16
-44 263
263 17
-47 263
263 18
-48 263
263 19
-51 263
263 2...

result:

ok 

Test #104:

score: 28
Accepted
time: 0ms
memory: 3960kb

input:

299 598
2
1
0
223
1
0
5
2
0
15
2
0
39
2
0
51
2
0
52
2
0
69
2
0
118
2
0
131
2
0
154
2
0
170
2
0
172
2
0
178
2
0
181
2
0
187
136
0
223
0
188
2
0
192
2
0
210
2
0
244
2
0
253
2
0
259
2
0
260
2
0
264
2
0
277
2
0
296
2
0
25
51
0
35
215
0
296
0
37
80
0
118
0
48
52
0
54
131
0
56
145
0
154
0
64
150
0
259
0
1...

output:

1 1
2 1
-1 2
1 2
223 1
-1 223
1 3
5 1
-2 5
1 4
15 1
-2 15
1 5
39 1
-2 39
1 6
51 1
-2 51
1 7
52 1
-2 52
1 8
69 1
-2 69
1 9
118 1
-2 118
1 10
131 1
-2 131
1 11
154 1
-2 154
1 12
170 1
-2 170
1 13
172 1
-2 172
1 14
178 1
-2 178
1 15
181 1
-2 181
1 16
187 1
-136 187
187 2
-187 223
1 17
188 1
-2 188
1 18...

result:

ok 

Test #105:

score: 28
Accepted
time: 0ms
memory: 3964kb

input:

300 600
41
1
0
76
1
0
198
76
0
81
180
0
198
0
180
202
180
0
291
202
0
239
131
0
291
0
131
36
2
0
131
0
2
24
2
0
37
2
0
44
2
0
80
2
0
90
2
0
95
2
0
99
2
0
101
2
0
103
2
0
114
2
0
119
2
0
136
2
0
139
2
0
148
2
0
177
2
0
179
2
0
192
2
0
225
2
0
230
2
0
261
2
0
284
2
0
285
2
0
286
2
0
5
21
0
148
0
35
19...

output:

1 1
41 1
-1 41
1 2
76 1
-1 76
1 3
198 1
-76 198
1 4
81 1
-81 180
81 2
-81 198
1 5
1 6
202 1
-180 202
1 7
291 1
-202 291
1 8
239 1
-131 239
239 2
-239 291
1 9
1 10
36 1
-2 36
36 2
-36 131
1 11
1 12
24 1
-2 24
1 13
37 1
-2 37
1 14
44 1
-2 44
1 15
80 1
-2 80
1 16
90 1
-2 90
1 17
95 1
-2 95
1 18
99 1
-2...

result:

ok 

Test #106:

score: 28
Accepted
time: 0ms
memory: 3952kb

input:

299 598
135
1
0
193
37
0
54
0
80
0
128
0
135
0
37
54
80
128
32
37
0
103
80
0
111
80
0
149
128
0
197
26
0
37
0
213
37
0
245
24
0
37
0
24
26
67
197
0
87
63
0
245
0
138
136
0
149
0
171
2
0
32
0
175
213
0
221
32
0
2
63
136
151
138
0
164
26
0
209
26
0
293
11
0
26
0
11
19
25
0
136
0
89
2
0
160
9
0
34
0
13...

output:

1 1
135 1
-1 135
1 2
193 1
-37 193
193 2
-54 193
193 3
-80 193
193 4
-128 193
193 5
-135 193
1 3
1 4
1 5
1 6
1 7
32 1
-32 37
1 8
103 1
-80 103
1 9
111 1
-80 111
1 10
149 1
-128 149
1 11
197 1
-26 197
197 2
-37 197
1 12
213 1
-37 213
1 13
245 1
-24 245
245 2
-37 245
1 14
1 15
1 16
67 1
-67 197
1 17
8...

result:

ok 

Test #107:

score: 28
Accepted
time: 2ms
memory: 3828kb

input:

300 600
224
1
0
283
1
0
71
31
0
283
0
108
162
0
283
0
157
283
0
31
162
55
31
0
195
162
0
204
31
0
240
63
0
162
0
56
55
0
63
158
204
0
196
55
0
271
55
0
122
166
0
196
0
210
46
0
86
0
181
0
196
0
236
196
0
263
38
0
196
0
284
40
0
101
0
271
0
38
40
46
86
101
166
181
238
236
0
260
263
0
272
210
0
288
20...

output:

1 1
224 1
-1 224
1 2
283 1
-1 283
1 3
71 1
-31 71
71 2
-71 283
1 4
108 1
-108 162
108 2
-108 283
1 5
157 1
-157 283
1 6
1 7
1 8
55 1
-31 55
1 9
195 1
-162 195
1 10
204 1
-31 204
1 11
240 1
-63 240
240 2
-162 240
1 12
56 1
-55 56
1 13
1 14
158 1
-158 204
1 15
196 1
-55 196
1 16
271 1
-55 271
1 17
122...

result:

ok 

Test #108:

score: 28
Accepted
time: 0ms
memory: 3912kb

input:

300 600
249
1
0
81
249
0
92
102
0
226
0
249
0
157
19
0
249
0
191
242
0
249
0
19
102
226
242
9
102
0
39
102
0
88
19
0
93
19
0
63
13
0
93
0
124
9
0
13
178
63
0
206
63
0
245
63
0
210
141
0
178
0
293
178
0
141
12
89
0
141
0
53
15
0
141
0
219
141
0
296
118
0
141
0
15
89
118
188
68
0
296
0
205
127
0
168
0...

output:

1 1
249 1
-1 249
1 2
81 1
-81 249
1 3
92 1
-92 102
92 2
-92 226
92 3
-92 249
1 4
157 1
-19 157
157 2
-157 249
1 5
191 1
-191 242
191 2
-191 249
1 6
1 7
1 8
1 9
1 10
9 1
-9 102
1 11
39 1
-39 102
1 12
88 1
-19 88
1 13
93 1
-19 93
1 14
63 1
-13 63
63 2
-63 93
1 15
124 1
-9 124
1 16
1 17
178 1
-63 178
1...

result:

ok 

Test #109:

score: 28
Accepted
time: 6ms
memory: 3920kb

input:

300 600
182
1
0
161
39
0
47
0
62
0
138
0
182
0
210
38
0
142
0
148
0
182
0
38
39
47
62
138
142
148
228
210
0
265
161
0
64
142
0
76
138
0
147
5
0
47
0
191
30
0
181
0
230
0
265
0
252
39
0
253
19
0
38
0
269
10
0
62
0
5
10
19
30
170
253
0
173
147
0
181
230
18
30
0
31
135
0
213
0
230
0
77
19
0
78
30
0
89
...

output:

1 1
182 1
-1 182
1 2
161 1
-39 161
161 2
-47 161
161 3
-62 161
161 4
-138 161
161 5
-161 182
1 3
210 1
-38 210
210 2
-142 210
210 3
-148 210
210 4
-182 210
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
228 1
-210 228
1 12
265 1
-161 265
1 13
64 1
-64 142
1 14
76 1
-76 138
1 15
147 1
-5 147
147 2
-47 147
1 16
19...

result:

ok 

Test #110:

score: 28
Accepted
time: 0ms
memory: 3960kb

input:

299 598
273
1
0
19
102
0
273
0
168
95
0
273
0
95
102
109
95
0
178
9
0
27
0
95
0
205
102
0
9
27
125
205
0
272
109
0
283
109
0
115
257
0
272
0
129
9
0
257
259
129
0
286
108
0
129
0
97
245
0
257
0
108
175
145
0
286
0
144
108
0
145
245
10
145
0
153
53
0
145
0
248
63
0
135
0
245
0
53
63
135
218
153
0
142...

output:

1 1
273 1
-1 273
1 2
19 1
-19 102
19 2
-19 273
1 3
168 1
-95 168
168 2
-168 273
1 4
1 5
1 6
109 1
-95 109
1 7
178 1
-9 178
178 2
-27 178
178 3
-95 178
1 8
205 1
-102 205
1 9
1 10
1 11
125 1
-125 205
1 12
272 1
-109 272
1 13
283 1
-109 283
1 14
115 1
-115 257
115 2
-115 272
1 15
129 1
-9 129
1 16
1 1...

result:

ok 

Test #111:

score: 28
Accepted
time: 0ms
memory: 3772kb

input:

300 600
141
1
0
264
141
0
267
104
0
141
0
104
215
123
0
267
0
232
90
0
264
0
90
123
142
90
0
218
123
0
244
90
0
133
58
0
218
0
219
64
0
111
0
244
0
230
191
0
218
0
58
64
111
191
86
111
0
134
191
0
193
58
0
286
64
0
205
13
0
54
0
71
0
286
0
220
134
0
257
60
0
134
0
13
54
60
71
11
13
0
52
60
0
242
13
...

output:

1 1
141 1
-1 141
1 2
264 1
-141 264
1 3
267 1
-104 267
267 2
-141 267
1 4
1 5
215 1
-123 215
215 2
-215 267
1 6
232 1
-90 232
232 2
-232 264
1 7
1 8
1 9
142 1
-90 142
1 10
218 1
-123 218
1 11
244 1
-90 244
1 12
133 1
-58 133
133 2
-133 218
1 13
219 1
-64 219
219 2
-111 219
219 3
-219 244
1 14
230 1
...

result:

ok 

Test #112:

score: 28
Accepted
time: 5ms
memory: 3832kb

input:

300 600
39
1
0
63
1
0
128
1
0
178
1
0
29
39
0
36
23
0
72
0
178
0
266
120
0
178
0
23
72
120
242
36
0
268
7
0
24
0
32
0
36
0
289
36
0
7
24
32
37
23
0
40
242
0
48
72
0
53
121
0
138
0
147
0
268
0
59
113
0
172
0
198
0
268
0
78
242
0
82
23
0
85
72
0
93
109
0
151
0
175
0
187
0
193
0
239
0
259
0
289
0
102
2...

output:

1 1
39 1
-1 39
1 2
63 1
-1 63
1 3
128 1
-1 128
1 4
178 1
-1 178
1 5
29 1
-29 39
1 6
36 1
-23 36
36 2
-36 72
36 3
-36 178
1 7
266 1
-120 266
266 2
-178 266
1 8
1 9
1 10
1 11
242 1
-36 242
1 12
268 1
-7 268
268 2
-24 268
268 3
-32 268
268 4
-36 268
1 13
289 1
-36 289
1 14
1 15
1 16
1 17
37 1
-23 37
1 ...

result:

ok 

Test #113:

score: 28
Accepted
time: 0ms
memory: 3884kb

input:

300 600
150
1
0
219
1
0
7
17
0
29
0
57
0
127
0
183
0
187
0
219
0
73
26
0
39
0
100
0
102
0
153
0
219
0
74
14
0
219
0
128
219
0
198
79
0
112
0
171
0
219
0
14
17
26
29
39
57
79
100
102
112
127
153
171
183
187
265
198
0
266
7
0
267
73
0
283
73
0
2
20
0
153
0
32
29
0
40
57
0
54
57
0
60
29
0
63
112
0
67
2...

output:

1 1
150 1
-1 150
1 2
219 1
-1 219
1 3
7 1
-7 17
7 2
-7 29
7 3
-7 57
7 4
-7 127
7 5
-7 183
7 6
-7 187
7 7
-7 219
1 4
73 1
-26 73
73 2
-39 73
73 3
-73 100
73 4
-73 102
73 5
-73 153
73 6
-73 219
1 5
74 1
-14 74
74 2
-74 219
1 6
128 1
-128 219
1 7
198 1
-79 198
198 2
-112 198
198 3
-171 198
198 4
-198 2...

result:

ok 

Test #114:

score: 28
Accepted
time: 0ms
memory: 3888kb

input:

299 598
104
1
0
198
1
0
128
146
0
198
0
129
104
0
146
282
129
0
53
88
0
146
0
144
2
0
282
0
2
88
7
2
0
35
2
0
56
2
0
71
2
0
74
2
0
86
2
0
93
2
0
102
2
0
112
2
0
116
2
0
127
2
0
148
2
0
150
2
0
155
2
0
168
2
0
180
2
0
182
2
0
185
34
0
88
0
232
2
0
234
2
0
236
2
0
284
2
0
290
2
0
291
2
0
297
2
0
8
70
...

output:

1 1
104 1
-1 104
1 2
198 1
-1 198
1 3
128 1
-128 146
128 2
-128 198
1 4
129 1
-104 129
1 5
1 6
282 1
-129 282
1 7
53 1
-53 88
53 2
-53 146
1 8
144 1
-2 144
144 2
-144 282
1 9
1 10
1 11
7 1
-2 7
1 12
35 1
-2 35
1 13
56 1
-2 56
1 14
71 1
-2 71
1 15
74 1
-2 74
1 16
86 1
-2 86
1 17
93 1
-2 93
1 18
102 1...

result:

ok 

Test #115:

score: 28
Accepted
time: 3ms
memory: 3760kb

input:

300 600
10
1
0
281
1
0
111
31
0
281
0
128
10
0
31
206
128
0
108
31
0
273
137
0
206
0
137
192
108
0
2
5
0
23
0
42
0
48
0
79
0
94
0
115
0
137
0
230
192
0
5
23
42
48
79
94
115
138
2
0
140
2
0
161
2
0
164
2
0
205
2
0
208
2
0
213
2
0
219
2
0
240
2
0
246
2
0
247
83
0
230
0
261
2
0
270
2
0
284
2
0
295
2
0
...

output:

1 1
10 1
-1 10
1 2
281 1
-1 281
1 3
111 1
-31 111
111 2
-111 281
1 4
128 1
-10 128
1 5
1 6
206 1
-128 206
1 7
108 1
-31 108
1 8
273 1
-137 273
273 2
-206 273
1 9
1 10
192 1
-108 192
1 11
2 1
-2 5
2 2
-2 23
2 3
-2 42
2 4
-2 48
2 5
-2 79
2 6
-2 94
2 7
-2 115
2 8
-2 137
1 12
230 1
-192 230
1 13
1 14
1 ...

result:

ok 

Test #116:

score: 28
Accepted
time: 0ms
memory: 3776kb

input:

300 600
158
1
0
263
1
0
91
158
0
92
214
0
263
0
214
262
91
0
130
178
0
214
0
164
113
0
262
0
113
178
63
16
0
178
0
199
113
0
16
232
2
0
199
0
2
153
15
0
16
0
15
20
2
0
22
2
0
24
2
0
44
2
0
111
2
0
143
2
0
148
2
0
169
2
0
176
2
0
182
2
0
201
2
0
209
2
0
219
2
0
225
2
0
237
2
0
238
2
0
248
2
0
287
2
0...

output:

1 1
158 1
-1 158
1 2
263 1
-1 263
1 3
91 1
-91 158
1 4
92 1
-92 214
92 2
-92 263
1 5
1 6
262 1
-91 262
1 7
130 1
-130 178
130 2
-130 214
1 8
164 1
-113 164
164 2
-164 262
1 9
1 10
1 11
63 1
-16 63
63 2
-63 178
1 12
199 1
-113 199
1 13
1 14
232 1
-2 232
232 2
-199 232
1 15
1 16
153 1
-15 153
153 2
-1...

result:

ok 

Test #117:

score: 28
Accepted
time: 0ms
memory: 3948kb

input:

300 600
8
1
0
82
1
0
45
8
0
70
82
0
10
45
0
203
12
0
14
0
31
0
32
0
42
0
51
0
66
0
70
0
12
14
31
32
42
51
66
72
35
0
203
0
113
178
0
203
0
121
149
0
203
0
124
203
0
129
76
0
203
0
156
184
0
203
0
173
10
0
188
60
0
203
0
189
203
0
214
203
0
215
139
0
203
0
230
120
0
203
0
233
203
0
266
29
0
203
0
283...

output:

1 1
8 1
-1 8
1 2
82 1
-1 82
1 3
45 1
-8 45
1 4
70 1
-70 82
1 5
10 1
-10 45
1 6
203 1
-12 203
203 2
-14 203
203 3
-31 203
203 4
-32 203
203 5
-42 203
203 6
-51 203
203 7
-66 203
203 8
-70 203
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
72 1
-35 72
72 2
-72 203
1 15
113 1
-113 178
113 2
-113 203
1 16
121 1
-...

result:

ok 

Extra Test:

score: 0
Extra Test Passed