QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#494474#119. Worst Reporter 3Qiuly100 ✓126ms7848kbC++141.3kb2024-07-27 15:54:202024-07-27 15:54:20

详细

Subtask #1:

score: 7
Accepted

Test #1:

score: 7
Accepted
time: 76ms
memory: 7776kb

input:

499999 499999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

91354
14781
458110
312259
476280
377661
0
80423
63661
103542
190089
33810
16591
47395
170529
0
167913
61627
120334
95728
180048
205266
23672
262516
158654
136520
406
28225
170791
122622
83443
12565
255851
10474
126809
141182
88558
0
361576
0
134028
500000
118905
500000
15429
33768
29172
258600
11258...

result:

ok 499999 lines

Test #2:

score: 7
Accepted
time: 72ms
memory: 7720kb

input:

499998 499998
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

29146
331652
442314
187644
235236
57188
5658
189016
219395
359485
130953
0
237886
226155
499999
106339
72659
209431
309393
177311
303481
21074
499999
139782
0
31928
71678
72069
171076
122455
139630
356318
499999
69417
0
160948
499999
0
50289
120840
251352
220033
281403
59885
82381
334188
56522
9229
...

result:

ok 499998 lines

Test #3:

score: 7
Accepted
time: 68ms
memory: 7776kb

input:

500000 499997
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

163740
241282
289914
71709
161300
188844
133042
403939
52209
53946
33577
277174
58606
141172
288479
76792
285261
385536
0
0
270736
96745
70310
0
283020
500001
0
372500
172011
59612
0
12869
109703
163790
0
172431
144920
203007
48790
90807
17470
350224
123140
0
219779
409478
161651
200499
256423
65001...

result:

ok 499997 lines

Test #4:

score: 7
Accepted
time: 72ms
memory: 7660kb

input:

499999 500000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

0
0
416254
243227
61777
19997
38808
241764
339032
1714
129441
0
40332
177276
500000
472476
0
0
0
305382
143316
455066
259169
239495
282131
376533
145773
185641
261836
35630
311240
0
208642
429421
189412
98099
249799
279317
51938
231062
98063
0
443789
0
401479
210300
139721
4705
28667
113918
20090
28...

result:

ok 500000 lines

Test #5:

score: 7
Accepted
time: 76ms
memory: 7728kb

input:

499998 499999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

271585
129551
253926
115160
286468
51605
32241
175464
0
47408
261563
468740
230964
178302
0
41487
0
162957
499999
206864
67211
29012
37487
101852
499999
0
255700
61002
499999
92948
349857
122650
499999
11182
193260
365247
251564
24601
499999
225101
31344
0
0
0
2420
114817
76948
385529
86453
61729
20...

result:

ok 499999 lines

Test #6:

score: 7
Accepted
time: 72ms
memory: 7816kb

input:

500000 499998
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

0
500001
0
0
106677
358048
120552
6456
58567
235519
0
264178
293864
206972
23308
227033
191932
0
11862
11083
396848
61012
0
500001
139741
380786
236553
70152
0
0
233317
209998
32891
51454
360927
0
223225
7754
177151
38527
158895
138335
500001
157446
185793
29451
209779
35129
79793
195733
0
0
239590
...

result:

ok 499998 lines

Subtask #2:

score: 12
Accepted

Test #7:

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

input:

999 999
567
214
746
852
643
536
396
114
769
251
631
51
520
952
888
539
19
69
349
813
210
352
216
330
908
156
313
115
339
875
617
174
525
249
176
340
546
649
252
5
778
816
22
166
813
572
8
120
437
442
545
25
100
179
78
808
34
623
606
980
352
784
122
87
263
189
768
815
38
162
98
642
755
585
579
262
11...

output:

2
0
1
1
3
1
2
1
1
0
1
3
2
1
0
3
0
0
0
1
0
3
1
1
0
1
1
1
1
0
1
0
0
1
3
1
0
3
3
0
1
2
3
1
1
1
1
3
1
1
0
1
1
1
1
1
0
0
2
1
1
1
0
0
1
1
1
0
1
3
0
3
3
3
2
1
1
1
1
1
1
1
1
1
1
1
0
3
0
1
0
0
1
1
2
0
1
0
3
0
1
1
0
1
1
1
1
1
1
1
1
1
1
1
1
0
0
0
0
0
0
0
3
0
0
1
0
2
1
2
0
1
0
0
3
0
0
0
0
1
1
0
0
1
3
2
2
1
3
3
...

result:

ok 999 lines

Test #8:

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

input:

998 998
556
324
129
29
660
950
57
357
473
979
123
726
466
946
120
339
612
255
1000
122
855
404
360
391
897
179
530
956
728
820
933
945
852
859
75
363
151
557
58
631
774
800
355
839
388
194
62
304
605
185
796
271
949
71
31
212
829
895
202
265
591
890
365
707
138
202
270
530
820
593
215
418
815
720
88...

output:

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

result:

ok 998 lines

Test #9:

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

input:

1000 997
908
532
784
349
774
414
161
861
126
910
955
792
465
71
433
902
795
446
179
893
256
102
504
495
796
108
169
724
751
569
477
616
55
961
101
99
4
115
649
437
815
361
232
689
701
159
212
943
351
16
279
227
386
508
751
188
67
951
487
277
317
291
936
44
208
400
135
347
649
681
50
133
225
708
275
...

output:

0
0
1
1
1
0
1
1
0
0
0
0
1
1
0
1
1
1
0
1
4
10
0
1
0
0
1
1
1
0
0
0
0
0
1
0
0
1
0
0
1
1
1
1
0
0
1
1
0
0
1
0
0
0
1
1
0
1
0
1
0
1
1
1
1
1
0
1
1
1
1
1
0
0
0
1
1
1
1
0
0
0
0
1
0
1
0
1
0
0
0
0
1
1
1
1
1
1
1
0
1
0
1
0
1
5
1
0
0
1
0
1
0
1
0
1
0
0
1
0
0
0
0
1
0
1
1
1
0
0
0
0
0
1
1
0
0
1
1
1
0
1
0
0
1
0
1
1
1
1...

result:

ok 997 lines

Test #10:

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

input:

999 1000
581
450
177
453
237
604
809
446
468
512
170
798
612
526
384
308
979
25
110
735
570
339
249
661
337
278
48
230
391
740
705
724
662
479
534
156
10
537
129
982
340
979
868
640
364
835
938
778
997
347
761
187
42
355
882
789
658
835
743
486
96
77
52
129
94
421
345
968
829
117
991
976
975
898
537...

output:

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

result:

ok 1000 lines

Test #11:

score: 12
Accepted
time: 1ms
memory: 3840kb

input:

998 999
1
1
2
2
3
5
5
6
6
6
8
10
10
10
11
11
12
13
15
19
20
24
24
24
24
26
26
26
28
29
30
30
30
31
34
35
35
37
38
39
40
41
43
45
45
45
47
48
49
50
51
54
55
57
59
59
61
62
62
63
64
66
66
67
70
70
70
70
73
73
74
75
76
76
77
77
77
78
79
79
80
80
83
83
83
84
84
85
85
85
87
87
90
91
92
93
94
94
95
96
97
...

output:

128
73
156
27
2
6
510
4
345
18
348
147
4
4
265
146
22
109
175
0
24
69
84
28
117
251
10
11
52
3
226
45
252
25
396
20
55
190
146
8
0
251
0
127
20
335
0
231
65
355
44
140
7
39
187
6
1
15
28
28
83
24
3
0
509
56
0
14
8
0
0
17
275
175
48
175
173
33
434
202
116
10
2
25
34
34
18
20
84
26
29
62
5
59
57
73
9
...

result:

ok 999 lines

Test #12:

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

input:

1000 998
1
2
4
4
5
7
7
7
8
8
8
10
13
18
19
19
20
20
21
21
22
23
23
25
26
26
26
27
28
29
29
31
31
32
34
38
39
39
40
41
41
42
43
44
45
45
47
48
48
49
52
53
54
54
55
56
56
60
61
64
66
69
69
71
72
73
74
76
76
77
78
78
82
83
83
83
83
84
88
88
88
89
90
94
95
95
96
97
97
97
99
99
100
100
102
102
103
104
10...

output:

11
3
86
11
142
22
44
0
41
16
302
176
1
255
156
165
47
126
48
15
45
10
26
500
0
50
402
0
0
10
6
9
346
43
114
186
0
113
125
147
69
32
6
362
40
257
191
60
166
497
274
4
34
223
2
499
244
32
12
1
215
125
139
11
80
22
133
59
319
25
0
213
396
81
45
2
8
20
0
3
250
92
0
46
244
35
191
49
0
59
13
71
281
250
16...

result:

ok 998 lines

Subtask #3:

score: 81
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #13:

score: 81
Accepted
time: 65ms
memory: 7724kb

input:

499999 499999
374010150
448818544
940477558
518470042
44258219
119334986
898272498
225521509
652704227
96903886
837953933
680492536
873282581
682882329
809016767
640121094
296175812
92420943
324382717
271995812
707337621
329026552
257708005
326152128
599485541
490765157
126998675
914235224
831720618...

output:

0
0
0
0
2
1
2
0
1
2
0
1
2
0
2
1
1
1
2
0
0
2
2
0
1
2
0
0
0
1
1
0
0
2
0
1
2
1
2
2
0
3
1
0
1
2
0
1
2
1
0
0
0
0
0
2
0
2
1
0
2
1
0
1
1
0
1
0
1
2
2
2
1
0
0
1
0
1
1
1
2
1
0
0
1
0
2
0
1
0
0
3
0
2
0
0
0
1
1
0
0
1
0
1
1
2
0
0
2
2
2
3
1
0
0
0
0
0
0
2
0
0
0
1
2
2
0
0
1
0
0
1
1
2
0
1
1
2
0
1
2
2
1
1
2
2
1
1
0
0
...

result:

ok 499999 lines

Test #14:

score: 81
Accepted
time: 70ms
memory: 7700kb

input:

499998 499998
126375503
569669799
577020556
857667111
66146855
880160083
808306885
137759458
295654597
687706646
577687222
527010409
990952021
480756769
777173309
722961211
662897557
555928724
360068755
177700156
459125506
801935292
90195617
221168918
110523624
738623951
344777038
781448820
98043232...

output:

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

result:

ok 499998 lines

Test #15:

score: 81
Accepted
time: 65ms
memory: 7732kb

input:

500000 499997
993864976
284775202
150863256
483222753
293149030
429462184
904203655
820781266
319445201
472060682
159604744
304402480
303708968
230724242
664555165
957436162
208006116
152316165
226541655
138196567
91782655
31684042
242254691
398858785
755222737
859342442
499874846
676037542
74445580...

output:

0
1
1
1
1
0
0
1
0
0
0
1
1
0
0
1
0
0
1
0
1
1
1
1
1
0
1
1
0
0
1
0
1
1
1
0
1
1
1
1
0
0
0
1
1
0
0
1
0
0
1
0
1
1
0
1
0
1
0
0
1
0
0
0
1
1
1
0
1
0
1
1
0
1
0
0
0
1
1
0
0
1
0
1
1
1
0
1
1
0
1
1
1
1
0
0
0
1
1
0
0
1
1
0
1
1
1
0
1
0
1
0
0
0
1
1
1
0
0
0
0
1
1
1
0
1
1
1
1
0
1
0
0
0
1
0
1
0
1
0
0
1
0
0
0
1
1
0
1
0
...

result:

ok 499997 lines

Test #16:

score: 81
Accepted
time: 57ms
memory: 7848kb

input:

499999 500000
417574750
76013296
151975371
531221486
153902099
905311207
153362282
545689852
612909031
319240030
568460088
160012654
230284576
751320638
41340270
290036464
718808747
803648972
561915381
473015084
56519342
293385529
471255171
973134524
97522483
122567177
481088513
14009257
42786484
46...

output:

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

result:

ok 500000 lines

Test #17:

score: 81
Accepted
time: 117ms
memory: 7696kb

input:

499998 499999
149
1277
4791
6506
6564
8878
8907
14052
14079
16316
20631
21200
21701
22128
23437
23762
24906
28875
32579
34179
34823
35035
35117
35230
36162
37043
38855
40044
46862
47251
51879
52109
53488
53582
58290
61563
64457
66302
67926
73259
73497
74147
75780
77688
81766
83273
85348
85719
86610
...

output:

0
2
486
4
361829
41641
102559
203
8559
214
198658
26728
361829
20439
25752
6
154262
33331
1175
36
0
708
546
0
41
3
189828
39580
198618
0
3694
170
1256
0
262
267013
22184
26099
2234
63969
51226
785
161529
0
4705
0
36
16
336069
798
407
198659
119624
37535
164748
198652
192
0
4228
3000
25341
36
463
0
6...

result:

ok 499999 lines

Test #18:

score: 81
Accepted
time: 110ms
memory: 7844kb

input:

500000 499998
1689
2463
3867
17998
23416
24327
26540
27756
28341
28805
29127
29385
29619
31750
34538
37696
39387
39526
39796
40215
43943
48156
49424
53588
54910
56695
57918
60797
61659
62768
65131
65537
68230
68699
70130
71176
73422
73859
73870
75004
76752
77399
78035
83221
84369
86605
87628
89301
9...

output:

1421
1563
25346
109
0
96996
19
11
2469
340
23504
95982
96495
96994
208
341704
4554
4
1379
666
13372
28
2
66
522
70
0
288
3044
165034
6983
96987
96996
189246
7732
86032
8488
24716
912
48323
48322
1481
343635
40344
50708
189208
0
246641
96993
2
48323
0
42147
95380
246641
3117
29553
0
716
58433
22577
7...

result:

ok 499998 lines

Test #19:

score: 81
Accepted
time: 118ms
memory: 7788kb

input:

499999 499997
107
497
770
3422
4375
4816
6165
7192
7576
8886
9326
9762
10688
11168
15675
17892
18650
18761
18776
20912
22915
26839
28163
29021
29186
29520
36130
37277
38768
42228
45258
46696
51166
55156
55472
63430
63462
65256
71868
72414
73509
79507
79567
80091
80299
81504
84648
87068
89263
91729
9...

output:

0
5302
2124
40899
2
163895
3795
0
4380
16
0
30
163654
879
163897
0
90004
547
295684
53601
50814
40
0
131787
1
194
711
0
136
560
85
601
48483
54714
64
81956
40899
254785
295683
1800
74
289070
71949
1
5432
38242
41542
71
58
292655
82030
3
16
295684
4378
20503
2844
19281
37594
163881
0
18
40899
14
2956...

result:

ok 499997 lines

Test #20:

score: 81
Accepted
time: 118ms
memory: 7840kb

input:

499998 500000
355
2789
4041
4630
9085
11833
15111
17010
18762
19335
20704
30663
36998
39185
40201
40314
41388
46556
49277
51845
52815
54771
57680
64255
66498
67574
69275
70359
72876
75679
76501
77085
78854
82267
86035
86660
87047
87422
88528
91060
92668
94745
94871
95431
96047
96683
96711
97713
9854...

output:

15907
129
4
3556
370
45451
10045
9
4
5910
902
109030
85463
109031
0
109031
0
109031
80230
268
381622
66516
0
200873
1259
149
5639
16303
17057
14
208282
5141
53
22
90212
0
109025
27424
34
54369
0
0
6582
0
90382
33307
60585
207
27154
30
777
2316
2388
108632
61424
61
0
307
85967
19378
381616
852
0
1090...

