QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#849572#361. Port FacilityZhaoZiLong100 ✓242ms63640kbC++141.7kb2025-01-09 16:19:472025-01-09 16:19:48

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 10
Accepted

Test #1:

score: 10
Accepted
time: 2ms
memory: 10000kb

input:

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

output:

32

result:

ok single line: '32'

Test #2:

score: 10
Accepted
time: 1ms
memory: 9988kb

input:

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

output:

32

result:

ok single line: '32'

Test #3:

score: 10
Accepted
time: 1ms
memory: 9732kb

input:

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

output:

128

result:

ok single line: '128'

Test #4:

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

input:

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

output:

32

result:

ok single line: '32'

Test #5:

score: 10
Accepted
time: 0ms
memory: 9728kb

input:

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

output:

16

result:

ok single line: '16'

Test #6:

score: 10
Accepted
time: 1ms
memory: 9704kb

input:

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

output:

1024

result:

ok single line: '1024'

Test #7:

score: 10
Accepted
time: 1ms
memory: 9764kb

input:

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

output:

512

result:

ok single line: '512'

Test #8:

score: 10
Accepted
time: 1ms
memory: 9712kb

input:

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

output:

256

result:

ok single line: '256'

Test #9:

score: 10
Accepted
time: 0ms
memory: 9956kb

input:

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

output:

128

result:

ok single line: '128'

Test #10:

score: 10
Accepted
time: 1ms
memory: 9988kb

input:

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

output:

16

result:

ok single line: '16'

Test #11:

score: 10
Accepted
time: 1ms
memory: 9768kb

input:

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

output:

0

result:

ok single line: '0'

Test #12:

score: 10
Accepted
time: 1ms
memory: 9760kb

input:

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

output:

0

result:

ok single line: '0'

Test #13:

score: 10
Accepted
time: 0ms
memory: 9736kb

input:

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

output:

0

result:

ok single line: '0'

Test #14:

score: 10
Accepted
time: 1ms
memory: 9640kb

input:

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

output:

262144

result:

ok single line: '262144'

Test #15:

score: 10
Accepted
time: 1ms
memory: 9764kb

input:

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

output:

1048576

result:

ok single line: '1048576'

Test #16:

score: 10
Accepted
time: 1ms
memory: 9700kb

input:

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

output:

0

result:

ok single line: '0'

Test #17:

score: 10
Accepted
time: 1ms
memory: 9620kb

input:

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

output:

2

result:

ok single line: '2'

Test #18:

score: 10
Accepted
time: 0ms
memory: 9800kb

input:

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

output:

2

result:

ok single line: '2'

Test #19:

score: 10
Accepted
time: 0ms
memory: 9732kb

input:

1
1 2

output:

2

result:

ok single line: '2'

Test #20:

score: 10
Accepted
time: 1ms
memory: 9696kb

input:

2
1 3
2 4

output:

2

result:

ok single line: '2'

Test #21:

score: 10
Accepted
time: 1ms
memory: 9760kb

input:

2
1 4
2 3

output:

4

result:

ok single line: '4'

Test #22:

score: 10
Accepted
time: 0ms
memory: 9624kb

input:

2
1 2
3 4

output:

4

result:

ok single line: '4'

Test #23:

score: 10
Accepted
time: 2ms
memory: 9640kb

input:

4
1 5
2 4
3 7
6 8

output:

2

result:

ok single line: '2'

Test #24:

score: 10
Accepted
time: 1ms
memory: 9700kb

input:

5
1 4
2 5
3 8
7 9
6 10

output:

0

result:

ok single line: '0'

Subtask #2:

score: 12
Accepted

Dependency #1:

100%
Accepted

Test #25:

score: 12
Accepted
time: 2ms
memory: 9848kb

input:

1999
1994 2003
962 3014
2411 2415
2656 2661
895 896
234 3813
570 3395
2478 2481
2521 2522
1540 1553
3473 3478
462 3472
1468 1470
670 3368
771 773
1723 1724
463 3575
1644 2400
78 79
84 3870
553 554
647 3300
548 3431
513 3445
274 276
528 529
1138 2786
2143 2292
295 3694
2023 2051
585 586
850 852
1431 ...

output:

836715482

result:

ok single line: '836715482'

Test #26:

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

input:

1998
2646 2647
1973 1978
534 3592
2684 2685
1400 1404
3139 3140
847 3256
220 3691
347 3569
3134 3138
688 3437
2118 2120
240 3817
134 3790
344 345
2588 2591
1570 2455
417 3700
1358 2788
218 3694
84 3841
34 3976
1175 1176
2525 2526
2777 2784
295 3625
657 3302
1139 2794
775 3191
1489 2327
946 3137
478 ...

output:

836715482

result:

ok single line: '836715482'

Test #27:

score: 12
Accepted
time: 2ms
memory: 9848kb

input:

1997
899 901
766 768
3575 3576
1781 1785
802 3120
1072 1075
907 908
1400 2402
2824 2825
893 3148
3627 3629
535 3388
2255 2468
109 3949
252 3819
1806 1911
422 3529
1387 1391
298 3780
1390 1405
1364 2673
1809 1813
2366 2369
266 3679
594 3447
1561 1574
2043 2164
1314 1318
1038 3003
71 3963
1467 1468
13...

output:

380701092

result:

ok single line: '380701092'

Test #28:

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

input:

2000
827 2954
2307 2310
1467 1480
1583 2761
192 3878
2985 2988
422 3682
248 3829
1283 1284
1128 3022
131 3773
2704 2706
211 3674
1418 1962
82 3851
256 3822
2989 3000
1520 1521
2250 2272
2746 2748
2226 2230
3351 3352
2263 2287
1224 2969
946 2741
80 3852
765 3385
1616 1809
1679 2715
766 767
252 3632
2...

output:

549790477

result:

ok single line: '549790477'

Test #29:

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

input:

1999
1348 1353
490 491
864 872
1680 1685
1072 2878
322 3755
200 3708
371 3720
1910 1922
885 3206
2256 2263
1159 2882
1894 1896
484 3563
385 387
254 3815
614 3291
1187 2798
786 3275
3172 3173
1873 1874
1413 2648
1555 1560
1349 1350
1540 1541
132 3794
156 3763
940 2972
3582 3583
2682 2683
54 3964
964 ...

