QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#166854#402. MatryoshkaZhaoZiLong100 ✓110ms9396kbC++201.1kb2023-09-06 19:30:292023-09-06 19:30:30

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 2ms
memory: 5520kb

input:

1 1
80 22
92 52

output:

0

result:

ok single line: '0'

Test #2:

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

input:

5 1
42 48
65 49
35 82
94 73
56 6
66 91

output:

1

result:

ok single line: '1'

Test #3:

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

input:

10 1
955744818 818438338
708752654 707027641
860370925 246724418
458446623 734029097
152867387 644693269
552617712 772074081
699332741 507361150
212197996 588847946
97734740 388725575
986526630 979298764
680948105 547407644

output:

2

result:

ok single line: '2'

Test #4:

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

input:

8 1
87 58
32 42
40 31
90 2
6 88
88 51
68 61
26 51
20 44

output:

3

result:

ok single line: '3'

Test #5:

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

input:

10 1
6013 359
4321 385
8241 100
9970 721
4102 535
4062 631
845 234
2080 355
9841 211
6933 970
2170 307

output:

1

result:

ok single line: '1'

Test #6:

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

input:

10 1
495268009 115773263
299641225 13878132
805503547 154165513
974008831 46048377
205072236 730778789
279416022 745812606
803383275 232997430
114492420 714695578
918079301 281769984
987460481 287641923
740112724 849252038

output:

3

result:

ok single line: '3'

Test #7:

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

input:

10 1
202667898 195133084
994099426 992224672
329608744 319995002
851853441 854258843
200214393 204002194
78026041 69308531
904681347 910584576
322198937 320023802
823606320 829992290
90566429 95197095
487956554 993222026

output:

1

result:

ok single line: '1'

Test #8:

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

input:

10 1
5157801 984945461
675273304 329098921
127345165 873534565
956227189 34636927
578264555 419967226
264103727 738762590
123947723 879306992
251165793 739791019
514835378 494352080
103954263 892663016
897407943 957628314

output:

1

result:

ok single line: '1'

Test #9:

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

input:

10 1
234237 111
239693 90
41967 246
140601 184
218948 31
150522 218
243663 211
253761 285
243954 68
211437 264
258637 27

output:

0

result:

ok single line: '0'

Test #10:

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

input:

10 1
1 2
1 1
1 2
1 1
1 2
1 1
1 1
1 2
1 1
1 3
1 3

output:

10

result:

ok single line: '10'

Subtask #2:

score: 15
Accepted

Dependency #1:

100%
Accepted

Test #11:

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

input:

20 1
10677 266227
99133 148900
7602 147604
36278 544914
47517 454812
28691 639970
27135 306543
41222 221931
63363 133818
72628 12554
79965 482407
90292 187702
14929 416693
94528 611822
28932 472490
14244 599568
29027 276752
74654 387781
29445 293349
74020 633098
18840 262363

output:

3

result:

ok single line: '3'

Test #12:

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

input:

53 1
10013276 12441319
2551631 223406710
1645613 83785778
4633156 81568421
10288529 227240090
14055715 165977004
6576159 220900740
18444516 69778949
8156618 14758565
7793109 31302088
11934471 33420838
20823826 17834500
9029658 106734
10535709 163378179
12565996 94265745
21966880 90269584
14338427 11...

output:

4

result:

ok single line: '4'

Test #13:

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

input:

100 1
21 2
47 60
15 96
24 25
79 32
57 95
43 36
96 16
86 89
72 3
10 40
68 24
40 76
94 42
53 32
50 14
20 24
25 31
61 53
90 13
21 64
67 73
64 76
15 85
64 65
67 89
19 64
2 83
65 73
5 77
63 49
73 4
24 59
31 77
36 62
42 90
16 91
4 43
93 73
10 10
12 38
5 15
65 82
24 99
94 65
8 44
5 7
51 2
76 29
24 30
60 57...

output:

2

result:

ok single line: '2'

Test #14:

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

input:

100 1
352064 13
143641 6
22364 6
181434 7
5312 7
31133 5
2033 7
20867 11
109430 7
2430 1
276862 10
160001 5
307202 6
131231 9
174953 6
34779 10
133480 10
71732 4
215743 8
126096 8
16940 8
221226 6
184395 8
74594 7
343981 12
137354 3
122489 1
299475 6
318133 6
193561 9
310798 4
232177 8
123866 13
343...

output:

17

result:

ok single line: '17'

Test #15:

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

input:

100 1
6311 622727394
2752 276701165
9302 938471603
3970 388711347
3858 388620019
8109 813204360
1476 154036425
7276 723114135
6064 603880217
8092 805831405
2165 217161370
841 87883527
2603 260234520
7784 773630860
4339 424299198
7005 707135865
8026 798576400
5666 564965248
3436 344707653
471 5693192...

output:

2

result:

ok single line: '2'

Test #16:

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

input:

100 1
860376566 1350
543348239 4492
962892149 353
82972744 9084
379075631 6289
989040187 150
783923535 2235
402251386 5945
90100410 9174
695354450 3005
176888592 8308
825121992 1773
382720867 6237
131875954 8649
208779155 8005
322382275 6756
302746225 6938
298179944 7053
430975669 5782
729530952 275...

output:

37

result:

ok single line: '37'

Test #17:

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

input:

100 1
670646878 213377215
9858139 915441704
122637389 375257575
776649892 542090150
852557653 925564381
438761089 946245866
484885858 569136813
158661736 600574219
777553300 900304299
837723150 710175512
661238464 206974417
603800516 215023531
847258176 697062547
290939870 6114065
942058627 57537643...

output:

3

result:

ok single line: '3'

Test #18:

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

input:

100 1
853702586 841100489
196076721 14497121
165947402 289689733
278993417 878519890
151487833 80849308
758591344 34289563
611915080 950525849
224641879 72770699
481705655 13577589
22294750 45691866
714478977 667079256
395580270 55693619
248500309 481961720
325724791 313707906
5597699 384208397
9573...

output:

15

result:

ok single line: '15'

Test #19:

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

input:

100 1
662555076 1
895746418 1
402995229 2
953283983 1
749558477 1
930209122 1
417475763 2
6203576 3
857696833 1
25049072 3
562889745 1
662032122 1
869113614 1
345440975 2
988967110 1
480037394 2
243504826 3
389970861 2
717998783 1
349156683 2
624361927 1
481023841 2
529448536 1
502721111 1
895557485...

output:

44

result:

ok single line: '44'

Test #20:

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

input:

100 1
6 1000000000
1 166996334
2 342271908
3 492843944
2 339009648
3 493105012
3 499182799
6 993515399
4 672788649
3 503222786
6 997119201
3 496875443
1 158013263
3 495489854
5 828547592
5 839401399
2 325732398
4 659628483
1 158222154
3 500672011
6 1000000000
3 506797844
2 331960983
2 334920186
1 16...

output:

0

result:

ok single line: '0'

Subtask #3:

score: 25
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #21:

score: 25
Accepted
time: 2ms
memory: 7612kb

input:

100 100
6 79
90 38
3 68
24 35
42 57
77 71
47 37
8 47
66 65
32 64
25 100
22 48
42 39
28 33
33 13
79 54
66 61
4 41
17 25
20 36
89 45
38 42
24 57
3 34
67 94
73 16
8 99
87 17
78 30
93 68
69 63
33 97
54 44
88 17
85 40
40 99
64 79
66 18
26 66
71 22
88 31
95 85
74 99
63 79
97 35
89 39
57 100
87 28
82 1
69 ...

output:

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

result:

ok 100 lines

Test #22:

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

input:

1000 1000
1461406 373410
2873999 684880
424841 662277
3337701 233038
758029 242893
363235 558254
941109 66509
2549905 374007
3849579 683048
1914991 187220
3760050 293188
1955149 671258
182909 640219
412371 606321
3826980 21287
1571928 515028
298863 121814
1207649 630119
2171156 649491
2515601 532675...

output:

44
14
0
32
33
23
38
44
5
34
47
18
6
40
47
27
11
29
0
42
2
27
44
21
10
36
23
5
3
22
20
51
25
36
20
18
15
32
32
2
20
21
37
31
20
4
14
23
30
23
24
39
4
39
16
39
8
18
24
0
3
8
13
32
35
23
27
40
25
38
30
30
37
43
14
13
0
1
36
20
33
14
32
14
26
32
30
11
19
25
5
47
37
24
19
16
38
38
0
32
18
6
38
47
10
37
2...

result:

ok 1000 lines

Test #23:

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

input:

2000 2000
541656095 430792226
292504795 538004776
714287983 604526745
283996153 414663031
25180687 157511144
36775487 403281445
427378537 765738985
541067408 274148052
923025136 9061665
969547144 865897544
122340422 826584147
486730221 709596118
555475853 564209634
998566142 316430483
785245144 3281...

output:

80
24
20
45
13
7
48
31
64
51
81
50
79
15
38
70
23
1
53
79
25
35
54
29
64
71
65
27
25
25
5
53
64
46
19
2
38
41
14
57
33
21
49
6
48
38
47
1
54
41
70
55
34
13
17
64
53
14
66
22
34
29
27
58
15
0
78
33
41
9
69
57
54
13
33
72
73
23
37
77
56
38
46
24
34
56
57
24
24
9
29
64
29
1
14
58
30
71
13
35
17
21
17
7...

result:

ok 2000 lines

Test #24:

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

input:

2000 2000
124717475 134227967
270146474 271573313
370847413 377545610
864871245 862214643
669024402 660399040
63234757 64737105
109876793 113002499
22534466 23986665
822037660 816530333
798376456 805081510
531300959 523924468
640381358 647359597
123707549 121479327
610372888 600527489
70695764 61969...

output:

0
0
8
8
7
8
0
0
0
0
6
10
0
0
8
0
7
10
7
0
8
0
8
8
0
0
0
7
9
0
6
8
0
10
0
8
8
7
8
8
10
1
0
8
8
0
6
8
0
7
8
8
0
0
8
8
0
8
9
0
0
0
8
10
8
7
8
8
8
0
0
0
0
8
8
0
9
8
8
0
8
0
7
8
0
0
8
0
0
8
0
0
8
0
0
6
0
8
8
8
8
8
0
0
8
0
0
4
8
0
0
0
0
0
7
0
0
0
8
0
9
0
0
0
2
8
7
0
0
0
0
8
0
0
0
1
0
8
0
0
8
8
8
8
0
0
0
0...

result:

ok 2000 lines

Test #25:

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

input:

2000 2000
774260732 226614402
956106335 36572400
8152916 1000000000
618074934 391503906
374011573 621150118
345104047 664547777
572568172 427710508
523675306 477586187
212404729 778085663
838462406 162397846
541621254 467333591
924101550 82157279
242200713 755800984
383045691 608954782
374863787 634...

output:

82
94
131
146
442
174
425
154
110
128
105
444
276
271
71
240
211
474
36
42
211
459
121
60
59
268
416
519
40
21
46
432
418
268
73
266
364
470
119
45
248
246
147
31
403
75
75
78
253
124
420
76
116
44
349
353
137
492
233
53
190
394
252
180
96
46
52
373
133
366
199
75
65
398
161
354
67
103
480
290
158
1...

result:

ok 2000 lines

Test #26:

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

input:

2000 2000
143349571 57061
23123043 7638
208318607 80408
787701572 315676
725852303 292246
945810764 382786
413613693 170463
320041559 132637
664018435 271198
306008302 125757
728871909 290448
593737108 241923
141787546 57198
95327689 37873
582160567 231249
45744409 15467
431242460 173512
45591788 21...

output:

8
11
0
0
8
0
0
10
0
0
0
9
0
9
0
8
8
0
0
8
0
10
5
0
8
8
0
0
8
8
8
8
0
0
0
0
0
8
9
8
11
9
8
0
0
7
0
0
0
0
10
0
8
7
11
10
7
8
0
10
9
0
0
0
10
9
9
9
0
9
10
8
8
10
0
0
0
8
0
1
10
0
0
9
0
0
0
0
0
0
7
0
8
11
6
0
0
0
8
0
10
8
10
8
10
0
1
10
6
10
0
8
0
8
0
10
0
10
9
10
10
0
0
8
8
7
0
8
8
0
10
8
8
3
8
0
10
0
...