result:

ok 500000 lines

Test #21:

score: 81
Accepted
time: 114ms
memory: 7716kb

input:

500000 499999
717
4916
5235
5326
6332
8225
9685
9987
10200
11099
15404
15715
17250
18004
18851
19749
22273
23198
27302
27829
28011
31221
33761
34413
34466
36839
37467
37934
39443
41920
48162
48341
48823
54077
54367
54639
55556
56575
58165
58738
60783
63735
65111
66912
67440
68334
70909
71341
71884
7...

output:

340231
5162
186831
63
265
95355
54323
0
0
60
0
5732
0
16702
186844
1348
186842
685
21923
124105
340171
277
4352
186844
0
1798
8224
11846
47952
38212
255
327
105809
0
0
73101
25393
184463
35737
363
4
477
9358
57
91258
2787
61
756
186842
23
674
0
64349
61
9675
931
176652
8647
328584
186844
22601
13889...

result:

ok 499999 lines

Test #22:

score: 81
Accepted
time: 113ms
memory: 7784kb

input:

499999 499998
288
896
5243
5476
12211
12713
14453
15859
17658
18438
24399
24492
25232
27169
33072
33725
34759
34990
36593
39660
40798
43417
49204
51471
52420
53554
54054
54521
56390
59217
62111
63211
64416
67149
69408
71551
72647
75235
75353
75417
80734
86052
86567
89705
92276
94283
96197
101062
101...

output:

0
8562
435
4
182441
0
164214
103443
1871
1997
98
152
82144
375
12466
6310
60326
130231
43096
82151
69336
82154
1
295112
114701
20102
0
92864
576
74906
10692
0
161816
748
135
123393
2
61559
82154
384
4148
67549
104000
543
38262
186
12066
74613
1152
4
72294
3828
81097
177
0
72891
54
0
1616
55844
81784...

result:

ok 499998 lines

Test #23:

score: 81
Accepted
time: 107ms
memory: 7728kb

input:

499998 499997
1002
5521
6048
8101
8384
12974
14551
15717
17559
22484
23371
24048
25072
25229
25632
28481
28607
30731
34626
35479
38412
39079
39334
40563
42385
43276
45949
48070
49581
49670
50349
51978
56586
57868
60698
62308
63267
64387
64690
64766
65038
69720
70087
74486
74540
77160
78679
81181
821...

output:

19547
115157
51283
39425
28078
1393
203974
229613
23862
857
41360
217159
52181
28900
203560
0
0
545
8466
52823
12722
218501
163687
55
6082
0
52185
57348
343543
57416
98420
66796
15450
1184
11
0
56
1347
90905
51
386
54014
0
115159
198241
20950
84775
218501
19
218501
57786
201942
54259
0
140
218281
57...

result:

ok 499997 lines

Test #24:

score: 81
Accepted
time: 103ms
memory: 7720kb

input:

500000 500000
2093
2393
5290
6141
8311
8533
13386
13911
14198
14573
15294
17024
20351
21459
22544
24585
26007
26163
26339
27212
27519
27996
28629
29029
31313
41527
47290
47482
50325
50611
51323
53777
56163
56324
56556
57159
57872
61887
64192
67140
69155
69540
70772
74186
74404
75708
76576
79458
8509...

output:

797
41433
0
159687
429
68393
24136
159697
7486
19921
290010
0
4119
64906
0
913
218795
25405
39489
159697
79724
1153
1913
3
341
83
159658
111928
536
1084
143733
0
61259
1147
2488
4499
33687
0
130452
7
7026
289837
239450
2013
0
79973
24
122
782
26846
28251
100746
0
79724
21377
495
0
5828
9415
288886
0...

result:

ok 500000 lines

Test #25:

score: 81
Accepted
time: 77ms
memory: 7688kb

input:

499999 499999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

