QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#416891#8711. TilesQiuly#100 ✓252ms77684kbC++173.4kb2024-05-22 10:30:072024-05-22 10:30:08

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 4
Accepted

Test #1:

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

input:

4 3
0 0
0 3
3 3
3 0

output:

0

result:

ok single line: '0'

Test #2:

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

input:

4 999999999
999999999 0
999999999 1000000000
0 1000000000
0 0

output:

999999998

result:

ok single line: '999999998'

Test #3:

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

input:

4 875
875 0
0 0
0 284
875 284

output:

874

result:

ok single line: '874'

Test #4:

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

input:

4 317
317 0
317 920
0 920
0 0

output:

316

result:

ok single line: '316'

Test #5:

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

input:

4 912
912 814
912 0
0 0
0 814

output:

912

result:

ok single line: '912'

Test #6:

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

input:

4 2
0 0
0 1
2 1
2 0

output:

0

result:

ok single line: '0'

Test #7:

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

input:

4 1
0 0
0 1
1 1
1 0

output:

0

result:

ok single line: '0'

Test #8:

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

input:

4 412
412 998
0 998
0 17
412 17

output:

0

result:

ok single line: '0'

Test #9:

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

input:

4 87523458
87523458 42385699
0 42385699
0 23498231
87523458 23498231

output:

87523458

result:

ok single line: '87523458'

Test #10:

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

input:

4 1
0 0
0 1000000000
1 1000000000
1 0

output:

0

result:

ok single line: '0'

Test #11:

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

input:

4 1000000000
1000000000 0
1000000000 1000000000
0 1000000000
0 0

output:

1000000000

result:

ok single line: '1000000000'

Subtask #2:

score: 9
Accepted

Dependency #1:

100%
Accepted

Test #12:

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

input:

5 29034873
29034873 13721
0 13721
0 99198237
29034870 99198237
29034873 99198237

output:

29034872

result:

ok single line: '29034872'

Test #13:

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

input:

6 999999993
2934870 21349
2934870 3423847
0 3423847
0 91827393
999999993 91827393
999999993 21349

output:

999999992

result:

ok single line: '999999992'

Test #14:

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

input:

6 401
153 409
153 751
0 751
0 909
401 909
401 409

output:

152

result:

ok single line: '152'

Test #15:

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

input:

5 726
0 286
0 315
726 315
726 122
0 122

output:

0

result:

ok single line: '0'

Test #16:

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

input:

6 999
616 129
616 311
0 311
0 529
999 529
999 129

output:

998

result:

ok single line: '998'

Test #17:

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

input:

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

output:

2

result:

ok single line: '2'

Test #18:

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

input:

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

output:

0

result:

ok single line: '0'

Test #19:

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

input:

6 717
204 1000
0 1000
0 306
548 306
717 306
717 1000

output:

716

result:

ok single line: '716'

Test #20:

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

input:

6 804
785 17
785 665
0 665
0 969
804 969
804 17

output:

784

result:

ok single line: '784'

Test #21:

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

input:

6 973
973 772
973 122
42 122
42 6
0 6
0 772

output:

972

result:

ok single line: '972'

Test #22:

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

input:

6 615
492 993
492 748
615 748
615 311
0 311
0 993

output:

492

result:

ok single line: '492'

Test #23:

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

input:

6 999
999 424
999 302
83 302
83 70
0 70
0 424

output:

82

result:

ok single line: '82'

Test #24:

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

input:

6 884
884 622
884 317
228 317
228 96
0 96
0 622

output:

228

result:

ok single line: '228'

Test #25:

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

input:

6 6
0 6
3 6
3 4
6 4
6 0
0 0

output:

2

result:

ok single line: '2'

Test #26:

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

input:

6 6
0 4
5 4
5 2
6 2
6 0
0 0

output:

4

result:

ok single line: '4'

Test #27:

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

input:

6 6
0 6
2 6
2 4
6 4
6 0
0 0

output:

6

result:

ok single line: '6'

Test #28:

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

input:

6 6
0 6
1 6
1 4
6 4
6 0
0 0

output:

0

result:

ok single line: '0'

Test #29:

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

input:

6 802
0 60
802 60
802 604
288 604
288 271
0 271

output:

0

result:

ok single line: '0'

Test #30:

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

input:

5 318
0 782
318 782
318 256
318 148
0 148

output:

318

result:

ok single line: '318'

Test #31:

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

input:

6 994
994 511
994 76
0 76
0 135
0 782
994 782

output:

994

result:

ok single line: '994'

Subtask #3:

score: 11
Accepted

Test #32:

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

input:

1551 1000
0 988
2 988
3 988
6 988
6 985
6 982
6 981
6 979
6 978
6 977
6 976
6 975
6 974
6 972
6 970
6 969
6 968
6 966
6 965
6 964
7 964
8 964
8 963
8 961
8 960
10 960
11 960
13 960
16 960
16 959
16 958
16 957
16 954
16 953
16 951
16 950
17 950
18 950
18 948
18 946
18 945
18 944
18 942
18 941
18 939
...

output:

164

result:

ok single line: '164'

Test #33:

score: 0
Accepted
time: 6ms
memory: 4300kb

input:

36221 1000000000
0 996776952
43916 996776952
43916 996301596
102050 996301596
102050 995243908
173144 995243908
173144 992639626
184542 992639626
184542 987461238
192474 987461238
192474 982703402
406098 982703402
406098 980100986
525272 980100986
525272 978443232
532708 978443232
532708 977775310
6...

output:

14903120

result:

ok single line: '14903120'

Test #34:

score: 0
Accepted
time: 141ms
memory: 46676kb

input:

193828 1000000000
0 999998938
7028 999998938
7028 999997962
20232 999997962
20232 999997052
23456 999997052
23456 999996854
30820 999996854
30820 999996798
53224 999996798
53224 999996114
55112 999996114
55112 999995972
57148 999995972
57148 999995732
59864 999995732
59864 999995618
64052 999995618
...

output:

847705586

result:

ok single line: '847705586'

Test #35:

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

input:

100000 999981518
0 999980992
50540 999980992
50540 999973058
73428 999973058
73428 999952350
116804 999952350
116804 999950006
133616 999950006
133616 999940658
150202 999940658
150202 999931756
158656 999931756
158656 999921792
182938 999921792
182938 999899902
224480 999899902
224480 999898440
226...

output:

999981518

result:

ok single line: '999981518'

Test #36:

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

input:

100000 999999946
0 999984618
10462 999984618
10462 999958906
60800 999958906
60800 999953668
65892 999953668
65892 999947392
70334 999947392
70334 999928772
87646 999928772
87646 999863608
117006 999863608
117006 999834378
182962 999834378
182962 999819462
202864 999819462
202864 999812430
204350 99...

output:

676608028

result:

ok single line: '676608028'

Test #37:

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

input:

502 993
0 1000
2 1000
2 996
4 996
4 992
6 992
6 988
8 988
8 984
10 984
10 980
12 980
12 976
14 976
14 972
16 972
16 968
18 968
18 964
20 964
20 960
22 960
22 956
24 956
24 952
26 952
26 948
28 948
28 944
30 944
30 940
32 940
32 936
34 936
34 932
36 932
36 928
38 928
38 924
40 924
40 920
42 920
42 91...

output:

992

result:

ok single line: '992'

Test #38:

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

input:

1080 994
0 990
2 990
4 990
8 990
8 989
8 988
8 987
8 986
10 986
12 986
14 986
20 986
20 985
20 983
20 982
20 979
20 978
20 976
20 975
20 974
20 973
20 968
22 968
26 968
28 968
28 967
28 965
28 963
28 962
28 956
28 955
28 950
28 949
28 947
28 945
28 944
28 943
28 942
28 941
28 940
28 939
28 938
28 93...

output:

572

result:

ok single line: '572'

Test #39:

score: 0
Accepted
time: 88ms
memory: 41296kb

input:

200000 999999996
0 999999712
11680 999999712
11680 999998638
16884 999998638
16884 999992598
25560 999992598
25560 999986560
27916 999986560
27916 999980634
34720 999980634
34720 999978576
44572 999978576
44572 999968226
49332 999968226
49332 999941322
62120 999941322
62120 999937962
92112 999937962...

output:

479112624

result:

ok single line: '479112624'

Test #40:

score: 0
Accepted
time: 100ms
memory: 49992kb

input:

114867 183430402
0 1000000000
3192 1000000000
3192 999982590
6384 999982590
6384 999965180
9576 999965180
9576 999947770
12768 999947770
12768 999930360
15960 999930360
15960 999912950
19152 999912950
19152 999895540
22344 999895540
22344 999878130
25536 999878130
25536 999860720
28728 999860720
287...

output:

183430402

result:

ok single line: '183430402'

Test #41:

score: 0
Accepted
time: 23ms
memory: 7068kb

input:

200000 999999999
0 998179020
20114 998179020
20114 998131016
56540 998131016
56540 998028168
57786 998028168
57786 997952316
58860 997952316
58860 997891040
68802 997891040
68802 997877196
94486 997877196
94486 997832208
110000 997832208
110000 997641760
117346 997641760
117346 997520396
118582 9975...

output:

6933364

result:

ok single line: '6933364'

Test #42:

score: 0
Accepted
time: 74ms
memory: 42584kb

input:

90448 279993337
0 1000000000
6190 1000000000
6190 999977888
12380 999977888
12380 999955776
18570 999955776
18570 999933664
24760 999933664
24760 999911552
30950 999911552
30950 999889440
37140 999889440
37140 999867328
43330 999867328
43330 999845216
49520 999845216
49520 999823104
55710 999823104
...

output:

279993336

result:

ok single line: '279993336'

Test #43:

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

input:

16 1000000000
0 1000000000
82734 1000000000
98347 1000000000
102982 1000000000
102982 293874957
102982 234875948
102982 102938556
355111 102938556
12836323 102938556
19238732 102938556
349587239 102938556
1000000000 102938556
1000000000 1928733
1000000000 283746
1000000000 0
0 0

output:

1000000000

result:

ok single line: '1000000000'

Test #44:

score: 0
Accepted
time: 201ms
memory: 71688kb

input:

199999 1000000000
0 999996612
3392 999996612
3392 999996606
15294 999996606
15294 999993550
20716 999993550
20716 999992154
35680 999992154
35680 999985500
38506 999985500
38506 999983338
46448 999983338
46448 999976708
47598 999976708
47598 999976696
48928 999976696
48928 999965882
49490 999965882
...

output:

1000000000

result:

ok single line: '1000000000'

Subtask #4:

score: 19
Accepted

Test #45:

score: 19
Accepted
time: 0ms
memory: 4204kb

input:

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

output:

2

result:

ok single line: '2'

Test #46:

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

input:

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

output:

6

result:

ok single line: '6'

Test #47:

score: 0
Accepted
time: 19ms
memory: 6900kb

input:

199996 966
752 702
754 702
754 700
756 700
756 702
758 702
758 700
760 700
760 702
762 702
762 700
764 700
764 702
766 702
766 700
768 700
768 702
770 702
770 700
772 700
772 702
774 702
774 700
776 700
776 702
778 702
778 700
780 700
780 702
782 702
782 700
784 700
784 702
786 702
786 700
788 700
7...

output:

0

result:

ok single line: '0'

Test #48:

score: 0
Accepted
time: 116ms
memory: 6896kb

input:

199996 966
748 702
750 702
750 700
752 700
752 702
754 702
754 700
756 700
756 702
758 702
758 700
760 700
760 702
762 702
762 700
764 700
764 702
766 702
766 700
768 700
768 702
770 702
770 700
772 700
772 702
774 702
774 700
776 700
776 702
778 702
778 700
780 700
780 702
782 702
782 700
784 700
7...

output:

962

result:

ok single line: '962'

Test #49:

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

input:

500 916
560 975
560 526
544 526
544 708
538 708
538 585
534 585
534 879
530 879
530 612
514 612
514 907
512 907
512 571
504 571
504 976
494 976
494 746
486 746
486 922
478 922
478 667
476 667
476 913
472 913
472 623
456 623
456 890
450 890
450 609
446 609
446 905
436 905
436 705
428 705
428 816
418 ...

output:

900

result:

ok single line: '900'

Test #50:

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

input:

500 980
421 481
453 481
453 479
32 479
32 477
453 477
453 461
353 461
353 451
403 451
403 441
176 441
176 435
314 435
314 429
128 429
128 417
129 417
129 413
31 413
31 401
136 401
136 399
130 399
130 398
130 391
217 391
217 383
6 383
6 369
105 369
105 365
84 365
84 353
178 353
178 345
0 345
0 343
26...

output:

0

result:

ok single line: '0'

Test #51:

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

input:

8480 1000
410 61
410 63
410 69
410 70
410 71
410 83
410 87
410 88
410 89
410 90
410 91
410 93
410 95
410 97
410 106
410 108
410 109
410 117
410 118
410 121
410 123
410 126
410 129
410 133
410 134
410 139
410 140
410 143
410 145
410 149
410 150
410 152
410 154
410 157
410 158
410 159
410 162
410 164
...

output:

1000

result:

ok single line: '1000'

Test #52:

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

input:

500 976
590 415
590 63
604 63
604 439
612 439
612 262
614 262
614 284
624 284
624 31
636 31
636 65
646 65
646 28
648 28
648 341
656 341
656 241
666 241
666 421
670 421
670 147
684 147
684 326
688 326
688 3
696 3
696 254
708 254
708 39
712 39
712 322
726 322
726 293
728 293
728 447
740 447
740 57
748...

output:

972

result:

ok single line: '972'

Test #53:

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

input:

502 993
993 0
991 0
991 4
989 4
989 8
987 8
987 12
985 12
985 16
983 16
983 20
981 20
981 24
979 24
979 28
977 28
977 32
975 32
975 36
973 36
973 40
971 40
971 44
969 44
969 48
967 48
967 52
965 52
965 56
963 56
963 60
961 60
961 64
959 64
959 68
957 68
957 72
955 72
955 76
953 76
953 80
951 80
951 ...

output:

494

result:

ok single line: '494'

Test #54:

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

input:

500 990
261 369
383 369
383 365
45 365
45 363
341 363
341 343
78 343
78 341
78 339
105 339
105 325
19 325
19 321
113 321
113 313
74 313
74 309
272 309
272 301
3 301
3 299
191 299
191 285
103 285
103 273
460 273
460 265
153 265
153 257
278 257
278 253
129 253
129 243
283 243
283 239
11 239
11 233
254...

output:

982

result:

ok single line: '982'

Test #55:

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

input:

1213 996
960 224
960 225
960 229
960 230
960 233
960 234
960 235
960 236
960 237
960 238
960 240
960 242
960 243
960 244
960 245
960 246
960 248
960 249
960 250
960 251
960 252
960 253
960 254
960 255
960 256
960 259
960 260
960 264
960 266
961 266
962 266
962 269
962 271
962 272
962 273
962 274
962...

output:

0

result:

ok single line: '0'

Test #56:

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

input:

1583 994
357 534
356 534
355 534
354 534
354 533
354 532
353 532
353 531
353 530
351 530
349 530
349 529
349 527
349 526
348 526
348 523
348 522
348 520
348 519
347 519
347 518
347 517
346 517
346 516
346 515
346 514
345 514
344 514
343 514
342 514
342 513
342 512
340 512
339 512
338 512
338 511
338...

output:

80

result:

ok single line: '80'

Test #57:

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

input:

12 984
697 599
0 599
0 913
697 913
697 1000
761 1000
761 977
984 977
984 311
761 311
761 68
697 68

output:

696

result:

ok single line: '696'

Test #58:

score: 0
Accepted
time: 115ms
memory: 6820kb

input:

200000 984
778 694
778 696
776 696
776 698
778 698
778 700
776 700
776 702
778 702
778 704
776 704
776 706
778 706
778 708
776 708
776 710
778 710
778 712
776 712
776 714
778 714
778 716
776 716
776 718
778 718
778 720
776 720
776 722
778 722
778 724
776 724
776 726
778 726
778 728
776 728
776 730
7...

output:

968

result:

ok single line: '968'

Test #59:

score: 0
Accepted
time: 115ms
memory: 6848kb

input:

200000 964
304 754
302 754
302 752
300 752
300 754
298 754
298 752
296 752
296 754
294 754
294 752
292 752
292 754
290 754
290 752
288 752
288 754
286 754
286 752
284 752
284 754
282 754
282 752
280 752
280 754
278 754
278 752
276 752
276 754
274 754
274 752
272 752
272 754
270 754
270 752
268 752
2...

output:

952

result:

ok single line: '952'

Test #60:

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

input:

8380 1000
929 192
929 193
929 194
923 194
914 194
910 194
899 194
875 194
869 194
864 194
840 194
835 194
810 194
803 194
795 194
794 194
789 194
778 194
773 194
771 194
765 194
762 194
741 194
740 194
735 194
728 194
719 194
718 194
716 194
693 194
676 194
652 194
632 194
611 194
609 194
588 194
58...

output:

0

result:

ok single line: '0'

Test #61:

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

input:

1056 582
0 0
2 0
2 1
6 1
6 2
8 2
8 3
12 3
12 4
14 4
14 5
16 5
16 6
18 6
18 16
20 16
20 17
24 17
24 18
26 18
26 19
28 19
28 20
32 20
32 21
34 21
34 22
36 22
36 23
38 23
38 24
40 24
40 28
42 28
42 29
44 29
44 30
46 30
46 31
48 31
48 32
50 32
50 39
54 39
54 40
56 40
56 41
58 41
58 42
60 42
60 43
62 43
...

output:

582

result:

ok single line: '582'

Test #62:

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

input:

852 466
0 0
2 0
2 1
4 1
4 2
6 2
6 3
8 3
8 4
10 4
10 5
12 5
12 6
14 6
14 7
16 7
16 8
18 8
18 9
20 9
20 10
22 10
22 11
24 11
24 14
26 14
26 15
28 15
28 16
30 16
30 17
32 17
32 18
34 18
34 19
36 19
36 25
38 25
38 26
40 26
40 27
44 27
44 28
46 28
46 29
48 29
48 43
50 43
50 44
52 44
52 45
56 45
56 46
58 ...

output:

200

result:

ok single line: '200'

Test #63:

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

input:

300 558
90 579
90 519
82 519
82 877
74 877
74 859
70 859
70 970
62 970
62 602
54 602
54 917
52 917
52 665
36 665
36 983
30 983
30 721
24 721
24 969
16 969
16 932
10 932
10 1000
0 1000
0 145
10 145
10 400
16 400
16 322
24 322
24 407
30 407
30 4
36 4
36 155
52 155
52 57
54 57
54 122
62 122
62 37
70 37...

output:

0

result:

ok single line: '0'

Test #64:

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

input:

2146 36
26 411
26 412
26 413
26 414
26 415
26 417
28 417
30 417
34 417
34 418
34 419
34 420
34 421
34 422
34 424
34 425
34 427
30 427
26 427
24 427
22 427
20 427
20 428
20 429
20 430
20 431
20 432
20 434
20 435
24 435
26 435
28 435
30 435
34 435
34 437
34 439
34 440
34 441
34 442
34 443
32 443
30 44...

output:

2

result:

ok single line: '2'

Test #65:

score: 0
Accepted
time: 111ms
memory: 6804kb

input:

199996 998
764 280
764 278
766 278
766 276
764 276
764 274
766 274
766 272
764 272
764 270
766 270
766 268
764 268
764 266
766 266
766 264
764 264
764 262
766 262
766 260
764 260
764 258
766 258
766 256
764 256
764 254
766 254
766 252
764 252
764 250
766 250
766 248
764 248
764 246
766 246
766 244
7...

output:

998

result:

ok single line: '998'

Test #66:

score: 0
Accepted
time: 113ms
memory: 6968kb

input:

199996 998
544 572
544 574
546 574
546 576
544 576
544 578
546 578
546 580
544 580
544 582
546 582
546 584
544 584
544 586
546 586
546 588
544 588
544 590
546 590
546 592
544 592
544 594
546 594
546 596
544 596
544 598
546 598
546 600
544 600
544 602
546 602
546 604
544 604
544 606
546 606
546 608
5...

output:

998

result:

ok single line: '998'

Test #67:

score: 0
Accepted
time: 115ms
memory: 6908kb

input:

199996 934
262 148
264 148
264 150
266 150
266 148
268 148
268 150
270 150
270 148
272 148
272 150
274 150
274 148
276 148
276 150
278 150
278 148
280 148
280 150
282 150
282 148
284 148
284 150
286 150
286 148
288 148
288 150
290 150
290 148
292 148
292 150
294 150
294 148
296 148
296 150
298 150
2...

output:

934

result:

ok single line: '934'

Test #68:

score: 0
Accepted
time: 116ms
memory: 6808kb

input:

199996 954
762 832
760 832
760 834
758 834
758 832
756 832
756 834
754 834
754 832
752 832
752 834
750 834
750 832
748 832
748 834
746 834
746 832
744 832
744 834
742 834
742 832
740 832
740 834
738 834
738 832
736 832
736 834
734 834
734 832
732 832
732 834
730 834
730 832
728 832
728 834
726 834
7...

output:

954

result:

ok single line: '954'

Test #69:

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

input:

12 824
511 122
511 64
191 64
191 122
0 122
0 710
191 710
191 882
511 882
511 710
824 710
824 122

output:

824

result:

ok single line: '824'

Test #70:

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

input:

8 8
0 0
0 3
2 3
2 6
8 6
8 3
6 3
6 0

output:

0

result:

ok single line: '0'

Test #71:

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

input:

9604 1000
856 342
856 344
856 345
856 347
856 348
856 349
856 350
862 350
863 350
865 350
867 350
873 350
875 350
878 350
885 350
886 350
887 350
894 350
897 350
899 350
901 350
912 350
917 350
934 350
941 350
949 350
958 350
968 350
974 350
977 350
978 350
983 350
985 350
987 350
988 350
993 350
99...

output:

1000

result:

ok single line: '1000'

Test #72:

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

input:

8542 980
130 84
130 83
130 81
130 80
130 79
130 78
130 77
130 76
128 76
125 76
122 76
115 76
113 76
110 76
108 76
102 76
100 76
98 76
93 76
81 76
78 76
76 76
73 76
71 76
70 76
69 76
58 76
57 76
49 76
47 76
46 76
44 76
42 76
41 76
39 76
27 76
22 76
21 76
15 76
14 76
10 76
7 76
6 76
6 75
6 73
6 72
6 7...

output:

0

result:

ok single line: '0'

Test #73:

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

input:

1994 499
489 978
488 978
488 976
487 976
487 974
486 974
486 972
485 972
485 970
484 970
484 968
483 968
483 966
482 966
482 964
481 964
481 962
480 962
480 960
479 960
479 958
478 958
478 956
477 956
477 954
476 954
476 952
475 952
475 950
474 950
474 948
473 948
473 946
472 946
472 944
471 944
471...

output:

0

result:

ok single line: '0'

Test #74:

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

input:

20 9
0 2
0 8
4 8
4 9
6 9
6 8
8 8
8 6
6 6
6 5
4 5
4 6
2 6
2 4
8 4
8 2
9 2
9 0
7 0
7 2

output:

9

result:

ok single line: '9'

Test #75:

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

input:

12 668
424 258
424 17
610 17
610 258
668 258
668 746
610 746
610 997
424 997
424 746
0 746
0 258

output:

668

result:

ok single line: '668'

Test #76:

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

input:

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

output:

0

result:

ok single line: '0'

Test #77:

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

input:

8 8
0 0
0 3
2 3
2 6
8 6
8 3
6 3
6 0

output:

0

result:

ok single line: '0'

Test #78:

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

input:

28 11
0 990
8 990
8 992
11 992
11 998
9 998
9 994
7 994
7 992
5 992
5 994
3 994
3 992
2 992
2 996
4 996
4 995
6 995
6 996
8 996
8 998
6 998
6 999
4 999
4 998
2 998
2 1000
0 1000

output:

11

result:

ok single line: '11'

Test #79:

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

input:

9988 936
270 806
269 806
267 806
266 806
265 806
264 806
262 806
261 806
260 806
259 806
258 806
257 806
256 806
256 815
256 821
256 829
256 832
256 835
256 841
256 843
256 854
256 856
256 858
256 860
256 862
256 865
256 872
256 878
256 881
256 882
256 886
256 890
256 904
256 909
256 918
256 940
256...

output:

936

result:

ok single line: '936'

Test #80:

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

input:

9869 980
9 785
9 784
9 783
9 782
9 781
9 779
17 779
18 779
20 779
25 779
30 779
33 779
34 779
35 779
40 779
42 779
43 779
56 779
61 779
65 779
75 779
78 779
80 779
82 779
83 779
86 779
101 779
107 779
109 779
111 779
120 779
121 779
124 779
130 779
143 779
154 779
164 779
165 779
170 779
170 778
170...

output:

0

result:

ok single line: '0'

Test #81:

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

input:

12 810
48 395
810 395
810 817
48 817
48 912
6 912
6 553
0 553
0 113
6 113
6 32
48 32

output:

810

result:

ok single line: '810'

Test #82:

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

input:

1707 980
980 10
980 9
980 8
980 7
980 6
980 4
980 2
980 1
980 0
968 0
965 0
926 0
916 0
900 0
859 0
848 0
820 0
772 0
763 0
760 0
743 0
730 0
725 0
694 0
688 0
632 0
609 0
603 0
597 0
596 0
581 0
483 0
474 0
439 0
437 0
419 0
373 0
367 0
363 0
362 0
345 0
330 0
272 0
260 0
253 0
241 0
220 0
200 0
17...

output:

0

result:

ok single line: '0'

Test #83:

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

input:

20 974
0 508
0 202
188 202
188 94
0 94
0 18
974 18
974 94
420 94
420 202
974 202
974 508
420 508
420 792
974 792
974 984
0 984
0 792
188 792
188 508

output:

974

result:

ok single line: '974'

Test #84:

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

input:

12 1000
0 1
0 999
1 999
1 1000
999 1000
999 999
1000 999
1000 1
999 1
999 0
1 0
1 1

output:

0

result:

ok single line: '0'

Test #85:

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

input:

906 980
544 788
544 789
544 790
546 790
547 790
550 790
551 790
552 790
553 790
554 790
555 790
556 790
556 791
556 792
558 792
560 792
560 793
560 794
561 794
564 794
565 794
566 794
567 794
568 794
568 795
568 796
569 796
570 796
570 797
570 798
571 798
572 798
574 798
574 799
574 800
574 802
575 ...

output:

0

result:

ok single line: '0'

Test #86:

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

input:

8 977
977 0
321 0
321 38
0 38
0 314
506 314
506 38
977 38

output:

977

result:

ok single line: '977'

Test #87:

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

input:

1992 996
642 177
642 176
644 176
644 175
646 175
646 174
648 174
648 173
650 173
650 172
652 172
652 171
654 171
654 170
656 170
656 169
658 169
658 168
660 168
660 167
662 167
662 166
664 166
664 165
666 165
666 164
668 164
668 163
670 163
670 162
672 162
672 161
674 161
674 160
676 160
676 159
678...