result:

ok 2000 lines

Test #27:

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

input:

2000 2000
11338 110718789
53166 504536956
80247 772583404
101986 974579189
46789 455327862
41427 394892545
47507 447733361
43610 419816187
26107 252753577
26690 258319414
4293 50693267
19552 190407454
66462 642822380
83894 807246163
97298 928357277
74511 720256695
55346 527976534
55172 521331962
983...

output:

0
9
0
0
10
0
0
9
9
0
0
0
8
7
10
0
9
7
0
0
0
0
10
10
6
9
7
7
0
9
8
0
8
0
9
0
0
0
0
0
0
8
0
0
0
10
9
0
0
0
0
9
0
9
0
9
0
0
0
0
0
9
0
10
9
9
9
0
0
0
0
0
0
0
0
10
7
0
9
0
9
5
0
8
10
0
0
0
0
0
0
8
0
0
8
0
8
8
8
0
9
0
0
1
9
10
10
0
0
0
9
0
10
9
0
9
0
0
0
0
0
10
0
8
10
10
9
0
10
7
9
9
9
9
9
8
0
0
10
9
10
0...

result:

ok 2000 lines

Test #28:

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

input:

2000 2000
848447917 7688
569760195 21362
198849254 39408
653985959 16886
677148293 15781
512802797 23646
511196386 24111
68480513 45650
297621855 34469
4355358 49128
113922397 44048
934392407 3149
702182082 14734
119953479 43311
231179196 38040
717450686 14117
648020542 16991
424476084 28319
5254058...

output:

115
150
91
340
83
257
87
239
344
178
60
335
357
330
57
75
541
168
169
273
93
183
61
193
198
140
170
373
475
51
406
13
81
7
215
370
226
112
267
429
280
246
145
197
127
179
325
546
469
358
209
200
363
112
169
90
354
233
117
316
411
270
315
100
99
104
292
24
264
241
135
546
55
112
224
208
213
307
24
49...

result:

ok 2000 lines

Test #29:

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

input:

2000 2000
1001 29225470
556 469495126
94 907508517
267 748813018
286 721971990
14 981754035
990 56062703
550 479052067
290 727210824
653 372254202
172 831734955
800 231044438
832 207587027
322 683400808
512 513909837
175 830452862
802 222284947
448 579667123
332 672046905
130 868458506
4 1000000000
...

output:

141
486
205
463
240
485
311
267
83
356
369
226
163
308
196
79
117
302
511
82
167
151
458
371
323
38
476
539
269
55
137
387
130
313
376
528
50
96
125
367
112
39
156
58
105
135
16
313
25
355
240
316
187
326
305
29
23
432
95
187
78
201
255
387
264
53
56
121
24
99
405
256
6
623
22
58
88
86
304
110
390
3...

result:

ok 2000 lines

Test #30:

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

input:

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

output:

93
54
72
71
63
99
10
73
15
55
90
114
125
38
69
25
116
50
54
97
30
106
29
71
89
19
31
120
112
84
125
119
55
39
65
30
145
88
155
63
152
145
95
154
54
70
178
41
32
73
155
53
11
56
64
170
130
123
37
144
84
64
155
96
63
23
31
104
159
90
64
79
38
59
139
122
85
178
30
62
43
84
81
123
85
34
85
26
75
65
93
1...

result:

ok 2000 lines

Test #31:

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

input:

2000 2000
523949820 134633812
876329106 813395188
924035440 454866748
343544113 509847249
356743675 16586495
689736892 84179110
335924185 936231104
391309438 935759124
129690286 8718291
768655827 684330878
391076096 161463777
60250233 953830066
928733787 110573485
846948172 929276260
407595750 13640...

output:

38
7
14
13
67
71
59
43
60
21
60
85
36
11
13
61
15
35
39
39
24
26
59
5
68
68
32
69
45
68
18
33
56
1
19
41
8
26
63
34
13
56
50
46
49
8
21
50
40
49
27
26
59
21
58
18
25
3
47
19
77
7
16
8
41
67
9
64
51
37
7
32
73
38
24
41
57
20
34
33
50
64
23
41
14
15
25
77
40
52
30
47
39
23
23
56
73
45
34
75
73
43
50
1...

