QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#345567#436. Swapping CitiesdXqwq 100 ✓150ms36888kbC++232.9kb2024-03-07 08:41:332024-03-07 08:41:34

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Accepted

Test #1:

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

input:

2 1
0 1 7
1
0 1

output:

-1

result:

ok single line: '-1'

Test #2:

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

input:

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

output:

-1
-1
-1
-1

result:

ok 4 lines

Subtask #2:

score: 0
Accepted

Test #3:

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

input:

3 2
0 1 17
1 2 31
4
0 1
1 2
0 2
0 1

output:

-1
-1
-1
-1

result:

ok 4 lines

Test #4:

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

input:

426 425
74 387 165028002
8 337 155529101
227 345 277759901
139 284 740908724
65 125 381574397
89 111 858774291
256 387 456002547
21 164 100351326
76 377 258587931
8 352 219972937
215 351 309665535
59 162 29065104
92 177 947801881
11 228 563277033
13 250 859399827
83 388 70119858
286 385 138362982
11...

output:

-1
-1
-1
-1
-1

result:

ok 5 lines

Test #5:

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

input:

940 939
511 518 907477290
280 435 753595481
166 793 705771587
502 811 858848972
137 363 693147906
22 461 261889706
523 529 648163630
850 905 931057145
26 587 880463683
374 505 445737348
102 880 645616452
449 929 596933552
358 725 479475905
108 876 999521604
54 305 35534096
701 749 247574033
57 699 4...

output:

-1
-1
-1
-1

result:

ok 4 lines

Test #6:

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

input:

902 901
148 836 95323898
69 468 394828416
2 605 403594794
348 783 12232128
97 730 258293852
54 169 197639039
320 491 430202623
224 604 62466434
511 697 165644006
387 778 741699272
727 869 164423942
499 515 709527050
209 309 227371699
24 86 798125497
338 346 653947210
74 797 435546073
82 813 94641802...

output:

-1
-1
-1
-1
-1

result:

ok 5 lines

Test #7:

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

input:

1000 999
206 351 803105863
66 149 976411094
121 505 993072899
666 954 552376721
704 896 139897619
79 840 82840878
530 988 573596822
70 615 124427089
296 993 727141237
126 955 777433286
102 795 506306515
592 982 90303669
543 829 934742567
283 524 247471800
553 961 682974436
307 842 589053801
311 515 ...

output:

-1
-1
-1
-1
-1

result:

ok 5 lines

Test #8:

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

input:

1000 999
359 989 151331871
38 342 619144699
1 872 102698326
357 826 937044049
36 928 144768423
568 853 611621
389 759 7615437
529 859 404102822
51 900 302485057
132 496 105011164
115 315 789353050
767 970 982141985
342 749 617748970
626 941 132358243
213 623 468891625
679 688 939357663
517 667 83695...

output:

-1
-1
-1
-1
-1

result:

ok 5 lines

Subtask #3:

score: 0
Accepted

Test #9:

score: 0
Accepted
time: 39ms
memory: 25600kb

input:

78487 78486
21940 24079 593765451
9058 50840 275027221
12096 22343 27089177
43977 52298 190799385
5430 49666 122910535
1966 50992 106732940
22047 65169 949810064
27980 65052 751605553
15372 20060 848481254
38243 77115 484610983
61070 66606 631024623
6943 50841 979259732
42129 51057 828673666
50591 6...

output:

-1
-1

result:

ok 2 lines

Test #10:

score: 0
Accepted
time: 39ms
memory: 28496kb

input:

96023 96022
19702 88316 579159904
66251 78740 729561482
18087 73596 208294663
82262 85647 221459599
42985 78914 826431511
6958 24948 679830131
36113 59948 710065147
8606 28938 280260604
8700 68266 885793392
56967 63904 628761465
55551 67423 805584246
1649 84401 850551679
5381 54438 80105723
42404 58...

output:

-1
-1
-1
-1

result:

ok 4 lines

Test #11:

score: 0
Accepted
time: 42ms
memory: 29236kb

input:

94390 94389
30759 78874 260511432
32332 37486 357142720
2476 65406 85554239
22513 54826 154345412
75910 92950 293447761
1045 6902 171310629
37843 68645 481562167
5962 82728 514312910
68424 75700 235487237
34460 92425 904938765
40422 69203 752197065
49242 81666 627537368
12647 60403 448553665
29760 9...

output:

-1
-1
-1
-1
-1

result:

ok 5 lines

Test #12:

score: 0
Accepted
time: 35ms
memory: 29160kb

input:

100000 99999
32750 44818 935666143
59319 70437 913101880
40297 49608 186090343
15409 45927 663059141
25490 83258 880651241
17457 87150 672872806
35908 62950 341845577
33235 61529 107026769
27590 46439 646957247
38041 68424 589310043
30933 67776 80653788
16025 70058 320974866
55740 61285 686799872
59...

output:

-1
-1
-1
-1
-1

result:

ok 5 lines

Test #13:

score: 0
Accepted
time: 43ms
memory: 32708kb

input:

100000 99999
79248 90273 423907558
61956 83803 61011423
40559 92959 385499067
32791 88747 907598303
87245 90381 289667016
24890 60046 15888426
10357 11099 759462385
79662 93616 789035624
27309 49087 112264645
28091 62677 884408065
78628 90064 810881455
19160 39155 245257825
57689 60112 459861222
424...

output:

-1
-1
-1
-1
-1

result:

ok 5 lines

Subtask #4:

score: 0
Accepted

Test #14:

score: 0
Accepted
time: 40ms
memory: 27520kb

input:

78254 78253
9775 28301 780798184
24132 40634 94556968
10169 55532 346574336
2603 65541 873326115
22699 58466 669409812
16474 42626 302001067
15127 56693 625109610
64811 67816 578907024
46689 60091 972201244
27305 39328 642009505
12305 64823 890024771
14652 41221 804727810
14493 38064 692491627
39467...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 18751 lines

Test #15:

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

input:

96758 96757
14888 27751 298852321
89268 92829 732135716
6976 52584 950720695
39557 87407 221604055
45613 83519 959059437
68064 78107 139991226
79003 85866 961281060
13482 65592 26109878
11403 87153 338173135
8316 45128 595382077
15184 72128 403716475
51227 82283 739040516
28913 43439 428212124
43990...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 198684 lines

Test #16:

score: 0
Accepted
time: 83ms
memory: 30736kb

input:

94023 94022
29767 63409 753451035
21079 25205 515048517
60301 84965 406419998
11035 62763 811768247
40298 41377 682769793
52924 87921 238187574
49863 86209 411629079
20568 60553 331967676
65280 75322 212136210
53652 84686 913829880
41905 46173 287937015
51164 84647 976216763
32839 73004 541955268
44...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 198886 lines

Test #17:

score: 0
Accepted
time: 104ms
memory: 31044kb

input:

100000 99999
11635 34762 586285090
10883 44932 647804815
73514 93683 814494884
32592 82240 301846699
1486 99741 673157887
27468 49045 678934837
11037 48027 205692239
35964 46928 679353905
50500 90687 445111243
44556 73960 133940533
18502 82605 898941569
62866 72818 413138303
55732 67039 818411115
72...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 200000 lines

Test #18:

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

input:

100000 99999
29676 59688 581756847
48647 54673 777472967
37082 68894 561896330
22408 54047 33529020
48474 53166 99295669
7916 58178 689903888
6016 32855 962202676
28623 59526 53864414
80568 94019 232103116
33772 67803 86748897
20763 32129 780903804
33218 41122 324846696
19160 62873 472288346
21906 3...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 200000 lines

Subtask #5:

score: 0
Accepted

Test #19:

score: 0
Accepted
time: 120ms
memory: 36012kb

input:

94623 94622
0 75305 622253738
0 54796 462724128
0 75886 137979635
0 66452 665511713
0 64781 420871714
0 2628 102391513
0 74571 844600388
0 76649 57731825
0 36212 950028495
0 47294 149834685
0 28114 545648033
0 56460 673370408
0 66350 337337539
0 18222 283237145
0 72426 916482721
0 57766 119923766
0 ...

output:

860148668
999773640
548578490
665594696
855392447
897265657
892048171
845668166
355156446
277230669
913611642
453737557
492253954
853354202
989302450
974664128
857227765
280875614
845329631
943817066
884159669
715125377
852337346
939409087
937559913
551196227
555263380
881942828
583059294
196822146
...

result:

ok 189713 lines

Test #20:

score: 0
Accepted
time: 119ms
memory: 36048kb

input:

99876 99875
0 63925 519664858
0 71753 237050797
0 56455 597523840
0 27029 502617705
0 18078 778341322
0 69066 277678252
0 90406 208621806
0 82349 826261179
0 52133 265588597
0 81895 379904475
0 77228 586157288
0 30142 881076411
0 27664 133716516
0 74958 219150788
0 85019 482096123
0 17226 917257265
...

output:

822141091
732148441
724235039
490546941
730861460
911300320
199035777
782595688
696940102
352188832
532526960
637520126
934784613
765692308
888375100
860059990
615063887
454116633
364451161
478520196
358664221
781688976
978127974
376434152
810850577
401916651
403320403
62164991
532123501
609020214
5...

result:

ok 183693 lines

Test #21:

score: 0
Accepted
time: 132ms
memory: 36500kb

input:

96072 96071
0 2033 760023131
0 20186 370011831
0 70926 511278270
0 16200 126762343
0 16601 91374355
0 88427 192629622
0 50181 394348165
0 40044 608456254
0 85965 610396322
0 30763 254247890
0 62749 616732555
0 5921 170388025
0 22732 721101843
0 84506 897651992
0 70924 686095017
0 34467 307659540
0 4...

output:

710168381
895261086
174431123
579550817
593025919
679429031
335524998
394784564
899783614
647532731
741542464
164865389
465430090
329867908
982983584
516091147
618905935
846600098
967328018
243244490
297366362
899930681
680193014
496834373
480855506
683540506
597841204
508413320
832000629
525768324
...

result:

ok 199808 lines

Test #22:

score: 0
Accepted
time: 112ms
memory: 36288kb

input:

99445 99444
0 14396 850009868
0 3610 337898330
0 76094 13231633
0 38421 93318123
0 2690 901360051
0 88516 914628867
0 82669 536509629
0 51064 59588844
0 47370 917860515
0 30322 257475313
0 36871 556061492
0 26184 919310545
0 29271 697930873
0 27998 842458954
0 14019 380130658
0 7813 40990690
0 11057...

output:

916746095
26803357
922453660
851739785
342330663
710056831
897422628
993062347
465961486
170804951
325101588
304487333
996190830
781583625
897740640
981244019
377570512
863919393
977933127
956095664
789536953
959613545
754606058
926325352
187054197
501272363
79559867
427253261
618996062
982292779
69...

result:

ok 181268 lines

Test #23:

score: 0
Accepted
time: 124ms
memory: 36888kb

input:

97774 97773
0 56253 840747258
0 71966 678955381
0 33810 447228512
0 17294 159424128
0 66764 24633692
0 82564 218457238
0 10549 461088634
0 55410 704575865
0 2370 803465971
0 74834 836194920
0 42722 118031152
0 34338 861117070
0 79161 198389860
0 48080 629379468
0 39098 91638858
0 91826 668501852
0 6...

output:

884633671
976846439
860832140
670458186
450547049
614432058
843206067
670371318
858195681
662361129
544855220
808328568
459126936
609938960
429203648
797830763
707150518
949202289
400756125
479665577
510476226
592971649
999354994
277741914
910069356
110371676
902709815
994281423
912825732
956898085
...

result:

ok 195277 lines

Test #24:

score: 0
Accepted
time: 138ms
memory: 34680kb

input:

93667 93666
0 80289 930319366
0 14598 441299129
0 84872 963373563
0 40974 703716236
0 17075 174749323
0 40581 43656467
0 61214 337000810
0 14532 641280905
0 88038 452560587
0 9829 143005011
0 58302 823041726
0 25531 212288089
0 7498 519690559
0 87799 407744788
0 2206 732106586
0 25726 707561334
0 82...

output:

609779518
948970353
672065083
694918949
620380332
82523833
555923849
672938068
871275978
607282110
661718183
155652487
973871730
699155950
983799562
487255964
821004897
347612625
798292684
905346252
955335446
919810314
519937238
613459914
719405938
713535303
458943606
856429236
691407392
881822608
7...

result:

ok 192584 lines

Test #25:

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

input:

97313 97312
0 61485 341629498
0 80082 522871429
0 41026 141057825
0 20847 38342470
0 72859 41561114
0 4846 871601039
0 4542 563801329
0 39471 781045551
0 1367 796828061
0 47971 50074701
0 81220 748646876
0 37438 761559894
0 38123 557988291
0 48605 222067256
0 79887 26250594
0 80917 830228373
0 15717...

output:

814360876
853882087
752177181
886665129
382346943
777968307
578807265
540247448
671717221
484351817
443757749
619732197
569107180
526624404
815431219
364521202
216891169
596849458
858962955
670294331
792320695
354003362
837531383
538770612
496556706
995352779
483393207
767173929
402779664
563814522
...

result:

ok 189265 lines

Test #26:

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

input:

92658 92657
0 5718 165767877
0 43248 710386845
0 14490 582892757
0 79329 247807842
0 20050 329449458
0 34175 374322780
0 23275 278768310
0 70692 25591250
0 1342 755091496
0 2866 963391556
0 53755 799007672
0 62313 741642147
0 34291 391989307
0 45320 355988767
0 28383 861586485
0 9662 709929118
0 255...

output:

767500750
902012736
988174516
325360726
855367698
977202930
713922136
882674400
969469023
812913796
304791719
762244303
584160065
803540472
954408245
888733223
319161798
850309861
698381627
420519155
173031117
665796550
207946418
141442535
225626347
768319987
842156642
917669995
765041853
780596287
...

result:

ok 194390 lines

Subtask #6:

score: 0
Accepted

Test #27:

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

input:

990 989
47 838 302271558
273 492 664559881
148 815 976564144
331 495 44254198
669 820 218690102
188 882 677033947
643 698 971006957
488 729 679293846
256 281 332371780
127 771 383138407
134 679 846068552
596 599 203286566
613 941 328910657
432 852 151755209
145 463 456917162
0 71 752175798
152 789 8...

output:

846613094
995525905
947339716
995525905

result:

ok 4 lines

Test #28:

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

input:

1000 999
332 978 38643
270 822 414812
191 244 839293
471 472 565992
388 811 107425
637 668 520931
309 320 47372
759 874 312399
48 855 109308
386 477 602447
700 792 278238
413 771 471610
424 830 952399
330 546 389404
18 866 844033
14 489 4041
605 824 890435
272 841 131823
664 807 314
284 958 969493
2...

output:

997594
998827
999196
997594
998827

result:

ok 5 lines

Test #29:

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

input:

981 980
963 975 483737
113 153 529685
129 559 695679
713 908 672783
361 706 141743
327 649 706633
108 897 711248
213 407 342457
135 382 828112
375 699 834336
594 613 132176
162 663 236883
80 476 167651
457 727 667474
415 741 541169
659 732 430616
103 864 656662
363 400 11231
481 954 725941
159 710 2...

output:

997226
999070
994702
982698
999070

result:

ok 5 lines

Test #30:

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

input:

817 816
87 509 741630
216 489 213644
158 302 431089
71 290 450781
323 560 850397
777 794 751806
271 475 516216
558 633 280590
239 423 468626
12 388 414739
355 730 670794
282 585 336515
120 533 277141
110 614 792780
557 739 800300
100 812 586969
501 577 941008
93 439 559833
783 811 340607
2 163 86419...

output:

952205
992396
992396
999282
992396

result:

ok 5 lines

Test #31:

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

input:

857 856
276 561 38655155
820 829 526056559
734 847 211930452
614 829 612790249
325 405 384059271
397 504 243668139
196 630 311546888
151 588 206706644
155 520 736108987
10 579 581563397
74 719 451103219
147 244 429549301
92 706 257126213
652 731 268443074
20 772 325881166
592 629 387058223
14 134 34...

output:

994809644
994809644
989993629
989993629
989993629

result:

ok 5 lines

Test #32:

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

input:

1000 999
737 904 96937802
45 836 276503860
119 745 224660022
581 996 304581011
478 561 497422926
40 708 419817389
226 706 487479233
726 877 194091923
440 699 178116420
473 558 247699866
191 719 328685655
221 323 40995394
692 781 306243979
261 348 188832515
239 572 305004110
513 586 266157624
481 841...

output:

505252332
505252332
979077789
979077789
572457025

result:

ok 5 lines

Test #33:

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

input:

1000 999
376 806 151987
76 905 989983
649 735 297937
23 989 757625
607 828 481911
427 562 103696
183 187 431381
266 884 896601
302 378 171364
231 591 869903
438 890 451735
371 620 257098
93 514 921743
145 727 743865
322 360 704882
150 522 681468
668 926 157533
277 534 888342
25 932 268908
388 812 76...

output:

998922
998922
998922
998922
998922

result:

ok 5 lines

Test #34:

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

input:

1000 999
581 671 846415
101 864 518019
875 907 163536
12 757 574390
372 769 629257
24 814 203495
43 361 355385
87 500 199135
252 481 699845
345 891 147717
347 956 944565
440 796 967301
34 464 941468
90 652 642948
31 181 623116
294 685 993463
223 819 916111
908 917 803159
30 63 683357
64 394 900258
7...

output:

591837
980041
999726
941468
999726

result:

ok 5 lines

Test #35:

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

input:

1000 999
197 858 151336150
119 407 550960751
634 815 199483577
421 944 42854277
55 498 994086225
466 848 400450816
753 943 625577825
2 54 732607322
462 549 861297358
960 993 484644210
523 865 559867434
778 803 52014960
540 950 467805640
237 686 279926595
390 498 701734623
124 769 225719337
34 846 57...

output:

989414310
999918757
989414310
998989186
998989186

result:

ok 5 lines

Subtask #7:

score: 0
Accepted

Test #36:

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

input:

13604 13603
8356 8403 796466173
5628 8429 906962701
3920 11930 959959178
6663 6830 290048491
915 9376 663274411
8722 13162 195512431
2211 6043 263205971
8174 13268 998861827
10074 10858 784154000
8290 11604 141391920
20 7972 249696621
3338 4649 65522585
3608 11223 132978393
2265 5109 973339144
5136 ...

output:

997836405

result:

ok single line: '997836405'

Test #37:

score: 0
Accepted
time: 29ms
memory: 31368kb

input:

100000 99999
72766 84339 677877
20096 78724 896100
90530 99950 32343
2857 55442 495578
14900 40515 160271
30452 92398 208453
29675 46437 508598
47301 82889 668226
21223 80779 792203
20053 25117 894758
16431 78184 926053
18924 55305 580347
17708 18109 508020
65458 87580 493142
16300 36707 900644
2442...

output:

999999
672500
487856
828364
411047

result:

ok 5 lines

Test #38:

score: 0
Accepted
time: 39ms
memory: 29544kb

input:

100000 99999
4105 51640 288236422
5726 69063 943108525
34157 52041 96453344
50329 93926 276349236
20942 97022 540113161
2254 30946 883917270
33655 45612 717063283
19795 73299 575491640
32783 86024 428863827
78859 96505 935448737
10718 47724 648554655
11352 48178 648334128
9833 91163 934723353
24973 ...

output:

997098770
999979569
992625782
999979569
994704608

result:

ok 5 lines

Test #39:

score: 0
Accepted
time: 38ms
memory: 29992kb

input:

99993 99992
36874 70494 330336
11504 59855 736947
45081 99040 729887
85652 88780 790182
10962 76201 500443
30120 47923 942292
13075 27664 914668
25284 31496 205626
46676 63194 330040
43718 95650 240235
65254 89981 444026
90878 91230 517612
60979 62347 431901
16519 95052 451824
44710 63630 687729
132...

output:

999999
999906
999999
999999
999999

result:

ok 5 lines

Test #40:

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

input:

99961 99960
50526 59873 994176
31429 34148 449934
32732 89874 870537
38703 54099 981817
9987 41431 215763
64332 82592 801124
29480 90533 50596
23332 34583 298456
52254 88555 683873
21635 63620 647524
65233 77116 413428
68335 87215 469006
69390 71968 345151
29499 32346 263872
46247 52498 264008
8761 ...