output:

996

result:

ok single line: '996'

Test #88:

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

input:

12 4
0 1
0 3
1 3
1 4
3 4
3 3
4 3
4 1
3 1
3 0
1 0
1 1

output:

0

result:

ok single line: '0'

Subtask #5:

score: 22
Accepted

Test #89:

score: 22
Accepted
time: 21ms
memory: 6848kb

input:

199996 198506138
31225688 248200160
31225688 248291950
28995282 248291950
28995282 248200160
26764876 248200160
26764876 248291950
24534470 248291950
24534470 248200160
22304064 248200160
22304064 248291950
20073658 248291950
20073658 248200160
17843252 248200160
17843252 248291950
15612846 24829195...

output:

0

result:

ok single line: '0'

Test #90:

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

input:

199996 740789144
48843244 341844840
48843244 342042210
40702704 342042210
40702704 341844840
32562164 341844840
32562164 342042210
24421624 342042210
24421624 341844840
16281084 341844840
16281084 342042210
8140544 342042210
8140544 341450100
16281084 341450100
16281084 341647470
24421624 341647470
...

output:

0

result:

ok single line: '0'

Test #91:

score: 0
Accepted
time: 146ms
memory: 8484kb

input:

199996 198506138
31225684 248200166
31225684 248291956
28995278 248291956
28995278 248200166
26764872 248200166
26764872 248291956
24534466 248291956
24534466 248200166
22304060 248200166
22304060 248291956
20073654 248291956
20073654 248200166
17843248 248200166
17843248 248291956
15612842 24829195...

output:

198506134

result:

ok single line: '198506134'

Test #92:

score: 0
Accepted
time: 146ms
memory: 8744kb

input:

199996 740789144
48843240 341844840
48843240 342042210
40702700 342042210
40702700 341844840
32562160 341844840
32562160 342042210
24421620 342042210
24421620 341844840
16281080 341844840
16281080 342042210
8140540 342042210
8140540 341450100
16281080 341450100
16281080 341647470
24421620 341647470
...

output:

740789140

result:

ok single line: '740789140'

Test #93:

score: 0
Accepted
time: 180ms
memory: 61368kb

input:

199999 1000000000
1000000000 0
999999222 0
999999222 136
999984018 136
999984018 228
999973482 228
999973482 292
999971160 292
999971160 396
999964886 396
999964886 588
999959042 588
999959042 680
999955190 680
999955190 732
999927188 732
999927188 748
999913912 748
999913912 796
999912122 796
99991...

output:

13366

result:

ok single line: '13366'

Test #94:

score: 0
Accepted
time: 173ms
memory: 76320kb

input:

200000 1000000000
684694139 795608956
684694139 795624096
684697059 795624096
684697059 795626100
684706431 795626100
684706431 795627636
684723897 795627636
684723897 795629488
684739661 795629488
684739661 795629884
684747463 795629884
684747463 795637960
684749717 795637960
684749717 795650464
68...

output:

33676

result:

ok single line: '33676'

Test #95:

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

input:

200000 1000000000
46181104 58318020
46181104 58296528
46177454 58296528
46177454 58295540
46175192 58295540
46175192 58283280
46160546 58283280
46160546 58257456
46152376 58257456
46152376 58240260
46149232 58240260
46149232 58234984
46135618 58234984
46135618 58228216
46117434 58228216
46117434 582...

output:

257649284

result:

ok single line: '257649284'

Test #96:

score: 0
Accepted
time: 88ms
memory: 6904kb

input:

199996 554773273
457247489 96654740
457247489 98035522
457386217 98035522
457386217 99416304
457247489 99416304
457247489 100797086
457386217 100797086
457386217 102177868
457247489 102177868
457247489 103558650
457386217 103558650
457386217 104939432
457247489 104939432
457247489 106320214
45738621...

output:

392045328

result:

ok single line: '392045328'

Test #97:

score: 0
Accepted
time: 128ms
memory: 49948kb

input:

200000 229224511
46953728 111136872
46953728 201498610
46956022 201498610
46956022 37625500
46956912 37625500
46956912 469175628
46963572 469175628
46963572 66952164
46970390 66952164
46970390 421248598
46973034 421248598
46973034 128514806
46975726 128514806
46975726 464889238
46984802 464889238
46...

output:

135429144

result:

ok single line: '135429144'

Test #98:

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

input:

199996 964660429
619288176 312580210
607378788 312580210
607378788 312479280
595469400 312479280
595469400 312580210
583560012 312580210
583560012 312479280
571650624 312479280
571650624 312580210
559741236 312580210
559741236 312479280
547831848 312479280
547831848 312580210
535922460 312580210
535...

output:

690744504

result:

ok single line: '690744504'

Test #99:

score: 0
Accepted
time: 214ms
memory: 45704kb

input:

199996 414489878
19146915 609931048
19146915 609920864
92049178 609920864
92049178 609893324
12305150 609893324
12305150 609893054
153291573 609893054
153291573 609838290
135815842 609838290
135815842 609833352
180535220 609833352
180535220 609831380
178284247 609831380
178284247 609825486
181261700...

output:

2958

result:

ok single line: '2958'

Test #100:

score: 0
Accepted
time: 150ms
memory: 8664kb

input:

199991 771677560
306811560 386813532
306811560 386591608
316108880 386591608
316108880 386813532
325406200 386813532
325406200 386591608
334703520 386591608
334703520 386813532
344000840 386813532
344000840 386591608
353298160 386591608
353298160 386813532
362595480 386813532
362595480 386591608
371...

output:

18196938

result:

ok single line: '18196938'

Test #101:

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

input:

199991 746609608
578832168 160701904
570443296 160701904
570443296 160814126
562054424 160814126
562054424 160701904
553665552 160701904
553665552 160814126
545276680 160814126
545276680 160701904
536887808 160701904
536887808 160814126
528498936 160814126
528498936 160701904
520110064 160701904
520...

output:

77051858

result:

ok single line: '77051858'

Test #102:

score: 0
Accepted
time: 82ms
memory: 9212kb

input:

199991 889783910
565274484 7862400
565274484 7864920
554806438 7864920
554806438 7862400
544338392 7862400
544338392 7864920
533870346 7864920
533870346 7862400
523402300 7862400
523402300 7864920
512934254 7864920
512934254 7862400
502466208 7862400
502466208 7864920
491998162 7864920
491998162 786...

output:

227424044

result:

ok single line: '227424044'

Test #103:

score: 0
Accepted
time: 145ms
memory: 9024kb

input:

199991 518096946
384206724 418327442
378385410 418327442
378385410 418122480
372564096 418122480
372564096 418327442
366742782 418327442
366742782 418122480
360921468 418122480
360921468 418327442
355100154 418327442
355100154 418122480
349278840 418122480
349278840 418327442
343457526 418327442
343...