output:

183480587

result:

ok single line: '183480587'

Test #30:

score: 12
Accepted
time: 2ms
memory: 10044kb

input:

1998
1835 2030
1787 2434
325 3817
23 3982
2470 2476
598 3228
2801 2805
2977 2980
2600 2613
2547 2548
439 3690
2997 3003
2763 2771
3058 3059
174 3684
123 3751
1095 1098
1390 1391
1041 3028
461 3676
2741 2742
658 3473
950 3126
1733 1736
1082 1087
976 2830
137 3742
1365 1368
2994 2995
1711 1712
1205 12...

output:

273793820

result:

ok single line: '273793820'

Test #31:

score: 12
Accepted
time: 2ms
memory: 9748kb

input:

1997
567 569
1731 1732
1220 2463
1750 1752
1872 1876
1898 1899
51 3944
899 900
1436 1444
32 3961
226 3747
1916 1917
1601 2238
1162 2899
1417 1418
866 3199
116 3895
548 3513
1762 1763
786 3303
2001 2004
3074 3094
639 3433
862 3206
2201 2245
2547 2568
1525 1529
340 3727
251 3717
427 3510
141 3866
434 ...

output:

813295338

result:

ok single line: '813295338'

Test #32:

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

input:

2000
1007 1009
2531 2534
1306 2712
32 3984
1521 1524
2201 2227
613 614
171 3881
665 3438
1719 1720
2382 2383
1219 2838
1392 2781
1330 1331
94 3855
1411 1416
2110 2235
1280 2739
1115 2916
258 3784
3162 3169
1798 1800
1694 1695
2288 2294
123 3927
1894 1897
1824 1829
1771 1774
3478 3479
2982 2983
118 3...

output:

942059893

result:

ok single line: '942059893'

Test #33:

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

input:

1999
574 3394
2461 2462
456 3491
3342 3347
1934 1936
1342 2675
1243 2844
1360 1363
123 3931
3237 3238
2683 2684
703 3293
765 3209
675 681
1917 1927
815 3169
246 3688
1324 2754
2330 2335
1678 2419
3807 3808
1993 1999
879 890
472 477
510 3436
1724 1731
3079 3080
1393 1394
3269 3270
1293 1296
2484 2500...

output:

0

result:

ok single line: '0'

Test #34:

score: 12
Accepted
time: 2ms
memory: 10060kb

input:

1998
501 3489
1406 1409
409 3620
178 180
1293 2899
3459 3460
2532 2533
112 3846
1726 1727
538 3430
644 3352
2611 2612
2471 2472
2887 2892
741 3377
3698 3699
611 3381
71 3871
426 3563
3067 3068
976 2969
560 3505
2782 2783
1589 2391
2890 2891
1568 1571
2233 2235
1856 1887
374 3664
623 3469
117 3839
23...

output:

0

result:

ok single line: '0'

Test #35:

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

input:

1997
3191 3192
475 476
3965 3966
131 132
2355 2356
3349 3350
3509 3510
1177 1178
3713 3714
33 34
3665 3666
3453 3454
109 110
1403 1404
1759 1760
709 710
1825 1826
1101 1102
3423 3424
389 390
29 30
1481 1482
1605 1606
2647 2648
1945 1946
2343 2344
2511 2512
499 500
1667 1668
1765 1766
1361 1362
2637 ...

output:

593652318

result:

ok single line: '593652318'

Test #36:

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

input:

2000
1113 2888
1533 2468
1973 2028
387 3614
491 3510
1858 2143
1583 2418
738 3263
1796 2205
1775 2226
805 3196
1013 2988
1669 2332
821 3180
515 3486
677 3324
197 3804
901 3100
1058 2943
503 3498
362 3639
1265 2736
1319 2682
1477 2524
1944 2057
942 3059
136 3865
251 3750
813 3188
175 3826
1453 2548
1...

output:

749218516

result:

ok single line: '749218516'

Test #37:

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

input:

1999
240 2239
995 2994
116 2115
1989 3988
718 2717
1249 3248
1545 3544
1814 3813
1379 3378
853 2852
1030 3029
1068 3067
1903 3902
848 2847
509 2508
1175 3174
1626 3625
1768 3767
961 2960
1321 3320
368 2367
248 2247
257 2256
215 2214
100 2099
870 2869
1353 3352
1590 3589
912 2911
313 2312
1281 3280
1...

output:

0

result:

ok single line: '0'

Test #38:

score: 12
Accepted
time: 2ms
memory: 9976kb

input:

1998
66 1065
391 1390
2564 3563
2604 3603
2639 3638
606 1605
114 1113
2784 3783
2466 3465
592 1591
2846 3845
2807 3806
2910 3909
5 1004
907 1906
543 1542
2695 3694
274 1273
912 1911
2775 3774
2113 3112
2046 3045
446 1445
239 1238
641 1640
937 1936
802 1801
2740 3739
995 1994
336 1335
2388 3387
762 1...

output:

0

result:

ok single line: '0'

Test #39:

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

input:

1996
490 492
1165 1167
2054 2056
2398 2400
3533 3535
918 920
2665 2667
33 35
1605 1607
1486 1488
1062 1064
2550 2552
3709 3711
2437 2439
2689 2691
2877 2879
3093 3095
702 704
3341 3343
3677 3679
2162 2164
3901 3903
1229 1231
2333 2335
2905 2907
1570 1572
2985 2987
269 271
2857 2859
3605 3607
3846 38...

output:

672105806

result:

ok single line: '672105806'

Test #40:

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

input:

2000
2017 2020
1262 1263
2318 2319
501 504
2830 2831
2565 2568
1838 1839
1633 1636
3577 3580
2257 2260
2298 2299
285 288
3526 3527
737 740
2682 2683
321 324
826 827
3001 3004
3694 3695
2057 2060
342 343
3826 3827
73 76
2742 2743
2802 2803
1102 1103
486 487
1509 1512
1170 1171
1842 1843
2062 2063
341...