output:

999980
999622
999980
999973
999903

result:

ok 5 lines

Test #41:

score: 0
Accepted
time: 40ms
memory: 29604kb

input:

99848 99847
40481 89153 29870
33969 65854 255065
69052 99191 97845
63990 98565 449572
63089 84746 694252
20188 35274 183108
25709 55483 235812
38955 83121 246315
3948 9699 527988
67851 99151 112698
17485 38484 552992
74940 81997 598767
60176 64082 192321
44652 88734 689389
9035 18161 248131
69630 78...

output:

999860
999990
999919
999828
999997

result:

ok 5 lines

Test #42:

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

input:

98519 98518
514 85748 36258
51377 93980 768115
6995 28167 902107
39389 64780 625827
34510 82205 118218
27557 84804 398212
29855 60684 655987
87549 96846 159830
61483 84265 204318
12052 55722 696524
18197 75339 946298
20732 96092 920171
15377 56087 875006
47551 69607 618269
77472 96113 91269
65244 94...

output:

999867
999867
999779
999802
999867

result:

ok 5 lines

Test #43:

score: 0
Accepted
time: 43ms
memory: 28876kb

input:

98033 98032
7451 89942 875863
60432 80418 153064
50007 74392 514455
41950 57091 348135
45618 87782 974874
36961 78332 528024
49366 81377 982452
77182 88581 611601
7710 20667 156528
42116 60269 522797
11327 25534 520536
1399 2405 591814
80949 89649 919953
6633 45244 96580
38346 60197 517117
69167 821...

output:

999150
999982
985052
999982
994473

result:

ok 5 lines

Test #44:

score: 0
Accepted
time: 36ms
memory: 27736kb

input:

89847 89846
3097 67795 115479
54828 82419 867154
26550 69800 851420
28685 56906 221735
9110 69567 719731
44958 85703 845484
15731 78280 12051
1455 25714 307698
23746 67560 467662
50135 70767 955342
59765 77091 10964
9266 17147 335558
40102 62345 143265
37246 80663 818907
26871 69420 613272
45988 545...

output:

999699
999699
999699
999650
999699

result:

ok 5 lines

Test #45:

score: 0
Accepted
time: 41ms
memory: 29108kb

input:

100000 99999
30089 52826 338245868
55789 89113 48437756
14063 27847 349282559
46397 62935 317199369
7837 71727 376070441
52156 89194 348861078
41908 56966 412688522
10257 23465 342659164
35336 40908 373321690
65055 85318 149586594
42660 81292 123263284
33948 61678 487966549
42284 61367 91291577
4863...

output:

667857565
964775088
709371111
964775088
592748514

result:

ok 5 lines

Test #46:

score: 0
Accepted
time: 37ms
memory: 29308kb

input:

100000 99999
5011 39095 515368
43536 85169 454266
39422 53530 512799
1617 60922 432653
32650 60042 138824
78019 82575 950780
1668 71322 63510
60028 62875 480994
85458 85748 254150
73203 84535 846574
10264 30433 437043
13208 44248 171341
22148 25580 2869
10232 36243 301299
1906 93587 152477
14902 845...

output:

999997
999997
999997
999997
999997

result:

ok 5 lines

Subtask #8:

score: 0
Accepted

Test #47:

score: 0
Accepted
time: 8ms
memory: 11456kb

input:

12312 12311
2916 8085 175102149
1475 6850 309919528
6782 9694 260794553
2517 8281 584952046
4250 7806 662855436
412 9797 731092675
6802 9405 845105258
3077 10964 132387860
225 5421 28087274
1741 11558 107203447
4227 11940 313968264
4567 6286 246562765
8712 9079 851022380
6136 7008 430961650
3459 540...

output:

924041708
997007573
999543724
999543724
999543724
986867837
999543724
997881243
995634941
999543724
997881243
999543724
999543724
999543724
999543724
999543724
995634941
999543724
916268961
999543724
999543724
999543724
997617085
985021618
999543724
999543724
996107097
999543724
999543724
999543724
...

result:

ok 20276 lines

Test #48:

score: 0
Accepted
time: 138ms
memory: 33584kb

input:

100000 99999
12763 16166 250467
31830 98187 822376
31731 68420 627613
46817 60027 763817
48917 92806 205159
6596 79310 450916
68908 84848 944900
57429 89720 210955
43381 86661 234605
15261 18797 724464
7362 94804 527683
40861 47488 550442
62607 70766 40568
48886 98283 987633
17829 50721 278777
48859...

output:

805402
975971
924143
875481
999996
999996
947477
828440
849731
999996
999996
999996
684282
999996
898354
999996
977131
999996
999996
999996
564118
681388
792706
999996
282405
999996
999996
530550
972829
452926
562188
430474
829124
596107
999996
484805
999996
610553
541944
298442
666089
999996
820416...

result:

ok 200000 lines

Test #49:

score: 0
Accepted
time: 107ms
memory: 30476kb

input:

100000 99999
11906 85714 689636859
4211 12706 604206469
15137 94168 198427622
59046 67461 646679992
63970 87508 724069330
35543 37335 64894808
15558 58557 213507426
25990 82440 414133765
73105 90945 166204519
31412 82577 777533889
31858 54857 43216596
46205 53798 654158732
6440 18982 257505662
26511...

output:

998760983
993699795
999609378
999609378
980429197
998760983
995090859
993349021
997979705
996010854
999126569
999609378
994945901
991940760
980429197
998305546
995866080
997979705
988586035
997979705
991940760
992630162
989508580
993552610
999609378
976761570
999609378
998760983
982222086
998996883
...

result:

ok 200000 lines

Test #50:

score: 0
Accepted
time: 104ms
memory: 30632kb

input:

99996 99995
47030 54692 874921
50077 65431 310640
62515 63488 651428
3806 76419 87411
11344 67382 896355
41928 59190 879018
7721 84369 152960
27533 99920 91501
8243 37323 373237
28731 47123 948807
27610 54743 916881
11093 28728 517609
41783 59168 787142
64690 98721 128096
30101 36549 852592
62690 71...

output:

999997
999976
999997
999997
999927
999997
999976
999976
999997
999997
999932
999997
999997
999927
999927
999997
999997
999997
999997
999997
999896
999997
999997
999997
999997
999997
999927
999997
999997
999997
999932
999997
999932
999885
999997
999927
999976
999976
999997
999925
999997
999997
999997...

result:

ok 200000 lines

Test #51:

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

input:

99959 99958
37890 68752 282061
23889 39822 113215
7304 8509 865895
3898 65125 363746
50671 72330 20275
50828 89984 838792
606 30738 620610
46753 74592 82602
43487 85051 507883
16818 32088 375417
71281 85709 730502
16502 89423 377652
14550 89210 78423
21587 79190 846363
31357 91972 263994
9180 70338 ...

output:

999957
999945
999979
999969
999845
999945
999852
999842
999979
999710
999945
999977
999649
999979
999993
999979
999845
999945
999979
999979
999979
999979
999929
999979
999301
999979
999945
999852
999945
999945
999979
999238
999708
999845
999977
999457
999842
999979
999972
999710
999957
999979
999979...

result:

ok 200000 lines

Test #52:

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

input:

99711 99710
37013 88793 803818
32517 60853 624282
64139 82325 683903
66 51281 567482
1319 77469 124704
14770 67249 643340
10377 63928 641172
32564 86232 731516
31882 57924 835922
41065 43485 280900
29505 96666 228118
9485 39693 925392
10354 29622 157025
46721 87769 13671
62096 67349 876379
55701 736...

output:

999934
999635
999609
999970
999639
999257
999935
999460
999703
999703
999350
999639
999703
999809
999935
999991
999935
999934
999635
999460
999822
999851
999639
999639
999851
999217
999731
999970
999916
999639
999703
999934
999635
999934
999935
999934
999639
999635
999081
999609
998881
999609
999639...

result:

ok 200000 lines

Test #53:

score: 0
Accepted
time: 96ms
memory: 30556kb

input:

99226 99225
1250 95160 356781
87924 98326 817508
28278 81487 971220
2779 32514 501094
148 41761 772174
73233 92578 548150
1379 62425 639522
2640 98845 387368
19544 64149 355053
68498 73702 890276
11519 23551 442005
7133 17571 767089
54196 67708 172498
32304 86287 489894
2627 46644 98424
48346 95347 ...

output:

999906
999769
999886
999875
999906
999555
999906
999769
999765
999886
999906
999644
999906
999906
999886
999302
999906
998031
999906
999453
999886
999769
999368
999906
999084
999738
999906
999886
999886
999886
999368
999906
999906
999906
999886
999769
999886
999556
999886
999886
999906
999886
999205...

result:

ok 200000 lines

Test #54:

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

input:

93261 93260
22294 73352 397968
12144 60906 234290
888 65899 906145
42235 64115 167783
20664 56745 165039
34541 34660 610279
53 88027 859993
27532 57952 531444
69084 89763 647987
4261 85841 666329
14685 58668 832562
36729 73102 162102
27830 72386 422571
42038 78513 455061
60219 75693 832486
35611 841...

output:

999199
999199
998817
999583
998817
999370
999199
999370
998520
999370
997614
999370
999370
999199
999510
999370
999370
999199
999789
998769
999427
999634
998817
999809
998769
999370
996436
995848
999370
999370
998929
999136
999199
999370
999370
994618
999458
999199
999370
997455
998769
998817
999370...

result:

ok 200000 lines

Test #55:

score: 0
Accepted
time: 87ms
memory: 28908kb

input:

66079 66078
40294 56592 419999072
3186 17262 184493664
54119 58625 65429561
24195 54835 959682143
15543 62248 139206108
33327 40925 629095502
10095 31973 682333469
3303 46043 759345478
33596 43432 360626639
34138 58263 58363469
35599 45490 586193609
21243 37652 507678719
8598 35147 409060276
30324 4...

output:

973034476
991204013
999987497
991204013
996761894
991204013
999987497
989666102
999167982
999302800
999987497
988052112
999987497
996726386
961359965
992796648
996930350
999987497
999403888
991204013
999167982
996930350
973034476
996930350
998778804
996930350
991204013
991204013
984563312
999987497
...

result:

ok 200000 lines

Test #56:

score: 0
Accepted
time: 94ms
memory: 31376kb

input:

100000 99999
4043 68325 497200919
58889 89831 306291271
5967 36851 380001064
9731 16223 457201731
51455 64621 120517022
48685 59958 59935199
39013 44637 362056386
29858 94647 408418409
16633 17005 497530782
78146 93551 288814557
10429 81173 169064436
5069 93567 136064151
12516 21458 238654047
31285 ...

output:

732887883
983097584
986901760
941475001
992892674
986901760
732887883
941475001
732887883
901177698
986901760
986901760
983097584
992892674
732887883
670462568
670462568
992892674
983097584
992892674
718245778
732887883
992892674
732887883
986901760
983097584
732887883
986901760
901177698
992892674
...

result:

ok 200000 lines

Test #57:

score: 0
Accepted
time: 108ms
memory: 30632kb

input:

100000 99999
14848 68344 424723
8440 95340 965615
35458 45153 804789
19715 69237 993808
58008 96605 746727
6797 45134 96171
47295 56744 208100
35919 40042 771578
87684 93793 924565
43775 65623 409471
44267 87774 212038
24273 51595 761725
61879 76736 784918
49374 91958 683169
99511 99930 972221
12012...

output:

999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999
999999...

result:

ok 200000 lines

Subtask #9:

score: 0
Accepted

Test #58:

score: 0
Accepted
time: 39ms
memory: 15512kb

input:

15780 15780
9590 14917 123113565
8122 11966 171896575
4538 9640 684944907
310 15055 407333658
6468 6696 360870061
14420 14762 755531343
1519 7305 780579452
4826 10759 449674098
962 6310 894674872
1063 3895 307635821
1732 6606 796058884
9844 13284 963137200
3006 11229 839846442
9699 12787 436669041
3...

output:

999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
999989524
...

result:

ok 159998 lines

Test #59:

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

input:

97305 97305
18031 23906 46499800
4537 62493 819754642
12601 72388 927284279
12194 64515 959120012
20286 37636 668528246
29079 78601 858730575
29026 70123 609179274
9620 52064 889926076
57911 68174 840164824
6027 15672 4241603
27859 81289 879623834
25005 40031 915362203
25251 49190 966356144
55014 77...

output:

999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
999998911
...

result:

ok 185715 lines

Test #60:

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

input:

93117 93117
25905 55841 816137548
19151 75515 125110196
15833 39524 616837021
24373 87342 855351440
63684 64447 869885378
13156 18759 94680126
34204 65554 934242198
5036 70177 295603328
33012 40953 991315766
31178 92012 580403828
68600 73567 689458117
75242 82184 369629997
38640 41926 39311288
49559...

output:

999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
999995107
...

result:

ok 199964 lines

Test #61:

score: 0
Accepted
time: 94ms
memory: 31272kb

input:

100000 100000
83777 95667 855323557
32270 82669 119171767
13162 17596 920233532
895 94189 858627141
16503 21028 50647402
50267 62909 81183084
20093 67876 691642088
25983 33855 359676530
6456 60568 675799851
62890 65517 814380898
17106 61830 860771447
1646 21968 8552140
63621 81759 393232478
30383 67...

output:

999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
999980169
...

result:

ok 200000 lines

Test #62:

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

input:

100000 100000
48887 49141 603667548
35096 35884 935691593
41859 88584 536958240
21752 30218 985960119
33287 73670 927642333
39631 45059 28126584
52645 76252 855605990
78783 97743 767327235
25812 80829 427575668
26059 51933 273645508
40940 42952 816251555
39806 85601 202601807
69637 84555 945752876
4...