result:

ok 2000 lines

Test #32:

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

input:

2000 2000
198338396 578784622
946857264 769173550
781481024 341568510
216065612 812855579
898560596 795893040
390165746 41080503
513577167 747630248
279782572 109462446
795946731 594032526
178979631 279030542
89119718 477455170
73341428 579707368
348288093 430519101
23204743 100537266
195828498 3446...

output:

16
51
0
26
29
27
9
60
52
8
39
26
54
28
41
27
18
36
49
67
36
15
23
31
76
42
43
27
49
65
5
26
8
51
14
58
43
29
36
16
27
9
31
58
82
68
63
55
12
34
5
50
78
49
72
50
17
38
53
35
2
16
62
49
17
34
15
33
50
54
31
8
48
66
23
11
66
34
49
36
61
31
33
33
46
71
28
54
36
30
39
47
15
38
65
20
5
63
38
31
17
66
43
3...

result:

ok 2000 lines

Test #33:

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

input:

2000 2000
318221437 113393823
562207624 95472962
323404778 975955061
513375851 866100952
378850806 56466281
444612500 506662781
368215491 697353424
323096759 94047022
24269001 14673718
100374330 216684609
947402417 548646855
705967458 347900125
623950340 570699273
858125491 14937179
664536516 950243...

output:

51
60
71
6
18
52
17
14
80
4
43
43
62
72
35
41
9
61
69
32
10
22
23
39
10
31
13
63
49
42
78
36
21
52
3
19
69
52
26
48
9
62
38
59
30
7
6
47
55
14
23
27
16
27
26
47
52
13
3
80
74
5
65
44
22
47
50
46
55
25
30
14
26
53
25
43
11
16
44
60
12
62
9
35
31
58
43
16
3
7
49
47
76
53
43
67
44
6
64
8
31
37
11
70
18...

result:

ok 2000 lines

Test #34:

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

input:

2000 2000
719602607 526077717
656548499 839627601
994043810 619007851
95796087 579565800
186553729 82381877
352661466 126376536
89251907 113198537
609182085 468740540
172036604 699176338
249402846 618515550
146878603 568426921
650261889 407272034
515680106 939009091
855635700 118692782
957454261 631...

output:

5
48
57
9
62
43
49
9
55
60
61
25
60
66
18
41
25
42
15
77
48
6
28
23
21
55
40
6
14
26
38
26
2
25
27
59
21
49
33
43
27
6
20
25
31
15
21
14
49
57
8
28
60
46
55
10
33
35
54
36
45
70
25
63
33
36
28
67
36
9
7
51
37
63
13
38
35
57
3
16
46
56
21
22
41
2
4
60
49
22
68
45
22
25
58
33
29
33
53
39
14
47
21
6
68...

result:

ok 2000 lines

Test #35:

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

input:

2000 2000
322094794 788395512
515458986 370128898
325370241 4258419
888734283 208312690
581025671 483271360
440859321 496987669
147509133 989852887
174506 223895398
72704250 608074957
502896592 480348924
787375214 413950656
963241449 467285451
420959777 52800593
655567925 538989559
714921831 3131704...

output:

64
60
58
23
49
47
56
71
45
17
24
77
36
9
63
50
39
63
9
43
61
52
29
3
76
13
33
31
30
53
70
14
80
49
68
35
8
74
28
42
2
49
34
68
71
31
11
16
65
45
37
40
18
43
53
34
82
9
24
3
40
44
24
30
50
74
83
7
33
69
6
64
56
53
10
30
76
73
33
63
75
28
32
53
1
35
37
36
14
21
31
4
32
72
46
41
33
60
39
10
16
70
56
39...

result:

ok 2000 lines

Subtask #4:

score: 49
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #36:

score: 49
Accepted
time: 96ms
memory: 8104kb

input:

200000 200000
193944 47675
119866 116682
151530 139848
87181 70602
283622 159459
42397 142203
288095 30935
234052 154992
111186 49621
285379 44975
80983 175668
101092 123151
134054 166396
226093 7469
150618 3088
125639 148019
111122 13012
81697 130490
144700 48139
107606 137955
102258 15307
228791 8...