output:

749218516

result:

ok single line: '749218516'

Test #41:

score: 12
Accepted
time: 2ms
memory: 9808kb

input:

1999
1011 3987
223 2776
1304 3694
1708 3290
1916 3082
1275 3723
468 2531
1775 3223
868 2131
927 2072
448 2551
1450 3548
119 2880
1869 3129
1691 3307
110 2889
1977 3021
587 2412
1044 3954
1849 3149
82 2917
627 2372
632 2367
573 2426
423 2576
997 2002
723 2276
713 2286
1312 3686
991 2008
1557 3441
923...

output:

2

result:

ok single line: '2'

Test #42:

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

input:

1998
1519 3477
1613 3383
1748 3248
101 2897
1375 3621
1591 3405
40 2958
414 2584
1640 3356
454 2544
324 2674
28 2970
422 2576
713 2285
1315 3681
518 2480
1888 3108
771 2227
1998 2998
507 2491
1242 3754
975 2023
41 2957
1013 3983
743 2255
839 2159
1229 3767
1254 3742
366 2632
1605 3391
382 2616
23 29...

output:

2

result:

ok single line: '2'

Test #43:

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

input:

1997
2887 2890
291 294
2305 2308
2799 2802
2491 2494
93 96
3407 3410
1525 1528
3571 3574
1001 1004
3505 3508
3507 3510
3355 3358
3623 3626
1051 1054
1527 1530
2141 2144
3369 3372
1255 1258
2085 2088
3091 3094
359 362
3961 3964
2633 2636
1615 1618
255 258
1851 1854
165 168
1767 1770
407 410
995 998
3...

output:

0

result:

ok single line: '0'

Test #44:

score: 12
Accepted
time: 2ms
memory: 9844kb

input:

2000
2767 2770
3317 3320
3421 3424
511 514
1391 1394
1403 1406
3411 3414
1081 1084
2719 2722
497 500
1919 1922
3105 3108
1435 1438
1815 1818
3151 3154
1249 1252
2987 2990
2277 2280
3369 3372
2831 2834
2043 2046
1449 1452
2673 2676
863 866
2503 2506
3577 3580
2567 2570
1421 1424
2915 2918
1149 1152
1...

output:

2

result:

ok single line: '2'

Subtask #3:

score: 56
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #45:

score: 56
Accepted
time: 14ms
memory: 17348kb

input:

99999
9889 189990
141754 141771
21073 178614
142098 142100
31502 168656
19424 180340
104742 104744
83923 83933
86716 112423
43308 43319
5768 194180
81753 81755
104932 104934
3863 196276
20824 178866
46827 46828
21490 178206
117755 117756
26731 26733
40733 159540
143479 143480
26356 173474
18383 1818...

output:

721540074

result:

ok single line: '721540074'

Test #46:

score: 56
Accepted
time: 15ms
memory: 13384kb

input:

99998
23540 176595
90315 90318
62440 62441
72864 72866
2869 196727
12356 188087
48764 48765
12242 188227
170005 170006
32312 167722
161861 161862
41626 158424
11624 188874
98738 98740
68002 133188
79686 79689
9173 190362
54122 145654
8866 190637
38837 38838
159269 159271
80145 119181
38281 38283
641...

output:

346408247

result:

ok single line: '346408247'

Test #47:

score: 56
Accepted
time: 19ms
memory: 15448kb

input:

99997
39810 39811
56023 144549
79865 79866
100697 100700
11628 188487
26560 173340
52594 52599
115093 115117
58207 142089
91690 110948
5443 194553
62877 137465
38272 162096
34182 34183
20210 20212
118924 118927
6233 193843
16047 184030
67490 67493
15145 15146
116711 116714
3224 196768
33168 166931
8...

output:

408288956

result:

ok single line: '408288956'

Test #48:

score: 56
Accepted
time: 18ms
memory: 13468kb

input:

100000
97147 97307
47204 152416
101180 101194
149391 149392
92922 92932
28175 171954
74703 74707
5329 195218
93683 107093
56353 144612
78489 78621
14366 185366
34727 165430
93171 107176
10263 190057
8433 192009
91000 91002
18572 181680
48068 151463
9297 191067
90677 90683
36050 36051
79053 119688
13...

output:

305008613

result:

ok single line: '305008613'

Test #49:

score: 56
Accepted
time: 11ms
memory: 14880kb

input:

99999
129717 129718
30722 169010
101297 101345
73029 127277
54617 145690
75673 75674
85323 85324
77567 77580
132359 132364
91707 91708
16876 182882
139596 139599
35665 164231
41904 41906
10118 189882
79965 79967
12626 187315
9825 190205
51529 148891
50180 149648
708 199426
98747 98748
21302 178273
6...

output:

143783125

result:

ok single line: '143783125'

Test #50:

score: 56
Accepted
time: 17ms
memory: 15360kb

input:

99998
13554 186750
97166 102177
171494 171496
19320 180436
10678 188936
17762 181922
118990 119010
541 198920
13159 13160
171523 171526
61507 137651
47283 152434
11444 188243
105895 105906
104939 104944
82663 82665
30122 169806
30120 169810
110769 110770
10099 189458
124511 124513
138070 138098
2769...

output:

0

result:

ok single line: '0'

Test #51:

score: 56
Accepted
time: 17ms
memory: 14876kb

input:

99997
53895 53900
90391 90393
48416 48421
51489 147691
45057 154107
64492 64493
27721 27724
142239 142244
72121 72125
6414 6415
83071 83072
75774 75776
342 199585
108732 108733
21172 21178
33462 166220
19731 180454
16040 184110
744 199154
77086 77087
2286 197766
144786 144793
9273 190926
40299 15905...

output:

0

result:

ok single line: '0'

Test #52:

score: 56
Accepted
time: 7ms
memory: 16408kb

input:

100000
49013 49014
4183 4184
42631 42632
123133 123134
77691 77692
129009 129010
152271 152272
193515 193516
187775 187776
31251 31252
161657 161658
151127 151128
76749 76750
150225 150226
98835 98836
166627 166628
131617 131618
92431 92432
51191 51192
146543 146544
22437 22438
65261 65262
178455 17...