output:

999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
999995749
...

result:

ok 200000 lines

Subtask #10:

score: 0
Accepted

Test #63:

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

input:

700 981
98 105 341789735
208 604 709973200
335 644 104865354
338 602 812201660
343 518 643785882
573 628 351487907
34 371 52914687
309 353 606226854
279 656 985748970
225 364 196001300
31 40 990562200
355 510 995899482
258 663 316091802
270 314 981972681
39 383 327795015
177 199 325653340
44 342 461...

output:

861519786
688215423
760926930
532860158

result:

ok 4 lines

Test #64:

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

input:

1000 1902
502 729 377372806
109 872 524154440
101 337 328089210
254 974 422335648
194 508 769893685
106 659 68632431
82 954 31260323
185 195 706934
266 351 50286792
216 656 254246263
609 992 70475818
17 279 766487843
317 348 834129081
851 924 219636957
16 505 631456440
256 496 293494153
334 663 3289...

output:

608506384
361443683
382973150
546837124
458127056

result:

ok 5 lines

Test #65:

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

input:

997 999
239 963 857616
272 865 761576
296 300 27947
229 245 154198
421 642 285386
259 909 239681
282 825 28710
421 976 798206
627 661 366056
696 907 215070
8 65 714348
70 686 612521
0 303 958823
924 952 121452
118 305 105511
63 309 14457
87 114 278033
237 881 922043
84 429 565331
571 878 459915
87 9...

output:

982893
998840
994951
998840
998840

result:

ok 5 lines

Test #66:

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

input:

903 1095
37 443 795769
205 552 335407
638 654 438155
141 312 432420
19 406 876014
287 869 786745
112 833 41671
358 542 334577
750 845 37615
153 539 499600
406 430 44210
316 494 862445
111 173 74083
64 418 78935
406 657 607499
258 618 125752
663 793 685432
640 900 606812
148 401 373851
239 767 132271...

output:

826964
684619
685036
688577
637924

result:

ok 5 lines

Test #67:

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

input:

241 1754
35 49 694711453
128 136 829311156
50 209 659263482
32 181 609838442
11 213 149778625
21 239 775733437
196 231 538822366
30 106 60852833
59 145 186992621
40 160 567859057
96 200 11332724
141 159 521896798
7 109 649696453
119 148 166611402
57 61 689936255
101 126 679067571
7 150 638150329
31 ...

output:

108021720
225351885
84881629
178272205
166328759

result:

ok 5 lines

Test #68:

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

input:

767 812
253 455 772150570
268 652 696000769
267 660 332513569
208 373 216321956
199 704 716015522
398 605 393957551
59 303 974670959
110 216 18933330
495 726 612522403
199 736 946310309
266 430 764076104
323 449 763830037
175 520 311929677
239 643 288607268
137 670 402860674
214 762 658493428
431 72...

output:

709655190
909693622
923716139
909693622
923716139

result:

ok 5 lines

Test #69:

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

input:

1000 1790
439 731 125911437
244 857 558719479
443 487 798812746
77 122 552778938
576 726 494866245
673 675 32102772
111 986 31880508
832 836 576736835
166 226 866281840
436 854 592951599
307 772 616724945
233 962 529991434
614 772 479940193
482 930 158124950
345 874 542520232
653 681 674943760
201 2...

output:

489717844
511570332
503893704
504359202
480739021

result:

ok 5 lines

Test #70:

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

input:

1000 1861
372 453 947883630
340 678 820265446
500 891 642744558
269 934 88868262
550 830 884900314
668 885 483931867
357 735 912695560
28 214 971816523
141 277 351170396
378 636 229764164
89 632 221622945
546 986 499824882
407 794 991528245
657 888 325758790
739 806 862883768
366 630 571735110
324 6...

output:

787526261
698073617
257495280
485408094
437152539

result:

ok 5 lines

Test #71:

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

input:

1000 2000
46 600 340036
403 625 512510215
654 730 942030
350 418 432097
104 283 166851
418 818 756898
192 267 715890
98 171 201437
559 801 235052
425 930 854766483
447 643 583172
69 248 331256688
734 896 664356
19 581 790779403
641 736 931516
438 740 129540
710 820 932188
408 476 923349
79 393 46071...

output:

999996
998607
999996
999996
999996

result:

ok 5 lines

Test #72:

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

input:

1000 1015
223 448 625336
298 580 704786
202 239 878640
843 987 451589
104 516 816870
817 828 413729
673 986 983473
363 571 631781
563 626 515915
585 867 124914
246 609 291652
176 398 649067
816 862 566955
578 906 855372
178 604 65837
236 432 806017
459 875 228231
536 671 95936
89 489 950374
98 871 7...

output:

531860
799326
422129
678321
599289

result:

ok 5 lines

Subtask #11:

score: 0
Accepted

Test #73:

score: 0
Accepted
time: 51ms
memory: 28940kb

input:

78545 146764
18353 73568 390778280
12956 64342 108778687
15074 61576 760673206
42118 71716 240356072
2787 39663 244001782
56627 68256 551718402
41708 74741 185084427
54908 55871 646459940
34896 59980 645111379
2554 54709 139732994
222 57068 172643582
34548 53342 121908641
17689 46437 342955316
42968...

output:

555397722
503859531
330832204
367074456
731191626

result:

ok 5 lines

Test #74:

score: 0
Accepted
time: 64ms
memory: 32604kb

input:

100000 200000
45680 91602 918638184
35145 42963 118973086
47860 61548 440546
5427 28357 707228099
5349 76349 202984281
28857 41370 752045
41166 67241 547608848
28306 45167 83758
45659 55881 659204
53802 89148 360777
16929 93843 709505183
28443 51621 180538
3041 38581 9926
497 76569 983728663
17083 7...

output:

999997
999993
999997
999997
999997

result:

ok 5 lines

Test #75:

score: 0
Accepted
time: 41ms
memory: 32788kb

input:

100000 100053
85905 95917 554108
5320 94676 696495
42060 81864 839398
20446 84167 357923
32330 56923 93484
32086 58691 953077
62684 80039 410654
23325 30238 561416
2053 8805 722776
76338 94387 681683
34419 38450 638379
19873 26527 921924
35763 84475 945978
41836 94532 768180
39953 74916 15197
16898 ...

output:

999993
722828
496523
999993
999993

result:

ok 5 lines

Test #76:

score: 0
Accepted
time: 59ms
memory: 32280kb

input:

100000 171640
20494 55969 487436962
23123 53497 854051787
16886 35879 848049911
6094 81903 82799164
34005 89575 708021885
67717 80941 816765765
39786 83628 980281877
32185 50981 248012081
2422 62554 882187450
62464 79869 160561255
7137 20612 609575215
12594 30162 157315424
9635 63672 968417384
8332 ...