222849
71447
56407
6189
254395
219380
500000
32160
9626
0
59791
500000
0
0
28656
29755
108591
206671
220143
398584
0
17743
171131
79616
117581
5039
148740
0
13042
184230
50750
0
400742
290847
48990
34484
0
57556
369801
0
0
171864
34480
54813
52468
152626
166516
0
52946
93888
91582
147998
252668
5000...

result:

ok 499999 lines

Test #26:

score: 81
Accepted
time: 77ms
memory: 7656kb

input:

499998 499998
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

245514
159411
0
0
343950
185473
149615
357786
172946
335078
305056
59219
70763
185880
26633
21955
257437
274334
39225
149535
12742
205897
499999
149253
46274
294875
45556
180073
18705
13475
499999
99559
284806
4295
173874
46140
183481
422244
226890
0
295751
68637
262871
294590
94419
381581
351208
69...

result:

ok 499998 lines

Test #27:

score: 81
Accepted
time: 113ms
memory: 7732kb

input:

500000 499997
2
1
2
2
1
2
1
2
2
1
1
2
1
2
2
1
2
2
2
2
2
1
1
1
1
1
2
1
1
1
2
2
1
1
1
1
2
2
2
1
2
1
2
2
2
2
2
1
2
1
2
1
2
2
1
2
2
2
2
2
2
1
2
2
2
2
1
1
1
2
2
1
1
1
2
1
2
1
2
1
1
1
2
2
2
2
1
1
2
2
1
1
2
1
1
2
2
1
2
1
1
1
1
1
1
2
1
1
1
1
1
1
1
2
2
1
1
1
1
2
2
1
2
2
2
2
1
2
1
2
2
1
1
1
2
2
1
1
2
2
2
2
2
...

output:

4377
0
142282
0
500001
23155
143325
172328
13223
208678
2
74468
208675
2146
0
59226
0
6020
157901
180249
204689
179475
87997
177569
220529
1
102822
11851
60204
18635
182462
17633
2170
0
80506
119873
500001
150068
3452
384106
204689
180431
210043
78
182954
220529
0
11851
39617
142308
15504
6060
14726...

result:

ok 499997 lines

Test #28:

score: 81
Accepted
time: 126ms
memory: 7620kb

input:

499999 500000
1
1
2
1
2
1
1
2
2
1
2
2
1
1
1
1
2
1
2
2
2
1
1
1
2
1
2
2
2
1
1
2
2
2
1
2
1
1
2
1
2
1
2
2
2
2
2
2
1
1
2
1
2
1
1
1
1
1
1
1
1
2
2
1
1
1
1
1
1
2
1
2
2
1
1
2
1
1
2
1
2
2
1
1
1
1
2
2
1
1
1
2
2
2
1
2
2
2
1
2
2
2
2
2
2
2
2
2
2
1
2
2
1
2
1
1
1
2
1
2
1
2
2
2
2
2
2
1
1
1
1
2
1
2
2
1
1
1
2
2
1
1
2
...

output:

98309
88994
69743
23721
0
0
78361
35876
78361
68727
0
72743
179273
74334
13842
140477
95461
69799
69767
380559
55859
767
97610
16671
19252
88623
105657
23383
67705
80963
62339
95380
83341
71960
114591
3311
92653
96033
0
23727
94785
83808
95462
16292
57894
107187
177123
4759
94613
0
35933
171852
1728...

result:

ok 500000 lines

Test #29:

score: 81
Accepted
time: 113ms
memory: 7656kb

input:

499998 499999
1
1
1
1
2
2
1
2
1
2
1
2
2
1
2
2
2
2
1
1
1
2
1
1
1
2
1
1
1
2
1
2
2
2
1
1
2
2
2
2
2
1
1
1
1
1
2
2
2
1
2
2
1
2
1
2
1
1
1
2
2
2
1
1
1
2
1
1
1
2
2
1
1
2
1
1
1
1
1
1
2
1
2
1
2
1
1
2
1
2
2
2
2
2
1
1
2
2
2
2
1
2
1
1
1
1
2
2
2
2
1
2
2
1
1
2
1
2
2
2
2
2
1
2
2
2
2
2
2
2
1
2
2
2
2
1
1
2
2
1
2
2
1
...