output:

496
253
554
485
463
274
207
685
158
150
314
197
416
640
112
343
169
622
621
521
118
276
252
260
463
530
283
599
377
557
490
292
515
273
482
82
329
373
76
422
750
139
366
657
698
500
221
208
487
360
524
134
528
236
130
474
97
490
308
296
364
427
672
155
355
488
661
152
526
165
549
318
99
425
230
611
...

result:

ok 200000 lines

Test #37:

score: 0
Accepted
time: 105ms
memory: 8236kb

input:

200000 200000
7801914 108
1488586 108
2814348 98
2822509 17
958944 37
4601045 85
6516829 59
7179449 72
8212269 85
10280087 23
8552731 98
5913 37
54172 109
6790655 15
2357848 84
9572982 25
6318515 31
7082404 61
7130202 102
980822 2
7149082 68
5114461 83
6862255 40
5752048 111
1293349 46
6153333 78
70...

output:

1046
181
1805
1923
2377
1873
1252
1189
1017
802
1004
201
1927
1096
761
294
173
811
941
960
1768
1044
1387
1615
803
391
958
149
796
1323
299
1385
1776
791
1864
1952
1983
998
1828
227
1103
409
365
592
1787
1312
913
1914
670
178
937
987
1585
2229
1446
948
1191
1130
811
2071
964
453
1625
2107
720
2224
9...

result:

ok 200000 lines

Test #38:

score: 0
Accepted
time: 25ms
memory: 6444kb

input:

102333 40923
1966055 250997541
971297 122156800
1812099 228460418
1156580 143783559
91883 12377297
1155258 143711391
1930188 244693353
138627 18430924
159357 16824549
2128210 271994591
1001134 127426218
1543386 194677811
1753735 223032878
1194012 149473173
1619921 200796278
1600795 204526316
2251694...

output:

0
0
0
0
0
48
0
52
52
36
0
0
0
50
74
52
0
48
0
50
0
0
48
52
0
50
0
52
0
49
50
50
0
9
0
0
52
0
50
50
52
46
52
0
0
52
0
50
89
0
0
0
0
50
0
48
0
0
0
0
50
0
0
48
0
50
50
0
0
0
0
0
0
0
0
0
0
48
52
0
50
48
32
0
49
48
0
0
0
49
50
48
50
0
52
0
0
0
0
0
52
48
48
48
0
0
50
27
0
0
0
0
0
0
0
0
52
52
52
52
52
0
52...

result:

ok 40923 lines

Test #39:

score: 0
Accepted
time: 68ms
memory: 8140kb

input:

200000 200000
920 915
681 671
880 870
731 722
146 137
325 334
858 848
912 910
122 129
656 663
988 995
75 81
469 467
399 389
224 226
333 338
728 732
153 151
858 853
947 942
32 25
856 862
973 978
619 628
784 789
239 245
981 977
194 199
56 56
640 649
483 473
268 260
671 670
794 796
337 345
340 332
949 ...

output:

0
0
0
277
254
0
287
287
0
287
276
0
277
0
0
276
276
0
273
273
287
0
0
287
283
0
0
0
0
0
0
0
287
0
0
263
0
0
276
0
272
276
277
0
268
0
276
263
273
0
287
238
0
276
263
276
276
287
287
287
260
276
287
0
273
268
263
277
0
287
276
287
108
276
276
287
287
276
0
0
276
0
287
0
287
0
0
0
287
0
268
268
0
265
...

result:

ok 200000 lines

Test #40:

score: 0
Accepted
time: 90ms
memory: 8252kb

input:

200000 200000
541 454
177 827
670 332
138 856
839 163
169 825
127 864
473 527
21 973
479 518
823 181
498 502
496 510
102 908
32 972
144 859
843 153
605 400
804 191
690 310
461 545
662 339
672 325
116 892
890 112
365 630
214 792
855 136
173 829
16 990
694 307
158 847
942 57
457 540
53 955
718 286
334...

output:

893
6008
18228
5310
14315
18729
7388
6273
18332
12968
24439
19404
4622
1267
7892
5969
8025
10935
2886
6974
2030
8867
5831
8931
21758
6273
12927
18819
14281
11336
7984
3968
18819
9724
6662
16328
5559
23722
19057
18588
19550
4180
19476
15122
16072
3543
857
9436
8373
3156
1676
16986
11162
5899
14767
16...

result:

ok 200000 lines

Test #41:

score: 0
Accepted
time: 97ms
memory: 8192kb

input:

200000 200000
37926 516
159706 1814
65992 1563
61018 1942
127277 398
306985 1441
1847 674
137832 235
63160 68
48327 2251
220672 1973
22361 1914
266483 1035
29817 390
196048 1879
185902 167
215727 400
120206 1010
121812 654
240031 389
198743 1516
231609 279
59441 1407
202254 987
245576 1533
291042 8
...

output:

908
92
332
63
368
748
97
685
203
451
294
748
261
596
408
232
839
207
420
618
390
139
476
540
710
748
378
268
194
363
435
444
669
528
500
199
438
189
562
527
223
244
496
90
153
351
209
242
325
385
782
133
301
399
605
508
622
369
203
288
189
289
654
168
677
435
287
34
666
277
396
304
533
909
523
253
4...

result:

ok 200000 lines

Test #42:

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

input:

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

output:

30441
18110
30515
18155
24455
24124
13936
22061
26269
19862
32646
28389
16092
38553
16170
20078
24358
14014
3973
18143
14056
11930
5906
9953
18114
15873
7947
18047
1948
24455
16092
30515
11928
5865
11928
24291
15873
18062
34610
24291
28256
17936
24064
11983
5865
20095
1948
5865
16064
11930
9962
1606...

result:

ok 200000 lines

Test #43:

score: 0
Accepted
time: 46ms
memory: 9396kb

input:

200000 200000
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 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:

200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000
200000...

result:

ok 200000 lines

Test #44:

score: 0
Accepted
time: 105ms
memory: 8128kb

input:

200000 200000
578489547 808308232
310301601 941674863
890291544 611394553
63428074 322207509
657851867 270497107
5521611 459902450
405446803 378789284
401445356 491441190
638059728 483982219
14237017 910843096
700439048 921193723
457142466 644403937
667942808 217734381
504093248 265193493
625580467 ...

output:

73
462
503
187
446
514
55
539
734
482
599
443
315
396
560
181
707
535
387
393
572
472
735
503
663
232
412
468
301
257
361
646
368
222
100
357
574
202
370
366
447
388
210
297
301
427
539
531
399
397
68
143
396
323
592
420
403
295
675
127
348
203
397
245
679
201
322
369
363
514
360
560
568
218
347
17
...

result:

ok 200000 lines

Test #45:

score: 0
Accepted
time: 90ms
memory: 8156kb

input:

200000 200000
816989549 132894319
856751352 542103123
863501479 174854321
322352793 829617411
199511761 972177354
657686687 434779072
181120287 104319004
779982191 713464621
20445392 821281596
521405013 166251856
12663956 35189211
717206140 50846141
232344801 893783355
13715731 739523882
160887241 1...

output:

734
174
116
127
97
635
528
171
446
411
440
99
715
534
501
637
412
255
615
344
616
400
368
288
100
70
564
474
459
128
114
513
182
290
106
172
9
197
435
413
298
585
655
446
219
711
775
685
243
79
0
135
427
248
185
290
78
313
312
493
484
650
207
167
464
639
120
408
827
503
301
329
499
287
338
825
408
4...

result:

ok 200000 lines

Test #46:

score: 0
Accepted
time: 95ms
memory: 8112kb

input:

200000 200000
118253090 57293349
477996766 748284507
508313299 324630299
48909957 336372270
63548470 198219434
237873234 113854896
991366580 365454759
800836951 32097833
948305092 333014982
138729526 252864612
124810892 398100497
558133332 338324022
342362892 777397303
732378969 510029151
813951487 ...

output:

369
419
533
793
628
218
166
252
362
654
156
110
12
99
474
248
279
702
347
333
658
702
742
522
439
689
369
188
475
274
74
216
268
580
626
597
405
389
131
288
664
93
338
530
165
574
691
296
434
229
196
50
513
274
436
109
200
370
98
485
257
201
14
132
673
207
556
551
213
734
103
501
500
223
800
320
394...

result:

ok 200000 lines

Test #47:

score: 0
Accepted
time: 93ms
memory: 8256kb

input:

200000 200000
526730387 529190049
229677585 238797969
771740882 781645736
112650646 119146066
881988307 877804752
206636079 201525765
875957708 870373335
959624492 965757117
503529363 508177722
928695247 932092309
920078266 920450993
970913459 965058131
125960462 130881976
290817060 282607660
691781...

output:

63
78
0
63
74
73
0
0
0
63
0
63
78
0
78
822
63
0
0
1
0
0
78
0
63
0
0
73
58
73
63
63
0
63
0
0
63
39
0
0
0
294
0
78
63
76
0
76
63
0
78
73
0
78
78
63
0
0
0
0
0
63
0
63
0
78
0
73
73
0
62
63
379
0
63
78
63
0
63
0
0
63
0
0
78
0
63
63
0
78
63
63
0
0
78
63
0
63
76
63
0
0
0
57
61
63
0
0
0
78
78
63
0
0
73
0
0
...

result:

ok 200000 lines

Test #48:

score: 0
Accepted
time: 101ms
memory: 8248kb

input:

200000 200000
870022323 126716216
79317556 916485638
76555750 922708108
710896698 281986618
494396842 497192865
2493546 997088831
915238710 86647723
399178904 597321714
921097389 71278069
996304862 1957454
76120889 920468127
838774128 166152909
206718163 785468915
137685904 859091225
636098124 37106...

output:

2755
4610
2798
1314
1270
7013
2349
1229
2661
1129
2400
7021
6280
7399
7154
2159
3596
1141
3344
4366
4689
1437
6025
4224
2344
661
1542
1571
2589
2529
2316
3476
983
6255
3384
3463
1989
837
2992
2618
1127
5677
2501
4053
3565
1932
2904
1441
3016
6345
2431
2280
2419
7459
2046
3165
4598
3392
5525
861
1530...

result:

ok 200000 lines

Test #49:

score: 0
Accepted
time: 92ms
memory: 8108kb

input:

200000 200000
24740664 17639818
397803845 399115676
804858286 799932356
502980526 494941507
299814519 305393453
423655712 423120611
709453414 718539496
331648403 323400543
325195506 315354495
312406607 318672381
318133560 316722033
777364069 780571291
979885184 983308392
740761726 747013505
83330497...

output:

65
0
0
62
0
63
63
79
63
0
0
78
0
0
79
79
0
0
77
65
79
0
63
65
0
0
0
63
62
65
79
0
0
79
0
0
0
0
0
0
63
0
0
63
0
79
0
61
0
50
0
63
0
63
65
0
62
63
63
63
79
63
0
63
121
0
0
63
0
0
20
62
0
0
0
0
63
63
0
0
0
63
0
65
64
0
0
65
62
0
75
0
79
79
0
63
63
63
0
62
65
0
0
0
0
63
0
0
0
79
0
63
0
0
0
0
79
63
0
63
...

result:

ok 200000 lines

Test #50:

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

input:

200000 200000
829839057 164955539
903860820 100068666
608167687 388648771
718200915 287574256
345834023 649051605
120467051 888999152
802886461 196462865
510822028 480113466
867608712 124397243
465094178 536677474
168044878 825888891
999609339 4577574
379661683 626057642
756707117 237585297
97784854...

output:

4274
2886
3047
2491
5091
1418
6199
2112
1507
4669
4121
1168
5013
7103
2792
2366
2924
2574
3331
4307
6299
1426
4144
7091
3446
6144
867
1421
1091
990
892
3447
1678
3306
2465
1399
1230
6797
1038
2910
4994
1253
2014
2716
3695
6226
2042
5050
2360
2912
4437
3697
6753
1722
2497
3859
5658
3786
1607
3435
396...

result:

ok 200000 lines

Extra Test:

score: 0
Extra Test Passed