output:

666655797
683964099
573771902
563273007
550138189

result:

ok 5 lines

Test #77:

score: 0
Accepted
time: 35ms
memory: 29324kb

input:

99991 99996
54054 96507 983863
67338 79035 165244
60775 60833 547638
94518 98166 40392
55569 60732 375720
79989 85620 999355
67934 91632 835023
29315 94327 86906
57574 83913 102065
20801 98542 117569
24458 46239 449457
23975 58465 981992
853 98712 113076
9834 84962 20576
5819 68199 915854
49852 8882...

output:

999912
999958
999788
999885
999825

result:

ok 5 lines

Test #78:

score: 0
Accepted
time: 43ms
memory: 29244kb

input:

99411 100200
1565 56507 318763
45998 86345 844216
25732 83594 713957
61472 67881 761655
31739 73990 133341
62909 73378 702888
50241 88578 222967
26487 44824 918783
62891 88163 830491
1583 89530 757616
59308 83651 575117
90436 95878 108239
2459 50085 798914
20586 54940 36092
3367 4171 429452
23486 28...

output:

980253
989598
995973
994286
989815

result:

ok 5 lines

Test #79:

score: 0
Accepted
time: 41ms
memory: 29616kb

input:

97256 110928
26566 65674 71375
18800 30935 605255
45711 62650 731783
12731 94721 726093
75885 77459 87330
30520 78085 995703
29354 84670 720081
1007 14923 904310
69590 87960 451646
30517 54985 526853
48108 96125 804977
32564 67191 415420
27873 81503 631520
14938 46884 813166
66518 87211 536067
18668...

output:

551890
742613
651103
879622
919714

result:

ok 5 lines

Test #80:

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

input:

1102 157758
512 868 893167047
637 846 765652111
564 648 410567341
30 471 146001182
44 898 465486889
188 599 187770887
548 1036 159617609
10 582 347570869
87 404 721446959
2 474 518561397
170 922 915381164
65 1030 926714669
635 743 100948782
187 680 496737331
609 1076 988056974
608 631 598413118
65 3...

output:

6879546
14780518
4168129
5507485
7734419

result:

ok 5 lines

Test #81:

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

input:

7432 120573
1204 5435 671443368
216 2216 395125563
816 4235 946462391
306 4524 651074855
2467 6767 174093176
1343 6288 131233799
4423 4441 203051677
5990 6906 439213505
6048 7305 559187054
281 3550 728087503
1620 5115 445918489
322 3359 468491948
780 4240 38338417
3540 6640 263670502
6446 6611 48979...

output:

39472256
80037415
40713662
44829020
41413899

result:

ok 5 lines

Test #82:

score: 0
Accepted
time: 45ms
memory: 24656kb

input:

63714 128316
29887 48041 759773879
23891 38297 243036335
31818 50167 880751010
60171 61008 663928602
19993 60302 303626571
2757 8934 786437283
493 21069 745859633
4760 22534 28967172
1048 23088 947745912
24070 32291 538829262
14615 46584 710255
1720 43272 413106448
33180 53458 333261569
47330 53910 ...

output:

286736063
296094004
403137634
327805404
685003195

result:

ok 5 lines

Test #83:

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

input:

100000 161432
76356 82947 287495639
39767 41977 733848512
77625 85436 947122975
5209 46996 184911953
67742 68622 307544205
32461 95988 781005937
59178 86687 662734384
41099 82315 336165118
20407 34047 182656951
23229 69231 920982054
52938 53835 389516204
16837 75928 132500785
74392 78883 48975372
83...

output:

499489962
501211086
497898291
500005766
500258903

result:

ok 5 lines

Test #84:

score: 0
Accepted
time: 56ms
memory: 32616kb

input:

100000 178820
39503 75630 724963648
13396 71417 724497896
35341 73450 503489246
7270 50716 962223598
25751 71446 650621874
27444 78524 620713991
57289 78491 201061776
52866 77130 423988962
23550 37899 173505428
11459 51667 446569913
43332 90466 323935451
58345 77558 93801789
8845 50194 17965904
1691...

output:

702992251
344328583
373455204
144359037
637907240

result:

ok 5 lines

Subtask #12:

score: 0
Accepted

Test #85:

score: 0
Accepted
time: 38ms
memory: 18632kb

input:

31126 49978
11370 29373 763709607
7784 30527 424491075
6825 18769 724126326
8225 28703 895476400
5674 25870 738364236
7240 26466 498917748
6427 27557 798811343
11304 27132 672101930
27476 31031 629664039
24050 29200 377006402
6716 18044 763174184
4099 4891 290207161
24287 26673 841170290
4755 16253 ...

output:

697457584
573424065
555191004
543296805
590546490
623748100
396796606
431618352
677679639
453461864
425099107
655065249
567987779
466633532
600275452
487944580
503124310
671769005
735875066
506389901
461728729
557590959
640594394
511355590
647260235
592189433
523526435
631878306
685616708
523816574
...

result:

ok 50515 lines

Test #86:

score: 0
Accepted
time: 132ms
memory: 34360kb

input:

100000 200000
60321 96548 69744
10423 21720 106478171
39357 89812 711537069
40235 87875 215507645
53869 67592 940434111
45204 74190 184239922
17785 30031 286012
73524 79014 10280625
3741 14805 193464460
2411 89364 50607
12407 98884 490544
71561 80646 412797
80715 80953 162225
77929 91735 270461776
1...

output:

999998
999994
999998
999998
999998
999998
999998
999998
999998
999998
999998
999998
999998
999994
999994
999998
999998
999998
999998
999994
999994
999998
999994
999994
999998
999998
999998
999998
999994
999998
999998
999998
999998
999998
999994
999998
999998
999994
999998
999998
999998
999998
999998...

result:

ok 200000 lines

Test #87:

score: 0
Accepted
time: 148ms
memory: 32672kb

input:

100000 100091
84333 86950 230237
58869 94939 96352
29365 86765 624078
27848 34823 331520
81872 83028 810768
48944 62575 793844
11224 36099 69848
539 69349 150581
15648 56030 290074
67420 98600 363991
35904 47013 280381
21941 52867 431729
44047 62128 869646
6128 68801 472649
43183 98269 361943
8157 3...

output:

913424
691337
1000000
938551
1000000
896986
549755
1000000
1000000
642452
1000000
1000000
1000000
1000000
1000000
328092
699572
321256
292901
1000000
1000000
1000000
999443
387841
1000000
780152
1000000
1000000
1000000
1000000
1000000
741349
1000000
1000000
746442
731653
808646
1000000
410629
100000...

result:

ok 200000 lines

Test #88:

score: 0
Accepted
time: 132ms
memory: 32472kb

input:

100000 135475
17769 52373 510978209
35003 53839 445208595
54494 88606 318940316
14528 43679 134964722
3962 60741 302412961
15555 50692 950296996
23655 26651 873073670
14941 35590 70103371
3692 39536 821529037
59658 93857 361858565
32727 45902 544226304
11856 35041 431623986
29355 30246 589928445
424...