output:

81862
178939
59750
0
39180
0
180772
29128
25886
178939
0
28142
0
41904
149777
3
14062
178939
1369
29363
180774
15932
121151
21493
60606
180769
11493
4329
21439
36433
180774
5752
157405
92217
112089
41408
1264
41878
58032
26405
9229
18682
27745
27031
31832
105762
3112
41408
180774
0
16090
59149
0
295...

result:

ok 499999 lines

Test #30:

score: 81
Accepted
time: 106ms
memory: 7672kb

input:

500000 499998
1
2
1
2
1
1
1
2
2
1
2
1
2
1
1
1
2
1
2
1
2
2
1
1
2
2
2
1
2
2
1
2
2
2
1
2
1
1
1
2
1
2
1
1
1
2
1
1
1
1
2
1
2
2
2
2
2
1
1
1
2
1
1
1
2
2
2
1
1
2
2
2
2
1
1
1
2
1
2
2
2
2
1
2
1
1
2
1
1
2
1
1
1
1
1
1
2
1
2
2
2
2
1
2
1
1
2
2
1
2
1
1
2
1
2
1
1
1
1
2
1
1
2
1
2
2
2
1
1
1
1
1
2
2
1
2
1
2
1
1
2
1
2
...

output:

63719
166131
96272
126391
215348
0
2513
297566
46576
9706
171175
83099
12325
136341
21355
7304
233816
44511
1852
126392
0
159783
0
93288
0
0
89872
24377
113060
69095
85403
125114
297566
126943
107814
93304
38441
44955
4357
0
65417
16693
286525
87232
150628
66749
183183
92296
33711
0
0
0
0
69682
5392...

result:

ok 499998 lines

Test #31:

score: 81
Accepted
time: 124ms
memory: 7668kb

input:

499999 499997
2
1
2
1
1
1
1
2
1
1
2
2
1
2
2
1
1
2
2
1
1
1
1
2
2
1
1
2
2
1
2
2
1
1
2
2
2
1
2
2
1
1
2
2
1
1
1
2
1
2
1
1
2
1
2
2
1
1
2
1
2
1
1
2
2
2
2
2
2
2
2
1
1
1
2
2
1
2
2
1
1
1
2
1
2
2
1
2
1
1
2
1
1
1
1
2
2
1
1
1
2
2
2
1
2
2
2
2
2
2
2
2
1
1
1
1
1
1
1
2
1
1
2
1
2
1
2
1
1
2
1
1
1
1
1
1
1
2
2
1
2
1
1
...

output:

170214
69573
118068
8065
4567
55383
0
0
55991
37445
87874
7489
71121
86112
4436
38805
33180
32665
129151
38251
158241
73049
46450
36764
55660
54264
113956
26436
87099
32213
12183
0
11973
58994
71024
114310
79390
170214
161609
18879
33529
90617
55899
0
0
30283
31954
26685
131627
58762
33377
72041
0
1...

result:

ok 499997 lines

Test #32:

score: 81
Accepted
time: 73ms
memory: 7724kb

input:

499998 500000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

output:

0
0
0
250000
250000
45017
0
120883
41396
173883
5163
99143
0
97763
6515
133353
0
171598
86446
0
0
16124
8473
116787
208685
0
34062
47077
250000
175631
108959
126358
0
0
231282
81938
109137
142350
0
77684
104584
21244
0
155628
183026
0
191955
0
65335
69062
5343
185087
201922
0
152930
127915
0
0
82759...

result:

ok 500000 lines

Test #33:

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

input:

2 2
1
1000000000
1 1 1000000000
1000000000 1000000000 1000000000

output:

1
1

result:

ok 2 lines

Extra Test:

score: 0
Extra Test Passed