output:

518096946

result:

ok single line: '518096946'

Test #104:

score: 0
Accepted
time: 169ms
memory: 54196kb

input:

200000 1000000000
0 0
2 0
2 4902
999900202 4902
999900202 4904
99800 4904
99800 12184
999900204 12184
999900204 12186
99798 12186
99798 31754
999900206 31754
999900206 31756
99796 31756
99796 45504
999900208 45504
999900208 45506
99794 45506
99794 57408
999900210 57408
999900210 57410
99792 57410
99...

output:

999968188

result:

ok single line: '999968188'

Test #105:

score: 0
Accepted
time: 174ms
memory: 53932kb

input:

200000 1000000000
0 0
2 0
2 12518
999900202 12518
999900202 12520
99800 12520
99800 22674
999900204 22674
999900204 22676
99798 22676
99798 23532
999900206 23532
999900206 23534
99796 23534
99796 40620
999900208 40620
999900208 40622
99794 40622
99794 52164
999900210 52164
999900210 52166
99792 5216...

output:

999976726

result:

ok single line: '999976726'

Test #106:

score: 0
Accepted
time: 152ms
memory: 54996kb

input:

200000 1000000000
0 0
2 0
2 18824
999900202 18824
999900202 18826
99800 18826
99800 36562
999900204 36562
999900204 36564
99798 36564
99798 43738
999900206 43738
999900206 43740
99796 43740
99796 59422
999900208 59422
999900208 59424
99794 59424
99794 68608
999900210 68608
999900210 68610
99792 6861...

output:

999962988

result:

ok single line: '999962988'

Test #107:

score: 0
Accepted
time: 204ms
memory: 29020kb

input:

199998 999999999
999999999 0
29093 0
29093 2
28146 2
28146 4
83545 4
83545 6
20314 6
20314 8
67113 8
67113 10
70882 10
70882 12
58521 12
58521 14
17698 14
17698 16
87723 16
87723 18
18644 18
18644 20
97595 20
97595 22
14584 22
14584 24
19921 24
19921 26
614 26
614 28
70507 28
70507 30
87100 30
87100...

output:

0

result:

ok single line: '0'

Test #108:

score: 0
Accepted
time: 141ms
memory: 28900kb

input:

199998 999999999
999999999 0
99997 0
99997 2
99996 2
99996 4
99995 4
99995 6
99994 6
99994 8
99993 8
99993 10
99992 10
99992 12
99991 12
99991 14
99990 14
99990 16
99989 16
99989 18
99988 18
99988 20
99987 20
99987 22
99986 22
99986 24
99985 24
99985 26
99984 26
99984 28
99983 28
99983 30
99982 30
9...

output:

0

result:

ok single line: '0'

Test #109:

score: 0
Accepted
time: 136ms
memory: 28452kb

input:

199998 999999999
999999999 1000000000
99997 1000000000
99997 999999998
99996 999999998
99996 999999996
99995 999999996
99995 999999994
99994 999999994
99994 999999992
99993 999999992
99993 999999990
99992 999999990
99992 999999988
99991 999999988
99991 999999986
99990 999999986
99990 999999984
99989...

output:

0

result:

ok single line: '0'

Test #110:

score: 0
Accepted
time: 122ms
memory: 6896kb

input:

199996 810973206
62257758 269561376
62054964 269561376
62054964 266352312
62257758 266352312
62257758 263143248
62054964 263143248
62054964 259934184
62257758 259934184
62257758 256725120
62054964 256725120
62054964 253516056
62257758 253516056
62257758 250306992
62054964 250306992
62054964 24709792...

output:

810973206

result:

ok single line: '810973206'

Test #111:

score: 0
Accepted
time: 152ms
memory: 10544kb

input:

199996 205981244
185151680 48293064
185151680 48464316
187466076 48464316
187466076 48293064
189780472 48293064
189780472 48464316
192094868 48464316
192094868 48293064
194409264 48293064
194409264 48464316
196723660 48464316
196723660 48293064
199038056 48293064
199038056 48464316
201352452 4846431...

output:

205981244

result:

ok single line: '205981244'

Test #112:

score: 0
Accepted
time: 126ms
memory: 6892kb

input:

200000 867239146
70480800 899350
70480800 1798700
70263936 1798700
70263936 2698050
70480800 2698050
70480800 3597400
70263936 3597400
70263936 4496750
70480800 4496750
70480800 5396100
70263936 5396100
70263936 6295450
70480800 6295450
70480800 7194800
70263936 7194800
70263936 8094150
70480800 809...

output:

867239136

result:

ok single line: '867239136'

Test #113:

score: 0
Accepted
time: 145ms
memory: 9276kb

input:

200000 721800034
630537952 318200352
630537952 318405378
622241400 318405378
622241400 318200352
613944848 318200352
613944848 318405378
605648296 318405378
605648296 318200352
597351744 318200352
597351744 318405378
589055192 318405378
589055192 318200352
580758640 318200352
580758640 318405378
572...

output:

721800026

result:

ok single line: '721800026'

Test #114:

score: 0
Accepted
time: 247ms
memory: 45224kb

input:

200000 1000000000
688828389 692289462
980164574 692289462
980164574 692292452
754623979 692292452
754623979 692324788
778323410 692324788
778323410 692332592
565018780 692332592
565018780 692364084
911143534 692364084
911143534 692390176
508865707 692390176
508865707 692401256
715710694 692401256
71...

output:

1000000000

result:

ok single line: '1000000000'

Test #115:

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

input:

20 912873454
0 92837490
0 9812736
5438570 9812736
5438570 439474
0 439474
0 9092
912873454 9092
912873454 439474
81236182 439474
81236182 9812736
912873454 9812736
912873454 92837490
81236182 92837490
81236182 365827590
912873454 365827590
912873454 889347298
0 889347298
0 365827590
5438570 36582759...

output:

912873454

result:

ok single line: '912873454'

Test #116:

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

input:

8 962374453
962374453 91232
2837461 91232
2837461 49328474
0 49328474
0 837432648
793264844 837432648
793264844 49328474
962374453 49328474

output:

962374453

result:

ok single line: '962374453'

Test #117:

score: 0
Accepted
time: 136ms
memory: 18396kb

input:

199992 49999
40580 81160
40579 81160
40579 81158
40578 81158
40578 81156
40577 81156
40577 81154
40576 81154
40576 81152
40575 81152
40575 81150
40574 81150
40574 81148
40573 81148
40573 81146
40572 81146
40572 81144
40571 81144
40571 81142
40570 81142
40570 81140
40569 81140
40569 81138
40568 81138...

output:

49999

result:

ok single line: '49999'

Subtask #6:

score: 25
Accepted

Test #118:

score: 25
Accepted
time: 26ms
memory: 6892kb

input:

200000 1000000000
1000000000 0
999990876 0
999990876 38
999972524 38
999972524 1510
999969180 1510
999969180 3734
999964780 3734
999964780 4138
999960464 4138
999960464 11052
999953728 11052
999953728 24478
999914972 24478
999914972 25892
999909864 25892
999909864 28102
999902920 28102
999902920 301...

output:

40502

result:

ok single line: '40502'

Test #119:

score: 0
Accepted
time: 98ms
memory: 44236kb

input:

200000 778696306
22822858 87970191
330038016 87970191
330038016 87957657
259262362 87957657
259262362 87923225
316313936 87923225
316313936 87896643
155653960 87896643
155653960 87890367
184851800 87890367
184851800 87877609
93595576 87877609
93595576 87838069
384366344 87838069
384366344 87822439
3...

output:

298364980

result:

ok single line: '298364980'

Test #120:

score: 0
Accepted
time: 26ms
memory: 6748kb

input:

199996 939450484
183372590 726043385
183372590 947636904
183351398 947636904
183351398 585647776
183326398 585647776
183326398 815654133
183324414 815654133
183324414 681316487
183304068 681316487
183304068 993350372
183281288 993350372
183281288 748476649
183258832 748476649
183258832 772289334
183...

output:

158652

result:

ok single line: '158652'

Test #121:

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

input:

200000 1000000000
851050592 949600024
851052652 949600024
851052652 949609374
851074804 949609374
851074804 949619690
851079480 949619690
851079480 949621292
851099180 949621292
851099180 949623446
851108076 949623446
851108076 949624656
851108300 949624656
851108300 949626322
851114392 949626322
85...

output:

0

result:

ok single line: '0'

Test #122:

score: 0
Accepted
time: 61ms
memory: 23088kb

input:

200000 1000000000
563456704 374947039
563456704 374927074
563408574 374927074
563408574 374916426
563395120 374916426
563395120 374901323
563377364 374901323
563377364 374886390
563372770 374886390
563372770 374876185
563370378 374876185
563370378 374859944
563361728 374859944
563361728 374858704
56...

output:

317583084

result:

ok single line: '317583084'

Test #123:

score: 0
Accepted
time: 151ms
memory: 10416kb

input:

199999 96699482
32621512 407805930
31456458 407805930
31456458 407659920
30291404 407659920
30291404 408097950
31456458 408097950
31456458 407951940
32621512 407951940
32621512 408097950
33786566 408097950
33786566 407951940
34951620 407951940
34951620 408097950
36116674 408097950
36116674 407951940...

output:

96699482

result:

ok single line: '96699482'

Test #124:

score: 0
Accepted
time: 137ms
memory: 8944kb

input:

199991 628378890
454249800 18408156
461820630 18408156
461820630 18371848
469391460 18371848
469391460 18408156
476962290 18408156
476962290 18371848
484533120 18371848
484533120 18408156
492103950 18408156
492103950 18371848
499674780 18371848
499674780 18408156
507245610 18408156
507245610 1837184...

output:

597872006

result:

ok single line: '597872006'

Test #125:

score: 0
Accepted
time: 147ms
memory: 10212kb

input:

199991 411269100
304822980 10387669
304822980 10334399
309661440 10334399
309661440 10387669
314499900 10387669
314499900 10334399
319338360 10334399
319338360 10387669
324176820 10387669
324176820 10334399
329015280 10334399
329015280 10387669
333853740 10387669
333853740 10334399
338692200 1033439...

output:

409773014

result:

ok single line: '409773014'

Test #126:

score: 0
Accepted
time: 139ms
memory: 54984kb

input:

200000 1000000000
0 0
2 0
2 7506
999900202 7506
999900202 7508
99800 7508
99800 8994
999900204 8994
999900204 8996
99798 8996
99798 16558
999900206 16558
999900206 16560
99796 16560
99796 32318
999900208 32318
999900208 32320
99794 32320
99794 35116
999900210 35116
999900210 35118
99792 35118
99792 ...

output:

999966026

result:

ok single line: '999966026'

Test #127:

score: 0
Accepted
time: 168ms
memory: 54440kb

input:

200000 1000000000
0 0
2 0
2 15124
999900202 15124
999900202 15126
99800 15126
99800 28330
999900204 28330
999900204 28332
99798 28332
99798 33696
999900206 33696
999900206 33698
99796 33698
99796 43952
999900208 43952
999900208 43954
99794 43954
99794 46390
999900210 46390
999900210 46392
99792 4639...

output:

999961970

result:

ok single line: '999961970'

Test #128:

score: 0
Accepted
time: 159ms
memory: 53296kb

input:

200000 1000000000
0 0
2 0
2 17910
999900202 17910
999900202 17912
99800 17912
99800 29854
999900204 29854
999900204 29856
99798 29856
99798 32692
999900206 32692
999900206 32694
99796 32694
99796 41542
999900208 41542
999900208 41544
99794 41544
99794 45142
999900210 45142
999900210 45144
99792 4514...

output:

999966092

result:

ok single line: '999966092'

Test #129:

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

input:

100624 506028352
0 8751
9104 8751
9104 32159
12966 32159
12966 45070
50526 45070
50526 58152
64694 58152
64694 99309
66288 99309
66288 142125
91496 142125
91496 147329
96042 147329
96042 149406
130818 149406
130818 174885
163952 174885
163952 187058
167450 187058
167450 207028
208448 207028
208448 2...

output:

506028352

result:

ok single line: '506028352'

Test #130:

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

input:

12 238947238
8922 63488
8922 123
92348756 123
92348756 63488
238947238 63488
238947238 3474740
92348756 3474740
92348756 845673459
8922 845673459
8922 3474740
0 3474740
0 63488

output:

238947238

result:

ok single line: '238947238'

Test #131:

score: 0
Accepted
time: 98ms
memory: 43700kb

input:

100532 502940770
0 15447
122642 15447
122642 30295
176092 30295
176092 37938
214052 37938
214052 42195
239082 42195
239082 42698
242510 42698
242510 52373
258142 52373
258142 56745
260132 56745
260132 85113
280290 85113
280290 141795
303652 141795
303652 155321
327606 155321
327606 158599
333920 158...

output:

502940770

result:

ok single line: '502940770'

Subtask #7:

score: 10
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #132:

score: 10
Accepted
time: 141ms
memory: 9420kb

input:

199998 831306754
487317750 155177496
487317750 155048718
477762500 155048718
477762500 155091644
468207250 155091644
468207250 155048718
458652000 155048718
458652000 155091644
449096750 155091644
449096750 155048718
439541500 155048718
439541500 155091644
429986250 155091644
429986250 155048718
420...

output:

831306750

result:

ok single line: '831306750'

Test #133:

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

input:

200000 1000000000
871425382 923888772
871434062 923888772
871434062 923892394
871442674 923892394
871442674 923892602
871442888 923892602
871442888 923900052
871449698 923900052
871449698 923908358
871451800 923908358
871451800 923908784
871454852 923908784
871454852 923913636
871476562 923913636
87...