output:

827928360
534444473
846580031
839694207
495510233
481103282
614282785
821122090
667839770
766294838
539984032
708070464
564272168
652345976
463334890
649822803
525063006
923413796
784300956
592253715
636099163
760608877
472674821
931716739
505016641
498348093
682990007
480448900
682726404
490164701
...

result:

ok 200000 lines

Test #89:

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

input:

99998 100016
46554 60104 142571
22307 81649 571537
9708 71468 670761
16415 54782 664614
7408 80547 180771
13981 33023 587922
33706 54895 841198
13615 41791 646698
9813 32092 320867
53331 61406 537562
39753 70195 179008
52426 75604 330643
19518 36155 841962
90491 95402 918439
42992 65822 709475
5525 ...

output:

999767
999908
999193
999660
999565
999767
999773
999685
999767
999565
999767
999276
999137
999897
999461
999049
999220
999782
999908
999710
999704
999710
999137
998996
999834
999767
997169
999514
999164
999773
999767
999565
999788
999049
999049
998921
999565
998721
999782
999685
999773
998921
999062...

result:

ok 200000 lines

Test #90:

score: 0
Accepted
time: 99ms
memory: 30580kb

input:

99944 99974
12221 24463 336379
7127 85901 917861
19656 84013 612937
11377 90779 163116
97061 99348 32608
27451 55770 565159
38013 95851 502439
24114 91177 897033
39111 61062 337518
20144 73628 617124
4282 34370 399370
24348 81575 916018
14290 38374 370050
13676 26709 86821
61271 90189 204072
9192 77...

output:

999332
998739
999292
999292
998704
999138
999730
999954
999292
999730
999292
998914
999438
999438
999730
998658
999730
999730
998704
999730
999438
999292
999730
999048
999138
999438
999406
999730
999438
999438
999519
999138
999630
998252
999730
999730
999146
999794
999730
999730
999438
999675
999730...

result:

ok 200000 lines

Test #91:

score: 0
Accepted
time: 123ms
memory: 30592kb

input:

91145 106029
36516 74490 207286
54034 60981 701392
2473 14385 396869
11699 27247 767011
68151 74411 23743
23884 24495 338833
37816 73561 16176
27441 54030 134670
15490 49440 103799
4877 50034 658739
4889 54959 818131
10986 36631 887513
70288 83332 7121
32937 79635 422440
48611 76017 738586
39204 592...

output:

801659
577935
905468
724858
585777
748630
849087
663471
578963
832037
874156
677810
693276
651387
709584
792234
859392
849863
646940
588543
744752
700487
829719
722377
818893
645538
956737
678647
806304
905108
944904
749140
729921
842812
843116
902890
717312
907297
823332
733108
735700
773834
835877...

result:

ok 200000 lines

Test #92:

score: 0
Accepted
time: 86ms
memory: 15332kb

input:

1791 166866
663 1071 798753738
26 1188 874753977
1189 1502 740928961
186 1679 325043877
822 1639 290384102
139 388 267856986
556 1599 670288125
311 1001 457991875
1333 1556 17585614
396 1187 991750083
595 622 869906582
1647 1685 992741675
827 922 304232087
1523 1539 927607035
291 297 634498641
885 1...

output:

7119128
10145863
9456940
6448351
20932452
6223179
7808161
7385141
9754499
17185420
6237099
12837404
11978926
6954045
5941610
8852162
11702511
8834266
22418328
17737172
7592303
10209617
7219023
14959795
12375042
11694741
12578126
7522855
13813900
8195093
13926961
13060759
6570938
11099425
11328635
94...

result:

ok 200000 lines

Test #93:

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

input:

11281 148629
1700 10666 207754916
8939 9008 339336940
10154 10515 428186248
7496 8003 475988267
2550 3242 457489783
1105 9356 342057636
167 4768 447239339
2451 3540 714139512
2154 4674 98910010
2499 6678 799631258
3063 6105 647187768
816 5510 680115622
305 613 310332968
2680 5819 657781216
6158 8767...

output:

161791203
154641213
47912078
43209573
47488217
65947038
67011972
156515936
51522533
177681649
169091084
65967639
357662928
47176536
59454110
70393074
101374820
140128351
72565729
54773610
42406131
110179748
71375964
72309762
57164077
65967639
41726600
97554355
67239453
74699244
62552308
51590359
446...

result:

ok 200000 lines

Test #94:

score: 0
Accepted
time: 130ms
memory: 27048kb

input:

64119 121866
14180 17153 533240315
2647 42549 853410344
25611 50739 912876368
12424 36856 622388196
484 46537 536636715
17195 55441 973119167
15480 15878 545116456
11098 54452 928406709
18827 35679 437076044
49374 62780 997836864
8148 61655 888481619
36254 43467 392772398
43337 45987 587423977
35187...

output:

331668209
566206758
411114730
476269498
384722532
630756158
344503428
341692309
479727005
624999877
437005427
593449857
327538700
659847602
364885003
611406499
504983965
814272181
543447903
587779911
770543713
291729092
863373994
524792340
539893924
289149318
508323129
411765936
360209319
381615936
...

result:

ok 200000 lines

Test #95:

score: 0
Accepted
time: 104ms
memory: 32684kb

input:

100000 158482
33728 39077 411037127
65404 74153 658729087
36551 48460 524188010
29291 53648 13669818
10492 32448 669499087
12460 40689 25563725
4370 43223 434938972
1709 58847 853721426
18287 74134 26003382
7298 12907 120961994
5840 11765 724748484
8217 90554 413935422
91126 94756 431150649
32468 57...

output:

500051711
504222868
502661269
503747605
500461322
500104877
500555496
512215686
500335434
502366912
505896543
502116694
506476211
503450247
500435879
504652695
501198562
506672342
502274907
500335434
503800378
500112369
508477651
500104877
507520406
508284454
500104877
500335434
503963891
505139358
...

result:

ok 200000 lines

Test #96:

score: 0
Accepted
time: 140ms
memory: 34076kb

input:

100000 176982
11891 27920 638515588
4551 57618 643556191
14097 65254 729291322
50708 64657 823237632
53372 78749 655753298
6969 64861 993285430
11081 69348 699998310
25400 52932 351528559
49878 79045 421115403
59948 90485 913472284
8186 49347 260978203
4164 37702 225023065
25101 71399 135792772
8127...

output:

707173394
612055122
608566053
625809688
163658048
715350559
881164089
648901073
633196544
612676921
851803181
583996480
593168382
599277211
656152513
636174289
455916654
171684812
581092953
657247942
456668804
627372777
630032703
348055778
587498928
611447933
647626039
615526890
693438324
453595081
...

result:

ok 200000 lines

Extra Test:

score: 0
Extra Test Passed