output:

607723520

result:

ok single line: '607723520'

Test #53:

score: 56
Accepted
time: 12ms
memory: 11380kb

input:

99999
91198 108801
22441 177558
3384 196615
6207 193792
59405 140594
45786 154213
57451 142548
63669 136330
90057 109942
50776 149223
83475 116524
8261 191738
11990 188009
30674 169325
78085 121914
56882 143117
60718 139281
95744 104255
65077 134922
17971 182028
38092 161907
1395 198604
21636 178363...

output:

303861760

result:

ok single line: '303861760'

Test #54:

score: 56
Accepted
time: 14ms
memory: 17096kb

input:

99998
37832 137830
3080 103078
26171 126169
65432 165430
17732 117730
35658 135656
89268 189266
46067 146065
7694 107692
66010 166008
30670 130668
2994 102992
47043 147041
41388 141386
68209 168207
73967 173965
49187 149185
86848 186846
70388 170386
19328 119326
91444 191442
25813 125811
81302 18130...

output:

0

result:

ok single line: '0'

Test #55:

score: 56
Accepted
time: 4ms
memory: 14744kb

input:

99997
122213 172212
43588 93586
103371 153370
146160 196159
130525 180524
127578 177577
139926 189925
664 50662
31142 81140
119019 169018
114445 164444
117498 167497
33592 83590
33736 83734
45220 95218
116164 166163
131889 181888
146672 196671
17224 67222
35360 85358
9567 59565
101597 151596
115268 ...

output:

0

result:

ok single line: '0'

Test #56:

score: 56
Accepted
time: 15ms
memory: 16824kb

input:

100000
2608 52608
110458 160458
9774 59774
101011 151011
7800 57800
13082 63082
141685 191685
140857 190857
147376 197376
141714 191714
19553 69553
149818 199818
24883 74883
129999 179999
144005 194005
126284 176284
27040 77040
116845 166845
16351 66351
17757 67757
27789 77789
120463 170463
136259 1...

output:

0

result:

ok single line: '0'

Test #57:

score: 56
Accepted
time: 9ms
memory: 15252kb

input:

99998
152522 152524
172222 172224
137526 137528
46526 46528
155069 155071
2745 2747
197917 197919
29994 29996
114277 114279
143978 143980
127145 127147
47225 47227
111610 111612
15225 15227
29281 29283
190233 190235
64434 64436
47946 47948
100777 100779
121242 121244
11566 11568
147413 147415
65734 ...

output:

509082729

result:

ok single line: '509082729'

Test #58:

score: 56
Accepted
time: 14ms
memory: 16760kb

input:

99998
27422 27423
15701 15704
84053 84056
93929 93932
3862 3863
122658 122659
105969 105972
147122 147123
3238 3239
102265 102268
197978 197979
191130 191131
28138 28139
29590 29591
14858 14859
7326 7327
97473 97476
121170 121171
34386 34387
104457 104460
184377 184380
11090 11091
85925 85928
11737 ...

output:

151930880

result:

ok single line: '151930880'

Test #59:

score: 56
Accepted
time: 13ms
memory: 15420kb

input:

99997
154861 154862
30743 169072
186409 186410
192170 192171
97435 102768
16608 16609
78277 121913
101557 101558
69547 69549
23111 176552
196403 196405
37907 161818
44588 155308
66654 66655
56357 56358
10814 188947
174520 174521
122273 122274
41282 41283
153218 153220
185827 185828
167076 167079
144...

output:

949391

result:

ok single line: '949391'

Test #60:

score: 56
Accepted
time: 18ms
memory: 13124kb

input:

100000
175477 175478
4754 195246
61531 138106
178705 178706
65229 133923
33 34
83589 116538
87242 87248
154172 154174
177522 177523
58125 58127
43996 43997
14804 14805
64082 64083
132164 132165
194286 194287
22670 177948
85375 85380
61634 137989
193362 193363
47206 152923
140357 140372
174224 174225...

output:

531347765

result:

ok single line: '531347765'

Test #61:

score: 56
Accepted
time: 15ms
memory: 13100kb

input:

99999
193607 193610
90457 108926
135893 135925
24366 24374
49638 49674
36982 36995
13934 13950
59318 140306
19398 179176
127984 127986
41601 156863
77343 77344
123977 123991
76444 122590
76468 122534
195838 195893
5231 5314
66747 133359
92690 106580
16463 16469
105917 105921
73333 73335
165651 16565...

output:

205931010

result:

ok single line: '205931010'

Test #62:

score: 56
Accepted
time: 15ms
memory: 13272kb

input:

99998
44542 155277
151548 151549
52067 147664
73874 73875
58430 58431
3718 3719
117420 117421
91614 91617
78640 120577
172415 172416
87128 112287
126580 126581
180018 180020
9793 190412
170135 170137
59383 140425
168158 168161
66766 66767
48122 48123
25337 174634
46622 153157
69742 69745
107570 1075...

output:

0

result:

ok single line: '0'

Test #63:

score: 56
Accepted
time: 12ms
memory: 14988kb

input:

99997
86823 111584
87206 111212
27028 27032
54046 54047
75204 123600
67705 130943
87242 87254
42785 42786
42707 156279
28570 170661
174895 174896
3209 196657
185168 185187
19856 19864
135948 135950
43090 43091
141915 141930
188333 188337
127944 127945
90584 107365
35404 163872
26898 172210
193537 19...

output:

0

result:

ok single line: '0'

Test #64:

score: 56
Accepted
time: 17ms
memory: 15144kb

input:

100000
198088 198090
62830 138720
23948 23986
49005 152899
78048 78059
4967 4970
145160 145165
161427 161429
81794 81795
86006 86007
69921 132499
22635 22695
4595 195475
47704 47709
75959 127154
70978 132152
174098 174099
96508 96510
157268 157280
2836 197026
164121 164122
135482 135500
197861 19794...

output:

0

result:

ok single line: '0'

Test #65:

score: 56
Accepted
time: 18ms
memory: 16548kb