output:

0

result:

ok single line: '0'

Test #134:

score: 0
Accepted
time: 207ms
memory: 77244kb

input:

200000 999938464
574507500 700896323
574493366 700896323
574493366 929876045
574473744 929876045
574473744 817448352
574451692 817448352
574451692 984815317
574419070 984815317
574419070 813308191
574396606 813308191
574396606 997466185
574385516 997466185
574385516 917289241
574375672 917289241
574...

output:

999938454

result:

ok single line: '999938454'

Test #135:

score: 0
Accepted
time: 121ms
memory: 6892kb

input:

200000 120881782
70310328 232338960
70310328 229112030
70340556 229112030
70340556 225885100
70310328 225885100
70310328 222658170
70340556 222658170
70340556 219431240
70310328 219431240
70310328 216204310
70340556 216204310
70340556 212977380
70310328 212977380
70310328 209750450
70340556 20975045...

output:

120881778

result:

ok single line: '120881778'

Test #136:

score: 0
Accepted
time: 252ms
memory: 45784kb

input:

200000 999999990
835677023 128131772
835677023 128172894
999675556 128172894
999675556 128193832
821556512 128193832
821556512 128205622
866878428 128205622
866878428 128211842
706084526 128211842
706084526 128239234
953818691 128239234
953818691 128271462
530983112 128271462
530983112 128295288
737...

output:

999999980

result:

ok single line: '999999980'

Test #137:

score: 0
Accepted
time: 154ms
memory: 52468kb

input:

200000 1000000000
894408408 472957229
894408408 472894410
894407544 472894410
894407544 472889255
894407407 472889255
894407407 472887222
894402967 472887222
894402967 472717341
894402766 472717341
894402766 472717338
894397628 472717338
894397628 472689152
894394487 472689152
894394487 472613761
89...

output:

820533442

result:

ok single line: '820533442'

Test #138:

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

input:

200000 86241892
32712438 24131980
33703724 24131980
33703724 24138702
34695010 24138702
34695010 24131980
35686296 24131980
35686296 24138702
36677582 24138702
36677582 24131980
37668868 24131980
37668868 24138702
38660154 24138702
38660154 24131980
39651440 24131980
39651440 24138702
40642726 24138...

output:

86241882

result:

ok single line: '86241882'

Test #139:

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

input:

99752 496699828
0 15466
35974 15466
35974 17799
47158 17799
47158 32883
50200 32883
50200 44240
131618 44240
131618 45152
135472 45152
135472 62699
151480 62699
151480 147236
159690 147236
159690 158323
186938 158323
186938 167055
216968 167055
216968 184663
231942 184663
231942 196916
233890 196916...

output:

452576650

result:

ok single line: '452576650'

Test #140:

score: 0
Accepted
time: 190ms
memory: 63728kb

input:

200000 1000000000
8385792 1047050
8385792 1045316
8360206 1045316
8360206 1043490
8356206 1043490
8356206 1043124
8343766 1043124
8343766 1042642
8342816 1042642
8342816 1042404
8340052 1042404
8340052 1042402
8337348 1042402
8337348 1041164
8332280 1041164
8332280 1040952
8330094 1040952
8330094 10...

output:

1000000000

result:

ok single line: '1000000000'

Test #141:

score: 0
Accepted
time: 167ms
memory: 65148kb

input:

200000 1000000000
417766566 933991416
417780926 933991416
417780926 933991798
417781886 933991798
417781886 933993168
417781886 933993748
417798714 933993748
417798714 933993852
417809280 933993852
417809280 933995590
417823744 933995590
417823744 933995746
417832976 933995746
417832976 933995772
41...

output:

1000000000

result:

ok single line: '1000000000'

Test #142:

score: 0
Accepted
time: 246ms
memory: 54308kb

input:

200000 999999445
916222410 618996150
966352263 618996150
966352263 618997158
938444497 618997158
938444497 619001404
997595365 619001404
997595365 619009088
969062081 619009088
969062081 619015358
864157537 619015358
864157537 619015874
983528623 619015874
983528623 619030794
520123953 619030794
520...

output:

0

result:

ok single line: '0'

Test #143:

score: 0
Accepted
time: 162ms
memory: 60328kb

input:

200000 999999980
885638700 55670852
885638700 55669114
885627924 55669114
885627924 55669028
885627054 55669028
885627054 55668876
885625900 55668876
885625900 55668364
885624506 55668364
885624506 55667704
885623182 55667704
885623182 55667620
885623076 55667620
885623076 55667316
885613586 5566731...

output:

0

result:

ok single line: '0'

Test #144:

score: 0
Accepted
time: 20ms
memory: 6900kb

input:

199994 99996
93590 3203
93590 3202
93592 3202
93592 3201
93594 3201
93594 3200
93596 3200
93596 3199
93598 3199
93598 3198
93600 3198
93600 3197
93602 3197
93602 3196
93604 3196
93604 3195
93606 3195
93606 3194
93608 3194
93608 3193
93610 3193
93610 3192
93612 3192
93612 3191
93614 3191
93614 3190
9...

output:

0

result:

ok single line: '0'

Test #145:

score: 0
Accepted
time: 234ms
memory: 45044kb

input:

200000 999999980
511165009 347421733
678313528 347421733
678313528 347430837
654149593 347430837
654149593 347464189
861361617 347464189
861361617 347479175
563179963 347479175
563179963 347488969
918862392 347488969
918862392 347527627
764370668 347527627
764370668 347544143
786671480 347544143
786...

output:

0

result:

ok single line: '0'

Test #146:

score: 0
Accepted
time: 219ms
memory: 77684kb

input:

200000 999982382
311688442 178775141
311688442 210664704
311713822 210664704
311713822 166697007
311748512 166697007
311748512 352388822
311750830 352388822
311750830 199120397
311784962 199120397
311784962 202223306
311816304 202223306
311816304 112934172
311819186 112934172
311819186 334880060
311...

output:

999982382

result:

ok single line: '999982382'

Test #147:

score: 0
Accepted
time: 165ms
memory: 70848kb

input:

200000 999999980
0 999998108
4150 999998108
4150 999996084
27838 999996084
27838 999986012
32960 999986012
32960 999980376
52992 999980376
52992 999980154
69558 999980154
69558 999972326
70758 999972326
70758 999969262
75542 999969262
75542 999967314
78558 999967314
78558 999961396
120932 999961396
...

output:

0

result:

ok single line: '0'

Test #148:

score: 0
Accepted
time: 11ms
memory: 5068kb

input:

99880 499992530
0 11641
1 11641
1 14405
77110 14405
77110 20829
89456 20829
89456 27792
96946 27792
96946 33064
100428 33064
100428 95826
110054 95826
110054 112126
113984 112126
113984 128134
120658 128134
120658 142447
128478 142447
128478 152829
155010 152829
155010 188359
156496 188359
156496 21...

output:

0

result:

ok single line: '0'