input:

99999
123128 184136
21439 61552
47768 50579
54664 178805
30977 142416
136727 196273
11715 88820
5904 138194
40762 144844
2341 144830
20268 57291
86542 164379
76843 150198
104644 183193
69016 196542
79441 181847
130926 191188
10006 95974
82056 182780
12234 148754
15608 140056
65278 175961
128638 1745...

output:

0

result:

ok single line: '0'

Test #66:

score: 56
Accepted
time: 10ms
memory: 17300kb

input:

99998
50366 196823
8584 80043
65127 183170
145330 166814
113859 156350
35548 64442
110003 180496
6506 109739
10326 67688
121405 173159
65926 169590
92585 154120
51704 187212
89176 154450
41626 65784
117731 190581
82478 164908
37656 86761
109052 177112
66601 170289
13281 57488
130538 172140
109444 15...

output:

0

result:

ok single line: '0'

Test #67:

score: 56
Accepted
time: 16ms
memory: 17332kb

input:

99997
10913 128164
13782 122365
18228 113509
50037 199980
125441 162259
29529 90901
39345 71465
110890 169578
136573 156700
955 148141
109418 170324
136719 156639
112876 168581
139623 155181
32771 84454
2730 144538
28344 93311
89875 180065
81866 184004
24635 100643
78675 185581
1504 147050
49792 503...

output:

2

result:

ok single line: '2'

Test #68:

score: 56
Accepted
time: 16ms
memory: 13716kb

input:

100000
97000 176549
108630 170736
99272 175416
23301 103343
84288 182909
132337 158908
109772 170159
131907 159131
858 148291
33414 83119
83972 183058
38915 72103
14438 121012
10190 129476
32575 84702
93932 178117
84965 182606
145775 152120
92287 178928
60994 194464
25211 99485
44020 62049
106298 17...

output:

8

result:

ok single line: '8'

Test #69:

score: 56
Accepted
time: 10ms
memory: 18116kb

input:

99999
123520 139821
56530 184505
36951 197578
127493 137202
114515 145822
80565 168402
117298 143978
80032 168761
23593 62714
45843 191601
2589 125657
26391 54393
72949 173537
24800 59109
100442 155210
29313 45546
132074 134165
98177 156706
53693 186346
30773 41028
70259 175333
100931 154892
53805 1...

output:

4

result:

ok single line: '4'

Test #70:

score: 56
Accepted
time: 11ms
memory: 12360kb

input:

99998
144 132900
101459 154649
27853 49707
37175 197463
127251 137408
53112 186839
121430 141336
75182 172206
16800 82545
65482 178624
80739 168521
63736 179784
54691 185757
6880 112439
93598 159891
7548 110466
82500 167342
66551 177888
31363 39218
21418 68814
115296 145445
105896 151708
26187 54758...

output:

2

result:

ok single line: '2'

Test #71:

score: 56
Accepted
time: 14ms
memory: 12016kb

input:

99997
689 149307
97496 152497
97474 152519
25923 124073
15481 134515
40737 109259
486 149510
86076 163917
43279 106717
49583 100413
97105 152888
27174 122822
96890 153103
53515 196478
63727 186266
36012 113984
52893 197100
50649 199344
58796 191197
49542 100454
35804 114192
46290 103706
43116 106880...

output:

2

result:

ok single line: '2'

Test #72:

score: 56
Accepted
time: 14ms
memory: 12008kb

input:

100000
40714 109287
16707 133294
81527 168474
67645 182356
32452 117549
84613 165388
29183 120818
29168 120833
53152 196849
42442 107559
42607 107394
52755 197246
43029 106972
30277 119724
46656 103345
87020 162981
80484 169517
99974 150027
15064 134937
33183 116818
63876 186125
42661 107340
15460 1...

output:

2

result:

ok single line: '2'

Test #73:

score: 56
Accepted
time: 9ms
memory: 12044kb

input:

99999
29979 103354
4962 128371
72715 160617
8493 124840
94686 138646
64318 169014
7654 125679
99028 134304
10709 122624
13003 120330
77354 155978
44137 189195
89258 144074
55047 178285
67855 165477
32451 100882
26110 107223
81577 151755
73004 160328
21329 112004
25564 107769
64393 168939
66746 16658...

output:

2

result:

ok single line: '2'

Test #74:

score: 56
Accepted
time: 11ms
memory: 17972kb

input:

99998
42854 190475
31483 101848
46290 187039
24915 108416
79685 153644
26437 106894
63455 169874
84895 148434
23761 109570
27967 105364
92787 140542
87662 145667
25193 108138
22311 111020
43599 189730
6078 127253
82422 150907
80996 152333
40987 192342
27182 106149
60313 173016
29797 103534
32822 100...

output:

2

result:

ok single line: '2'

Test #75:

score: 56
Accepted
time: 10ms
memory: 13212kb

input:

99997
80960 80963
148028 148031
80866 80869
191346 191349
50150 50153
144290 144293
81494 81497
137044 137047
92988 92991
30272 30275
73256 73259
44142 44145
115664 115667
169142 169145
74354 74357
3550 3553
131642 131645
156584 156587
72356 72359
6876 6879
164760 164763
81610 81613
40402 40405
1171...

output:

2

result:

ok single line: '2'

Test #76:

score: 56
Accepted
time: 7ms
memory: 16592kb

input:

100000
98323 98326
28801 28804
166979 166982
36123 36126
175025 175028
12953 12956
175167 175170
47681 47684
20327 20330
130765 130768
127505 127508
183039 183042
173779 173782
113483 113486
16969 16972
65217 65220
100493 100496
58579 58582
160755 160758
59781 59784
12949 12952
52325 52328
134055 13...

output:

2

result:

ok single line: '2'

Test #77:

score: 56
Accepted
time: 9ms
memory: 16404kb

input:

99999
36747 36750
142675 142678
115787 115790
114017 114020
195063 195066
45621 45624
26549 26552
100587 100590
134407 134410
18281 18284
57557 57560
10715 10718
52861 52864
142521 142524
64207 64210
129317 129320
81913 81916
81903 81906
102023 102026
120313 120316
152033 152036
63751 63754
23103 23...

output:

0

result:

ok single line: '0'

Test #78:

score: 56
Accepted
time: 11ms
memory: 16728kb

input:

99998
51183 149304
45261 154171
127517 127518
32921 167006
142173 142176
94933 94935
19118 181380
9160 191294
67928 67936
29838 170108
38474 161502
17904 182644
8151 192271
109895 109897
64688 136315
91236 91237
139907 139908
111634 111645
24444 24448
40361 159605
59006 140400
20962 178978
63293 137...

output:

842865912

result:

ok single line: '842865912'

Test #79:

score: 56
Accepted
time: 15ms
memory: 17020kb

input:

99997
132761 132777
47707 151726
126229 126237
72241 127645
150998 151001
38878 38880
5040 195055
6069 193806
119534 119535
49156 49172
17148 17150
106130 106133
54133 54135
49034 151345
107110 107118
24432 175341
119744 119746
9199 190812
72629 72632
67821 67841
58037 142158
40778 159265
455 199380...

output:

200843978

result:

ok single line: '200843978'

Subtask #4:

score: 22
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #80:

score: 22
Accepted
time: 242ms
memory: 53988kb

input:

999999
1435228 1435230
138727 1861009
298868 1700404
439049 1560556
306587 1692594
85178 1915055
157123 1842638
1140923 1140924
137990 1861941
702503 1296996
225991 1773465
297461 1701827
1679918 1679920
94632 1905610
854087 1144434
1121914 1121915
415983 1583806
282153 1717332
1079206 1079248
58731...

output:

244758790

result:

ok single line: '244758790'

Test #81:

score: 22
Accepted
time: 213ms
memory: 53720kb

input:

999998
103456 1896840
617764 617774
222046 1778038
177206 1822356
1217262 1217269
689704 1309249
69802 1930485
1219123 1219133
893799 893801
588889 1412233
807575 807598
137887 1861937
224808 1774627
103064 1897268
583587 1418620
1435347 1435373
1072007 1072016
375399 375401
1504598 1504599
498124 1...

output:

807779031

result:

ok single line: '807779031'

Test #82:

score: 22
Accepted
time: 234ms
memory: 54044kb

input:

999997
975129 975345
653711 1344137
112162 1887729
326553 1672581
671927 1325699
1059772 1059856
153932 1846019
342205 342206
968338 968340
809908 809909
356235 1642644
517762 517766
23857 1976061
1067164 1067167
481614 1515786
476678 476679
91943 1907894
947343 947380
1066928 1066960
1619136 161913...

output:

971903235

result:

ok single line: '971903235'

Test #83:

score: 22
Accepted
time: 206ms
memory: 53864kb

input:

1000000
693587 693591
663369 663370
320902 320905
514800 1485738
874806 874808
94424 1905797
1073757 1073758
56318 1944025
620469 1381784
36446 1963767
83868 1916029
336219 1664466
978670 978679
1062486 1062849
1085361 1085363
1713936 1713942
463564 1537363
818580 818590
1003538 1003540
241522 17583...

output:

745389121

result:

ok single line: '745389121'

Test #84:

score: 22
Accepted
time: 215ms
memory: 53800kb

input:

999999
582524 582525
1570445 1570449
156976 1843132
22755 1977101
1224904 1224905
905341 905343
1027405 1027411
269955 269962
683984 1311130
442482 442485
939545 939546
1413019 1413028
1073512 1073513
144368 1855613
445778 1553983
1297383 1297410
1202656 1202660
203579 1796348
56134 1944197
928990 9...

output:

128214089

result:

ok single line: '128214089'

Test #85:

score: 22
Accepted
time: 218ms
memory: 53580kb

input:

999998
1172766 1172793
504297 1495093
378070 1623099
1700724 1700727
37125 37127
1124519 1124520
308524 1692769
432379 1568467
451510 1549348
793882 1207266
504045 1495284
239590 1760647
576182 576186
720578 1282786
562452 1438297
134413 1865320
634680 1367285
375927 1625207
212481 212482
768662 768...

output:

0

result:

ok single line: '0'

Test #86:

score: 22
Accepted
time: 198ms
memory: 53612kb

input:

999997
834717 1167380
1026011 1026041
241634 1759470
1172062 1172070
324419 1675269
779975 779978
278890 278894
641695 1357298
1009093 1009149
718146 1281208
802522 802524
496371 496383
1349503 1349552
1795493 1795495
67318 1932897
1294881 1294882
1033100 1033101
1011838 1011840
363623 1636870
15397...

output:

0

result:

ok single line: '0'

Test #87:

score: 22
Accepted
time: 185ms
memory: 50208kb

input:

1000000
405525 405526
620793 620794
450657 450658
1403101 1403102
540703 540704
855971 855972
1112817 1112818
1847661 1847662
1042189 1042190
1980943 1980944
661981 661982
1189711 1189712
569947 569948
130605 130606
628059 628060
1300413 1300414
888189 888190
1539507 1539508
955823 955824
469561 469...

output:

235042059

result:

ok single line: '235042059'

Test #88:

score: 22
Accepted
time: 133ms
memory: 45656kb

input:

999999
306341 1693658
845859 1154140
458389 1541610
663724 1336275
50794 1949205
444255 1555744
466742 1533257
524790 1475209
207385 1792614
124087 1875912
816328 1183671
500878 1499121
300428 1699571
434523 1565476
144183 1855816
401383 1598616
994827 1005172
266286 1733713
332517 1667482
623351 13...

output:

617521033

result:

ok single line: '617521033'

Test #89:

score: 22
Accepted
time: 128ms
memory: 45812kb

input:

999998
462623 1462621
968600 1968598
303596 1303594
369677 1369675
89006 1089004
792968 1792966
471752 1471750
734695 1734693
121824 1121822
417031 1417029
251884 1251882
288327 1288325
179051 1179049
831779 1831777
999841 1999839
720104 1720102
860367 1860365
493390 1493388
266586 1266584
571629 15...

output:

0

result:

ok single line: '0'

Test #90:

score: 22
Accepted
time: 127ms
memory: 51876kb

input:

999997
52242 552240
246451 746449
1455781 1955780
81707 581705
274142 774140
1452335 1952334
1481386 1981385
1336221 1836220
1038322 1538321
221080 721078
491313 991311
1476070 1976069
1247786 1747785
1376827 1876826
1111112 1611111
1426354 1926353
462900 962898
260768 760766
293299 793297
40229 540...

output:

0

result:

ok single line: '0'

Test #91:

score: 22
Accepted
time: 156ms
memory: 51872kb

input:

1000000
92676 592676
30272 530272
359612 859612
1407576 1907576
1324666 1824666
99247 599247
1369677 1869677
1489001 1989001
205945 705945
1174075 1674075
174417 674417
1263517 1763517
1090548 1590548
1468415 1968415
1046865 1546865
1218340 1718340
218895 718895
1156256 1656256
186063 686063
1484380...

output:

0

result:

ok single line: '0'

Test #92:

score: 22
Accepted
time: 177ms
memory: 50148kb

input:

999998
475386 475388
1466366 1466368
1257842 1257844
44250 44252
224305 224307
1461109 1461111
1393914 1393916
765317 765319
1291358 1291360
1844470 1844472
1915842 1915844
363802 363804
1800965 1800967
1941450 1941452
1856953 1856955
356925 356927
634358 634360
718849 718851
681689 681691
583905 58...

output:

483815611

result:

ok single line: '483815611'

Test #93:

score: 22
Accepted
time: 172ms
memory: 50428kb

input:

999998
1205345 1205348
1905298 1905299
1518865 1518868
1914090 1914091
965762 965763
352030 352031
438198 438199
760749 760752
663130 663131
1429361 1429364
1298322 1298323
1289397 1289400
154889 154892
272637 272640
1065533 1065536
1196046 1196047
992906 992907
489645 489648
1443061 1443064
1133706...

output:

808760520

result:

ok single line: '808760520'

Test #94:

score: 22
Accepted
time: 196ms
memory: 53240kb

input:

999997
102115 102116
1018283 1018284
1675779 1675780
665394 1334526
868598 868601
1154489 1154493
1202549 1202551
456217 1543722
704139 704145
498639 498640
60592 1939295
595784 1404185
1633835 1633842
234521 1766193
286500 286506
1475990 1475992
1690833 1690834
642559 1358152
328341 328342
100810 1...

output:

916583126

result:

ok single line: '916583126'

Test #95:

score: 22
Accepted
time: 207ms
memory: 53196kb

input:

1000000
287057 287058
1064611 1064612
550193 1449815
680552 680555
806427 1194435
754798 754800
297796 1702767
437892 1564457
616299 616300
11088 11103
760288 760312
1207132 1207133
525382 1474054
1519004 1519010
876419 876464
251104 251105
1727720 1727757
857472 1145319
1968405 1968407
573879 57389...

output:

852311546

result:

ok single line: '852311546'

Test #96:

score: 22
Accepted
time: 214ms
memory: 53120kb

input:

999999
1950410 1950412
178552 1834059
660649 1358048
1714167 1714719
666754 1353680
181657 1832737
766636 1252476
1694848 1694851
181401 181404
1297053 1297058
583438 583493
1473441 1473444
79290 1924384
1273772 1273773
1495504 1495505
1722617 1722690
630412 630527
477104 477107
786341 1228634
91113...

output:

790474394

result:

ok single line: '790474394'

Test #97:

score: 22
Accepted
time: 184ms
memory: 53412kb

input:

999998
1639916 1639917
276728 1722827
1141174 1141176
582222 582224
625617 1374580
693582 1306376
968740 968745
641534 1358452
1350459 1350460
181118 1819329
793207 793211
1296458 1296463
429996 1571878
1790060 1790063
1650059 1650064
354882 1645233
443446 443448
655946 655952
1657149 1657151
928258...

output:

0

result:

ok single line: '0'

Test #98:

score: 22
Accepted
time: 181ms
memory: 53140kb

input:

999997
164809 164815
1556669 1556704
234997 234998
1333238 1333295
1216258 1216262
453586 1551639
395034 1611609
726112 726114
1842597 1842598
1658259 1658261
813774 1187332
1622348 1622349
846963 1154752
564827 1437088
547512 547513
1905342 1905399
261213 261215
71867 1931394
1069109 1069111
489722...

output:

0

result:

ok single line: '0'

Test #99:

score: 22
Accepted
time: 204ms
memory: 53516kb

input:

1000000
1315037 1315039
7614 1992171
425875 1571118
415472 415475
1473401 1473438
905629 1114035
1225341 1225770
139887 1866276
381285 1616480
1817134 1817136
1436940 1436942
875228 1142369
246726 1757481
789819 789820
1477039 1477041
1732887 1733369
636544 636546
883768 884229
504642 504648
613503 ...

output:

0

result:

ok single line: '0'

Test #100:

score: 22
Accepted
time: 235ms
memory: 51868kb

input:

999999
732304 1966456
1274687 1549816
273179 541908
522014 1557912
1154408 1673865
1307037 1831076
711915 1772896
1246040 1967677
930825 1684477
464531 1342282
855006 1869572
1417302 1849522
938978 1549340
371672 1010098
491273 1355610
450336 655974
999262 1985141
1437207 1618767
784803 1901931
5055...

output:

0

result:

ok single line: '0'

Test #101:

score: 22
Accepted
time: 232ms
memory: 51732kb

input:

999998
113586 775994
279487 1262790
1030410 1987616
354159 979368
1054214 1606399
477059 780899
119558 614097
381083 1156857
1126817 1619088
1086034 1631544
298728 1490267
80294 712538
949422 1952438
710976 1810658
160808 693578
273896 1170642
690083 1618544
1466656 1795499
206488 1066538
724678 176...

output:

0

result:

ok single line: '0'

Test #102:

score: 22
Accepted
time: 170ms
memory: 57704kb

input:

999997
94700 1311100
941863 1779083
1240660 1629387
1442674 1528458
1000105 1749790
1071557 1714025
67075 1366265
1343695 1577908
154432 1191444
16913 1466380
951278 1774377
132588 1235370
23867 1452420
406876 686913
1007507 1746026
785796 1856982
368348 763613
43377 1413549
79402 1341669
664129 191...

output:

16

result:

ok single line: '16'

Test #103:

score: 22
Accepted
time: 179ms
memory: 57560kb

input:

1000000
492628 514842
245511 1008489
282189 934986
1320133 1589738
46292 1407702
1186584 1656752
932237 1784205
1145404 1677425
514552 1992683
846012 1827559
931691 1784487
517510 1991235
191256 1116944
37222 1425913
996892 1751732
1324952 1587318
194943 1109523
380794 737988
619916 1940156
1025075 ...

output:

16

result:

ok single line: '16'

Test #104:

score: 22
Accepted
time: 184ms
memory: 63388kb

input:

999999
242675 605096
1188877 1429398
271862 516940
110397 1002986
870439 1641555
512118 1881089
979451 1568879
165417 838198
207229 712122
991108 1561105
248780 586523
659752 1782377
841361 1660937
563964 1846433
1249544 1389205
202305 727050
210068 703472
1048894 1522561
228598 647499
756678 171750...

output:

4

result:

ok single line: '4'

Test #105:

score: 22
Accepted
time: 181ms
memory: 63640kb

input:

999998
584371 1832584
796660 1690789
168833 827954
803161 1686454
531852 1867468
876925 1637293
751994 1720663
264706 539596
256174 565003
501830 1887547
514316 1879200
260497 552001
913467 1612856
186364 774880
490444 1895123
1196208 1424661
909340 1615624
416463 1944460
888370 1629658
69991 112382...

output:

2

result:

ok single line: '2'

Test #106:

score: 22
Accepted
time: 143ms
memory: 51660kb

input:

999997
606160 1893833
179476 1320520
775659 1724334
806786 1693207
685854 1814139
236390 1263606
990401 1509592
117414 1382582
340492 1159504
178442 1321554
134158 1365838
17409 1482587
776322 1723671
910236 1589757
848717 1651276
510955 1989038
362606 1137390
833750 1666243
99688 1400308
834974 166...

output:

2

result:

ok single line: '2'

Test #107:

score: 22
Accepted
time: 137ms
memory: 51988kb

input:

1000000
628530 1871471
886483 1613518
603468 1896533
403844 1096157
741248 1758753
708027 1791974
643344 1856657
551451 1948550
805137 1694864
96264 1403737
325746 1174255
82911 1417090
385393 1114608
575588 1924413
347324 1152677
228044 1271957
481146 1018855
206176 1293825
922859 1577142
436242 10...

output:

2

result:

ok single line: '2'

Test #108:

score: 22
Accepted
time: 137ms
memory: 55660kb

input:

999999
779042 1554290
532260 1801072
158175 1175158
809985 1523347
407218 1926114
519989 1813343
162079 1171254
983769 1349563
926014 1407318
25503 1307830
886726 1446606
763133 1570199
341923 1991409
705446 1627886
177956 1155377
553683 1779649
558433 1774899
714181 1619151
246682 1086651
502074 18...

output:

2

result:

ok single line: '2'

Test #109:

score: 22
Accepted
time: 144ms
memory: 55712kb

input:

999998
447299 1886030
738794 1594535
926220 1407109
420784 1912545
405638 1927691
940915 1392414
44901 1288430
841251 1492078
742181 1591148
802686 1530643
738497 1594832
378110 1955219
791336 1541993
577358 1755971
251830 1081501
738824 1594505
712074 1621255
129174 1204157
669170 1664159
653069 16...

output:

2

result:

ok single line: '2'

Test #110:

score: 22
Accepted
time: 192ms
memory: 50228kb

input:

999997
1959372 1959375
647808 647811
1657836 1657839
613158 613161
20762 20765
313498 313501
1491810 1491813
1333880 1333883
940842 940845
914946 914949
1060664 1060667
750850 750853
1730288 1730291
843712 843715
655294 655297
241778 241781
1991280 1991283
975730 975733
1266728 1266731
1043422 10434...

output:

2

result:

ok single line: '2'

Test #111:

score: 22
Accepted
time: 180ms
memory: 50136kb

input:

1000000
164611 164614
1127511 1127514
778839 778842
1016863 1016866
146745 146748
202383 202386
946929 946932
1782511 1782514
1656475 1656478
169751 169754
1171307 1171310
1302673 1302676
82439 82442
375043 375046
1459721 1459724
1438413 1438416
3301 3304
946967 946970
927235 927238
924695 924698
24...

output:

2

result:

ok single line: '2'

Test #112:

score: 22
Accepted
time: 152ms
memory: 50292kb

input:

999999
506771 506774
1258367 1258370
204061 204064
1773189 1773192
434353 434356
513165 513168
1029299 1029302
643421 643424
1764041 1764044
1160575 1160578
1830247 1830250
918477 918480
1134635 1134638
1144479 1144482
230467 230470
93131 93134
1187525 1187528
880571 880574
429129 429132
1493785 149...

output:

0

result:

ok single line: '0'

Test #113:

score: 22
Accepted
time: 199ms
memory: 53724kb

input:

999998
350066 1649742
276393 1723063
25821 1974272
474064 1526024
1217098 1217100
799839 799840
1796103 1796105
802665 802668
337454 337455
1014824 1014826
850384 850392
294893 294894
870171 870172
168373 1831432
778575 778591
118100 1881787
284998 1714404
299484 1700111
118311 1881539
881241 881246...

output:

35373248

result:

ok single line: '35373248'

Test #114:

score: 22
Accepted
time: 197ms
memory: 53756kb

input:

999997
321213 1677411
1279412 1279414
92433 1907370
814628 1186750
385050 1614594
589903 1410827
876742 1125379
168151 1831317
401536 1597642
1588917 1588929
944573 1063384
191058 1808185
126924 1873300
262440 262441
286415 1712819
377526 1622301
853406 853409
759351 759352
548744 1450198
794416 794...

output:

653485452

result:

ok single line: '653485452'

Extra Test:

score: 0
Extra Test Passed