QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#76527#5478. Quiz ContestBeyondHeavenAC ✓1026ms50584kbC++177.7kb2023-02-10 12:48:212023-02-10 12:48:22

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 2ms
memory: 3372kb

input:

2 4
2 2
1 2

output:

20
4

result:

ok 2 lines

Test #2:

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

input:

4 6
1 1 2 2
1 1 1 2

output:

168
168
336
48

result:

ok 4 lines

Test #3:

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

input:

4 82
20 22 12 28
20 22 7 8

output:

746371221
528486621
148054814
913602744

result:

ok 4 lines

Test #4:

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

input:

2 2
1 1
1 1

output:

1
1

result:

ok 2 lines

Test #5:

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

input:

1 1
1
1

output:

1

result:

ok single line: '1'

Test #6:

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

input:

1 2
2
1

output:

2

result:

ok single line: '2'

Test #7:

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

input:

2 5
2 3
2 1

output:

12
108

result:

ok 2 lines

Test #8:

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

input:

3 6
3 1 2
3 1 2

output:

108
420
192

result:

ok 3 lines

Test #9:

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

input:

10 181
21 11 1 38 33 31 2 25 17 2
13 9 1 37 26 16 2 4 13 2

output:

933670175
947389273
127286706
932736158
827765819
807282126
45553639
228256557
350039760
45553639

result:

ok 10 lines

Test #10:

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

input:

9 141
47 11 1 53 2 3 1 1 22
30 1 1 40 1 2 1 1 4

output:

959854830
649008360
59000760
9143465
118001520
42136705
59000760
59000760
221770152

result:

ok 9 lines

Test #11:

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

input:

6 167
40 2 1 54 43 27
31 2 1 14 37 18

output:

21684914
968181716
594826171
452099065
231748717
716046725

result:

ok 6 lines

Test #12:

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

input:

18 166
5 1 14 6 12 12 1 5 12 9 1 16 12 7 13 17 5 18
5 1 2 5 1 2 1 1 8 9 1 14 9 1 13 9 5 17

output:

424073779
982729592
570450467
984062217
812067221
258146602
982729592
920670548
515287508
879372936
982729592
802466756
124165180
889641026
888797216
227029638
424073779
310377834

result:

ok 18 lines

Test #13:

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

input:

8 152
50 16 54 13 1 6 11 1
19 4 24 13 1 2 2 1

output:

877632556
241460682
91908033
969346444
96488448
124488250
658149142
96488448

result:

ok 8 lines

Test #14:

score: 0
Accepted
time: 31ms
memory: 5564kb

input:

146 32696
368 65 173 10 276 370 47 358 412 456 4 78 196 420 311 52 268 30 299 442 350 381 129 256 165 368 178 23 374 197 375 16 85 292 243 252 119 365 229 139 149 4 6 131 357 160 73 457 314 157 47 240 451 103 72 216 225 2 348 75 122 120 215 431 324 390 290 201 152 397 41 456 160 59 95 222 427 366 12...

output:

467990629
463000266
943072509
432089030
49032918
611725131
153142050
344818177
77750674
577573890
168930682
784177123
289251676
359922539
792694167
6087427
525005617
82895478
85438974
681066466
186956527
334880899
244523308
287659908
691939081
470665184
582502913
222544676
12306392
202576806
6796758...

result:

ok 146 lines

Test #15:

score: 0
Accepted
time: 125ms
memory: 13380kb

input:

12 135502
445 7 74 7828 3973 88981 2 3 34020 6 14 149
296 1 44 2077 1410 58906 2 2 20274 5 8 97

output:

247771824
547131421
646713541
586476213
655944584
292156217
450970619
631309320
381265997
891057017
213293851
155903656

result:

ok 12 lines

Test #16:

score: 0
Accepted
time: 222ms
memory: 16120kb

input:

34 191157
12849 385 7417 5645 3650 14937 5263 14239 6748 8 5559 7584 6916 7862 10048 7 4440 12669 14879 6 1578 1 11033 64 1013 832 4689 14222 85 55 9369 4830 2220 55
4207 162 5105 4482 3092 12838 4290 1343 1237 8 538 3464 4374 1541 6650 3 2080 10969 5545 2 954 1 5674 32 224 35 4297 12964 23 46 1233 ...

output:

255119209
521376107
197752736
442383424
832357744
455431749
949816103
213054433
580939700
62100482
889645036
129669655
386246248
79884619
472922214
913181203
438817794
983088203
944477001
334844558
742360339
456376198
73581656
572167147
590992793
24664993
595551147
589468590
415150968
757752443
5798...

result:

ok 34 lines

Test #17:

score: 0
Accepted
time: 220ms
memory: 15792kb

input:

70 182517
2435 152 2917 21 5364 4056 4106 5062 2452 4938 1581 5477 1575 5258 422 5017 1811 1668 44 5138 4822 1548 1555 1471 1001 3030 2262 3634 2448 2756 5574 3013 73 403 1760 23 2761 5568 958 816 3233 529 1771 290 1668 3227 2 3198 3489 5689 733 354 5524 5196 413 1298 1691 887 5305 1514 3315 2556 55...

output:

713670549
493984929
786459236
608057522
777911712
678950818
645324064
464695978
588897470
704643687
1308082
951095374
545178848
759655092
867183769
314404297
655634891
311057797
687724076
165666906
408580851
249765524
147179956
908049799
624378594
724558870
249141772
899676450
694659492
215347473
90...

result:

ok 70 lines

Test #18:

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

input:

15 55966
18 15004 226 815 2 19930 8 11437 1 144 11 722 7050 346 252
8 4263 219 763 1 15689 2 1379 1 96 9 595 5354 195 24

output:

791239607
202491784
333152928
35656281
54347292
560275242
570958010
418598684
27173646
343462640
566313512
813564902
257035400
163734689
302743685

result:

ok 15 lines

Test #19:

score: 0
Accepted
time: 433ms
memory: 24420kb

input:

22255 200000
11 17 12 16 15 16 7 8 14 1 14 2 4 9 4 10 8 2 12 11 4 3 7 11 17 3 6 11 6 1 8 15 10 4 12 10 4 15 4 1 13 17 11 8 17 6 13 17 13 8 11 6 8 6 14 6 9 10 5 6 13 17 1 12 9 9 10 5 6 9 13 5 15 13 9 7 5 15 13 15 4 14 7 15 13 15 8 12 2 8 15 7 3 5 2 1 12 10 10 5 3 10 13 7 3 15 10 10 14 12 17 11 2 11 7...

output:

69559751
808437681
100585574
738741835
889199547
432436383
510370369
276255019
920483510
358122725
716691199
716245450
361736339
94711106
274950112
553797515
824450201
716245450
819554809
240123194
434246547
610842079
866994073
240123194
217553094
716480897
425641462
883724571
151389184
358122725
82...

result:

ok 22255 lines

Test #20:

score: 0
Accepted
time: 284ms
memory: 24732kb

input:

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

output:

874289995
621495883
205883960
20588396
940210486
56206057
741362761
148099876
653357481
20588396
102941980
741362761
372216136
20588396
634483960
722917888
56206057
775075279
775075279
940210486
653357481
775075279
20588396
653357481
20588396
200084624
741362761
709543793
775075279
810358506
5620605...

result:

ok 36420 lines

Test #21:

score: 0
Accepted
time: 299ms
memory: 25208kb

input:

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

output:

145039298
613892710
467714607
480222591
467714607
354332976
467714607
641269354
847878096
944159307
809798936
102881528
809798936
344738136
116646544
751420855
404899468
769024819
467714607
404899468
404899468
116646544
467714607
344738136
207440160
505531342
832714316
621022796
684168658
872614075
...

result:

ok 36319 lines

Test #22:

score: 0
Accepted
time: 404ms
memory: 24560kb

input:

23699 200000
5 4 11 1 12 1 12 14 8 7 13 16 6 10 2 11 2 7 13 11 7 2 5 14 4 3 10 11 12 2 9 13 7 10 11 3 3 5 16 11 13 6 3 5 3 16 1 3 5 8 10 3 15 12 14 13 16 2 5 14 14 14 4 3 9 13 4 10 14 2 3 2 14 3 8 12 8 9 1 2 3 1 5 11 15 8 10 11 13 8 15 8 12 12 11 10 12 12 5 14 4 7 7 12 11 5 1 10 6 6 11 2 1 11 1 7 10...

output:

97753678
94654465
806698707
772346881
730460505
772346881
932078316
619951417
849163904
751313953
58065923
223698068
797395891
397935970
319319014
876243146
319319014
415206402
30897448
806698707
348590580
319319014
97753678
830412804
986231975
19875470
359443064
478707065
641719462
319319014
622440...

result:

ok 23699 lines

Test #23:

score: 0
Accepted
time: 408ms
memory: 24640kb

input:

23450 200000
16 9 12 15 13 3 2 13 4 12 15 7 7 11 13 14 8 14 9 11 15 9 13 15 8 8 11 10 14 7 5 7 15 10 8 4 1 9 7 3 3 10 10 1 9 14 16 4 11 15 4 5 3 5 11 15 7 4 15 15 16 16 13 1 15 2 4 14 4 4 9 16 14 11 2 10 4 2 15 4 8 16 13 10 5 13 12 5 13 5 9 1 3 6 12 3 9 4 15 2 10 15 4 8 10 16 15 9 5 11 8 6 6 11 3 5 ...

output:

474695859
83419528
920048071
608644925
770244720
629045727
687229624
770244720
47173846
130400332
227663296
891887483
408814978
509883448
421840108
158963017
201344505
639339650
747874550
571257479
163000415
874702347
506445097
814520699
513020117
364643511
48624719
134635290
422587572
891887483
497...

result:

ok 23450 lines

Test #24:

score: 0
Accepted
time: 401ms
memory: 20668kb

input:

4849 200000
8 22 59 79 71 28 80 1 3 33 61 13 23 26 24 46 81 49 67 74 61 31 60 16 64 6 12 57 80 42 54 79 23 42 57 69 39 6 27 22 23 23 5 7 29 52 37 7 77 23 20 51 40 43 37 29 48 6 4 27 6 68 14 81 2 35 60 57 47 10 80 56 60 33 74 54 22 79 35 5 62 77 16 10 17 61 68 46 75 67 30 50 28 3 65 50 3 77 14 52 70 ...

output:

738820305
995662070
515212393
798390516
605493806
489891780
979096941
151234509
762638378
909212435
444617296
574181489
353579321
532058270
323704777
391854489
42906050
223642089
277062806
356648099
394850400
400862577
953806751
410434779
798854700
123706455
922706931
638349308
765280510
616250553
7...

result:

ok 4849 lines

Test #25:

score: 0
Accepted
time: 427ms
memory: 22736kb

input:

13856 200000
17 10 3 24 24 21 6 25 18 16 2 13 27 1 10 12 17 28 10 8 18 18 10 1 24 7 6 14 9 3 14 8 3 9 17 26 13 13 26 26 14 23 15 21 1 28 4 17 13 15 11 11 18 6 17 7 4 3 28 9 15 9 14 7 8 24 24 13 25 26 4 5 16 10 10 15 1 2 28 6 24 16 3 3 25 11 19 2 15 15 24 24 11 12 28 10 6 6 19 23 6 3 22 28 28 25 6 11...

output:

72511455
336078483
861680851
720077183
790671089
31284384
338206945
548013067
371508861
820204542
15903041
365379610
767417188
619975068
833896416
702488592
45692271
974866446
865334783
354070115
598285710
136389867
140082053
619975068
424549074
423559809
530690398
963536392
588553847
633502040
9675...

result:

ok 13856 lines

Test #26:

score: 0
Accepted
time: 410ms
memory: 20700kb

input:

4876 200000
41 11 35 16 22 55 37 81 41 8 23 38 67 77 42 51 62 40 46 66 69 49 14 49 39 51 18 68 2 71 17 48 58 48 79 77 35 29 68 46 35 41 7 63 23 46 51 67 55 22 15 29 78 30 19 14 39 19 59 7 11 19 7 10 56 1 61 75 69 72 46 27 63 21 50 74 68 47 41 18 32 81 74 76 53 68 37 73 71 56 81 1 47 71 51 3 8 79 37 ...

output:

194802687
711557866
419124213
801265297
48436835
950559282
233655583
499574348
632401673
991182010
338343298
163975865
190059859
984431152
623842274
475987266
583639129
520065554
812017554
778651338
217224836
860424934
580393239
960485163
480680434
126018786
913299905
326963209
225193463
862288369
6...

result:

ok 4876 lines

Test #27:

score: 0
Accepted
time: 410ms
memory: 21436kb

input:

7858 200000
50 49 11 30 21 8 21 41 9 47 37 25 27 25 30 26 48 33 46 29 44 29 48 19 29 11 39 50 6 36 40 3 19 3 13 6 40 31 12 27 38 15 1 3 30 30 1 31 26 2 23 47 24 20 15 31 38 47 18 37 9 10 48 1 7 22 20 18 48 17 45 23 18 2 40 9 30 27 40 19 25 12 23 23 17 33 34 27 8 12 23 18 46 9 24 29 21 14 18 45 44 44...

output:

54810749
584922225
793707623
879467423
66593011
913860155
320787318
286251410
548807590
148590789
894585923
630093969
355604779
698475619
276417708
962780761
116431688
553760434
365980953
814281703
362919744
423908461
347257826
915023838
13017917
690490068
477632454
509652288
150184662
599297079
650...

result:

ok 7858 lines

Test #28:

score: 0
Accepted
time: 416ms
memory: 21020kb

input:

4838 200000
9 54 21 58 64 63 33 69 66 47 67 81 36 19 46 11 47 17 61 30 17 20 13 58 59 35 7 46 47 14 65 13 29 10 70 34 64 22 56 7 9 44 46 81 35 75 73 43 74 22 44 47 13 64 10 37 22 75 34 77 43 38 74 68 60 9 25 38 70 64 42 27 11 32 58 40 66 73 17 74 37 34 68 31 35 62 52 17 38 48 27 10 64 62 15 47 74 49...

output:

645185483
622967370
289161025
306400723
979912384
908394448
363934537
568938416
326383729
966772202
533234569
603850548
450161784
516419054
717028836
64940288
181374970
158340511
917802460
991584826
462339263
857686540
865733565
191708153
19657223
898049460
3957153
777271552
707985381
575857338
9067...

result:

ok 4838 lines

Test #29:

score: 0
Accepted
time: 390ms
memory: 20472kb

input:

3560 200000
40 77 41 16 71 76 63 8 57 71 81 75 24 63 64 69 60 77 13 77 58 27 69 67 56 51 72 37 74 57 52 74 81 71 34 78 66 75 82 53 77 72 70 68 59 33 72 17 78 53 75 57 66 41 75 55 81 35 35 20 60 28 18 81 80 79 52 11 61 78 54 51 11 42 46 59 44 20 54 73 47 73 76 68 65 67 48 63 76 64 61 47 52 78 58 84 2...

output:

639342443
198672513
971133352
214282708
897022340
114809355
240809550
50548157
361737808
681922286
819373461
683145827
420417845
401522113
484747086
360277328
322184118
554462045
596143679
380194003
664901568
411976069
141459105
440736578
751443261
147111544
966140114
555174856
704695283
150952089
4...

result:

ok 3560 lines

Test #30:

score: 0
Accepted
time: 398ms
memory: 20124kb

input:

3499 200000
69 36 66 84 24 58 57 27 75 61 66 58 29 65 71 53 40 19 45 52 61 37 47 9 58 80 38 19 82 29 78 83 77 52 83 70 84 73 72 48 71 45 54 29 59 13 61 49 52 68 41 86 57 25 60 42 81 73 14 72 46 47 82 57 84 75 18 40 44 68 43 17 62 50 71 43 40 74 70 43 76 81 12 53 75 32 62 83 81 69 84 23 78 84 39 60 5...

output:

360581401
640000198
820634207
600896941
329746358
340253042
355170039
785937036
343769588
706520059
469119705
106961591
375336648
359462212
635198866
743323557
960991553
10455676
520127658
578057863
774780901
563099109
662318230
206404119
94049948
212681249
39453515
385309736
216845689
92912465
9035...

result:

ok 3499 lines

Test #31:

score: 0
Accepted
time: 415ms
memory: 20056kb

input:

3456 200000
40 77 50 31 29 58 49 82 80 51 77 37 78 69 82 59 63 52 31 58 68 28 52 70 63 82 80 44 84 71 75 19 73 67 59 57 46 84 28 84 85 43 52 43 60 79 37 79 79 87 86 78 76 77 60 67 3 66 87 42 64 56 78 50 72 83 80 78 50 34 77 42 68 47 75 78 70 80 36 57 55 84 82 60 8 23 81 82 37 83 66 36 70 44 41 86 78...

output:

556970143
480987945
309202035
847640377
373024785
971359770
403684577
783601789
635848140
286443977
48644093
96767085
616670163
850462203
490709242
169885611
931050764
822827125
739988693
497920179
982771711
93030947
674656894
837109200
968480432
793355079
371882564
378033744
364370258
221288258
956...

result:

ok 3456 lines

Test #32:

score: 0
Accepted
time: 432ms
memory: 20152kb

input:

3346 200000
78 72 40 55 50 68 46 56 54 88 73 23 84 69 82 48 35 83 13 66 62 47 84 89 64 55 86 69 44 86 63 60 17 27 59 67 69 80 62 81 77 56 69 74 14 70 27 65 65 63 39 82 31 46 51 67 55 88 88 75 77 53 39 76 74 88 47 49 43 43 44 76 63 39 62 82 71 66 59 60 79 76 46 73 54 54 89 37 38 63 73 19 61 79 87 56 ...

output:

25363556
79569849
454817830
713113379
633456860
120115916
693903370
389293808
23735906
255199558
92206911
791196042
438571210
537868342
808000544
684774763
350861838
102632212
643073038
980259549
527450570
176074308
803557862
756694781
72076739
778441811
577602132
74783737
723678800
912569543
570162...

result:

ok 3346 lines

Test #33:

score: 0
Accepted
time: 401ms
memory: 20388kb

input:

3036 200000
99 69 78 52 96 63 28 98 28 79 93 51 25 94 84 70 43 75 70 27 98 89 77 46 83 70 28 93 34 92 95 17 93 63 84 58 76 49 82 68 45 49 94 48 90 96 12 41 68 90 93 65 49 31 54 44 71 69 64 40 20 92 64 64 57 16 52 79 91 53 42 70 94 36 44 88 78 72 68 93 99 45 95 22 21 54 80 96 26 32 46 56 79 84 94 95 ...

output:

714328546
972486345
931992547
456632958
528659274
78863140
37681550
494659405
45532344
898693523
876553133
796759948
24133339
551847022
37278092
279265337
522279862
36200770
596798979
429965208
32711736
854059266
442606609
169181257
613777468
742705370
768304849
956320038
625532542
667494093
4611937...

result:

ok 3036 lines

Test #34:

score: 0
Accepted
time: 205ms
memory: 15620kb

input:

1627 200000
54 30 52 51 8 44 56 16 49 53 37 34 15 42 33 55 25 32 36 53 53 47 40 23 51 41 32 43 36 37 43 19 37 8 55 46 15 29 39 32 45 13 13 12 52 56 32 36 42 39 52 48 33 40 48 34 44 28 40 13 38 15 20 54 50 42 31 45 11 43 5 55 38 40 54 39 56 49 28 36 48 35 28 47 38 2 50 56 37 23 14 22 33 42 55 45 57 1...

output:

837419063
809581635
92748162
284241332
948918933
12093512
892102876
719816556
547095
722354711
445511729
458970757
466134227
790960911
679477162
816689674
734297163
772017914
267216904
263067810
223716040
114860559
539075683
632752961
863386648
251745353
58262647
925718397
539640013
791606432
763439...

result:

ok 1627 lines

Test #35:

score: 0
Accepted
time: 601ms
memory: 35612kb

input:

1927 200000
55 37 61 8 47 43 46 21 30 60 42 10 34 54 50 47 43 11 36 57 58 21 55 44 45 39 19 10 43 47 63 61 42 32 20 48 21 45 31 57 53 51 39 37 24 56 17 49 59 34 62 58 55 27 45 61 35 47 59 54 26 43 23 48 20 21 34 51 56 5 13 53 56 54 54 53 47 35 13 50 55 30 53 49 33 31 63 43 59 55 14 47 15 24 39 28 56...

output:

113209086
833768309
445991310
556139015
898449322
395681434
939915504
372301378
683396122
105741269
737587853
755542807
574858869
834163747
884352687
790640695
886494430
815888577
696888977
262307754
227976454
236279765
549157567
821861211
337605994
469475960
321666990
411461665
570392936
629650248
...

result:

ok 1927 lines

Test #36:

score: 0
Accepted
time: 229ms
memory: 15700kb

input:

2032 200000
47 45 53 50 51 55 63 50 52 47 29 60 32 44 37 61 65 62 39 30 53 33 23 62 56 57 59 44 45 9 63 47 54 33 39 59 31 49 45 23 57 58 47 46 27 30 55 64 21 13 44 55 55 55 7 60 62 54 60 64 52 34 36 29 55 38 25 12 64 44 18 46 57 44 47 16 45 21 42 47 53 41 39 60 49 62 61 18 19 12 37 51 50 62 14 61 59...

output:

405875945
44106826
573364854
561016491
486939391
463341587
548927691
54792645
618144616
377217603
431352067
759319397
245021603
208445840
179978239
124207361
258224392
118856306
124499208
885165662
978850539
545179549
669051828
727844040
850572944
567931004
114699750
801115123
142565459
83064041
894...

result:

ok 2032 lines

Test #37:

score: 0
Accepted
time: 1026ms
memory: 43264kb

input:

1606 200000
21 21 30 47 53 27 40 57 46 42 58 27 35 59 54 54 22 57 22 44 30 25 21 52 57 50 5 21 27 56 45 56 19 46 27 10 53 56 35 50 28 25 51 55 56 41 40 54 53 12 56 23 49 36 5 41 47 46 23 33 49 55 42 56 25 26 46 57 23 42 6 49 4 54 25 9 37 57 42 52 21 50 41 21 36 56 57 28 25 23 23 22 49 51 39 25 41 55...

output:

344144240
698504731
318323751
422142382
956574068
795427986
132941038
827812002
210310447
488564276
19222018
33811633
424930379
882729733
437939418
559723612
713084756
461721305
908295251
809458812
596793842
532407261
126108254
115920490
658591950
488805549
78140418
31255145
145468100
196541438
7740...

result:

ok 1606 lines

Test #38:

score: 0
Accepted
time: 310ms
memory: 19844kb

input:

2602 200000
33 46 87 27 54 45 79 69 36 73 27 76 71 61 87 73 53 61 75 58 90 86 45 51 58 58 61 50 51 33 88 71 30 84 48 81 87 86 79 36 60 49 69 45 66 86 86 65 37 76 17 75 72 76 79 19 26 32 26 39 89 77 45 83 60 21 41 87 56 60 63 48 86 67 54 89 31 54 86 66 46 74 83 25 51 49 79 16 69 74 84 91 28 55 4 40 5...

output:

585416664
550574362
733086624
497630036
330086337
17213093
772867410
684869101
853246438
904634677
917724551
445828435
141165709
782378776
625712385
328670522
506623921
528107584
859257071
106473582
112704625
692252942
625802135
818384788
537026321
68521654
363973189
367228095
342246196
385521900
23...

result:

ok 2602 lines

Test #39:

score: 0
Accepted
time: 441ms
memory: 24800kb

input:

18534 200000
7 8 4 10 12 6 6 9 8 11 5 8 6 9 2 3 3 4 4 3 13 2 12 14 14 6 6 13 2 7 14 4 3 6 1 14 2 4 11 6 1 12 11 1 1 10 13 14 10 10 9 12 7 3 14 6 1 13 3 3 4 14 13 11 6 2 9 4 13 8 1 1 14 11 11 5 1 12 13 1 11 11 10 8 4 13 10 12 9 12 11 10 4 13 9 3 8 12 14 11 8 12 1 12 10 11 12 7 13 4 5 1 12 5 2 5 11 7 ...

output:

44626038
246582623
236297640
958360466
833114028
375367409
687063105
847269377
672645663
416320060
21693190
246582623
505255896
63928937
790618705
686805881
686805881
554897457
236297640
206832353
357080151
790618705
118505994
558788292
172513752
505255896
41031500
283423855
634047146
44626038
34056...

result:

ok 18534 lines

Test #40:

score: 0
Accepted
time: 195ms
memory: 15216kb

input:

1912 200000
30 22 11 26 33 65 1 44 36 34 16 38 39 51 5 8 45 14 11 7 64 36 59 27 16 24 42 5 17 47 14 64 62 62 62 1 20 35 23 20 27 24 14 48 29 68 55 2 34 38 16 69 12 38 131676 60 36 43 55 9 9 38 33 57 65 34 17 43 60 31 62 50 6 19 37 48 38 24 64 67 37 51 34 51 20 59 7 19 25 31 66 54 13 12 40 53 16 9 22...

output:

288408153
896509842
160892278
279372722
271810808
954285045
705745024
562164434
958416188
818979499
649197204
158792093
762062893
56532681
533992061
901583568
857833464
790250206
160892278
6012672
840640581
954691184
79158960
509237258
728365570
389960743
459930632
432198630
456051187
238083183
8535...

result:

ok 1912 lines

Test #41:

score: 0
Accepted
time: 157ms
memory: 14052kb

input:

823 200000
63 39 42 46 19 53 46 61 50 38 59 35 6 6 60 3 36 6 39 35 50 16 55 27 2 43 37 37 40 1 50 20 46 35 25 40 38 55 64 56 26 54 65 3 29 50 6 28 51 19 13 43 5 17 12 32 4 18 55 6 52 33 5 63 56 40 2 48 29 10 23 40 60 56 5 65 49 47 10 47 3 64 24 21 16 37 2 28 51 56 17 47 57 49 39 45 39 36 31 63 65 9 ...

output:

588664450
141612203
115450531
867813980
583734510
335702952
180239059
633121201
707079922
973343841
956044860
744572656
273417979
44303224
54972054
372932742
744534631
69939939
102857995
844493773
367959811
256678908
55613964
789436249
423887444
939582307
298513178
106275120
257782630
211943722
4275...

result:

ok 823 lines

Test #42:

score: 0
Accepted
time: 359ms
memory: 21288kb

input:

5408 200000
43 26 43 24 36 7 36 33 21 8 34 19 41 26 1 29 49 15 18 28 41 30 31 34 15 1 13 26 31 2 18 17 29 3 1 5 14 44 34 6 38 10 43 19 21 52 16 30 23 8 48 20 3 47 50 50 31 22 31 40 6 38 38 14 23 31 34 2 38 47 4 47 4 6 52 7 42 24 19 8 31 31 40 23 2 6 22 15 37 36 6 33 14 28 13 24 21 22 32 32 39 29 35 ...

output:

629981573
272361276
809033833
647038076
733697009
851628243
664706039
82477980
170663897
945495390
529766460
776237838
603623264
592209346
623153719
320494038
682616371
945397313
97042787
441362771
298079522
396009747
393668207
801566817
370507857
623153719
115043523
437077949
753513400
495130199
96...

result:

ok 5408 lines

Test #43:

score: 0
Accepted
time: 369ms
memory: 22212kb

input:

8037 200000
8 32 3 40 23 12 1 34 9 26 37 40 32 17 17 31 41 36 16 39 18 25 27 26 17 15 7 9 15 24 37 32 31 37 17 21 43 11 40 36 11 3 27 2 18 24 6 2 37 21 22 22 27 15 38 38 30 21 9 32 36 21 30 19 4 4 19 34 9 18 21 9 14 29 26 5 24 10 16 32 43 8 21 22 26 1 21 37 38 25 23 24 39 25 38 38 41 23 12 38 24 7 1...

output:

204906024
818946855
166818860
391492958
763052
6129377
721102522
329953566
905275329
974374260
880333078
668686315
675965770
699418336
279810638
74270875
376662726
689448565
297165430
554725136
703046515
919464396
112766272
622232713
228221081
330414328
967227220
780401999
155397834
336306527
375443...

result:

ok 8037 lines

Test #44:

score: 0
Accepted
time: 153ms
memory: 50584kb

input:

200000 200000
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...

output:

204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
204199066
...

result:

ok 200000 lines

Test #45:

score: 0
Accepted
time: 212ms
memory: 40376kb

input:

133404 200000
1 1 2 1 1 2 1 1 2 1 2 1 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 2 2 2 1 1 1 1 2 1 2 2 1 1 1 1 2 2 1 2 1 2 2 1 2 1 1 2 2 2 2 1 1 1 1 1 2 1 1 2 2 1 1 2 2 1 1 2 2 1 2 2 1 1 2 1 1 1 1 1 1 1 2 2 1 2 1 2 2 1 2 2 1 1 2 2 2 1 2 1 2 1 2 1 2 2 1 2 1 2 2 1 2 1 2 2 2 1 2 2 1 1 1 1 1 2 2 1 1 2 2 2 1 2 1 1 2 ...

output:

464713314
464713314
136099311
464713314
464713314
136099311
464713314
464713314
136099311
464713314
136099311
464713314
464713314
464713314
464713314
464713314
464713314
464713314
464713314
464713314
464713314
136099311
136099311
464713314
464713314
464713314
464713314
929426628
929426628
136099311
...

result:

ok 133404 lines

Test #46:

score: 0
Accepted
time: 211ms
memory: 40236kb

input:

133330 200000
2 2 1 1 1 2 1 2 1 2 1 2 2 1 2 2 2 2 1 1 1 1 1 1 1 2 1 2 1 2 1 1 1 2 1 1 2 2 2 1 1 2 2 1 1 1 2 2 1 2 1 2 1 1 2 2 1 1 1 2 2 2 1 2 2 2 1 1 2 1 2 2 2 1 1 1 2 1 1 1 2 1 2 1 1 2 1 1 2 1 1 2 1 2 1 1 1 2 2 2 1 2 2 1 2 1 2 2 2 1 2 1 1 2 2 2 2 1 2 1 2 2 2 1 1 1 1 2 2 2 1 2 1 2 1 2 2 2 2 2 2 1 1 ...

output:

910560502
910560502
895275841
895275841
895275841
792307329
895275841
910560502
895275841
910560502
895275841
910560502
792307329
895275841
910560502
792307329
792307329
792307329
895275841
895275841
895275841
895275841
895275841
895275841
895275841
910560502
895275841
910560502
895275841
910560502
...

result:

ok 133330 lines

Test #47:

score: 0
Accepted
time: 288ms
memory: 35080kb

input:

100099 200000
3 2 3 2 3 2 3 2 2 3 1 2 1 2 2 2 3 2 2 3 2 1 2 1 3 3 1 2 3 3 3 3 1 3 2 2 1 2 2 2 2 3 2 1 1 3 3 3 3 3 2 3 1 1 1 3 3 2 2 2 3 3 1 3 2 3 3 2 3 2 2 3 1 3 2 1 2 3 2 1 1 3 2 2 3 3 2 1 1 3 1 3 3 3 2 2 2 1 2 1 3 3 1 1 1 1 3 3 1 3 1 2 1 2 3 2 2 3 3 2 2 2 1 3 2 1 3 1 1 1 1 1 1 3 3 2 1 2 3 3 2 3 1 ...

output:

482646191
846100878
637270564
846100878
482646191
92098925
637270564
92098925
92098925
637270564
545171639
846100878
545171639
92098925
92098925
92098925
482646191
846100878
846100878
637270564
92098925
545171639
92098925
545171639
559239918
482646191
545171639
846100878
482646191
637270564
48264619...

result:

ok 100099 lines

Test #48:

score: 0
Accepted
time: 260ms
memory: 34924kb

input:

100024 200000
1 3 3 2 3 3 3 1 3 1 2 1 1 3 1 1 3 1 2 1 2 2 1 2 3 1 3 3 3 1 1 1 1 1 1 2 2 3 3 1 2 1 2 1 2 3 1 1 2 2 2 3 1 2 3 3 2 2 3 1 3 3 3 2 2 1 3 1 2 3 2 1 3 2 3 3 1 2 2 3 2 2 2 3 2 2 1 3 3 2 1 1 2 1 1 3 3 1 3 3 3 3 3 2 1 1 3 2 2 2 1 3 1 3 1 3 2 2 2 2 1 2 1 2 2 3 1 1 1 2 3 3 3 2 1 3 1 1 2 2 3 3 2 ...

output:

532845328
63351097
600291631
602922199
600291631
600291631
63351097
532845328
600291631
532845328
602922199
532845328
532845328
367055380
532845328
532845328
63351097
532845328
602922199
532845328
67446303
67446303
532845328
67446303
63351097
532845328
367055380
600291631
367055380
532845328
5328453...

result:

ok 100024 lines

Test #49:

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

input:

1 200000
200000
100000

output:

638474417

result:

ok single line: '638474417'

Test #50:

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

input:

1 200000
200000
1

output:

638474417

result:

ok single line: '638474417'

Test #51:

score: 0
Accepted
time: 5ms
memory: 8468kb

input:

1 200000
200000
200000

output:

638474417

result:

ok single line: '638474417'

Test #52:

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

input:

2 200000
1 199999
1 199999

output:

434275351
204199066

result:

ok 2 lines

Test #53:

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

input:

2 131073
65536 65537
65536 65537

output:

881540891
353335435

result:

ok 2 lines

Test #54:

score: 0
Accepted
time: 48ms
memory: 13464kb

input:

2 200000
100000 100000
66000 20000

output:

773163580
863555190

result:

ok 2 lines

Test #55:

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

input:

2 193344
94654 98690
50945 26255

output:

817593875
624691123

result:

ok 2 lines

Test #56:

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

input:

2 199034
101661 97373
91355 2727

output:

424865219
794136017

result:

ok 2 lines

Test #57:

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

input:

2 193629
94588 99041
24535 59322

output:

823487257
740761396

result:

ok 2 lines

Test #58:

score: 0
Accepted
time: 52ms
memory: 13216kb

input:

2 192376
93519 98857
76840 3735

output:

528155714
822910917

result:

ok 2 lines

Test #59:

score: 0
Accepted
time: 52ms
memory: 14368kb

input:

2 199038
97061 101977
88669 40486

output:

324403345
351551499

result:

ok 2 lines

Test #60:

score: 0
Accepted
time: 31ms
memory: 10556kb

input:

3 191067
100589 66335 24143
17387 19376 20824

output:

27674455
387236745
492977113

result:

ok 3 lines

Test #61:

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

input:

3 197723
96315 42662 58746
5067 16755 27912

output:

428677172
615379554
650548052

result:

ok 3 lines

Test #62:

score: 0
Accepted
time: 49ms
memory: 11280kb

input:

3 190415
62366 107061 20988
44325 20571 16859

output:

200832533
145375059
60746761

result:

ok 3 lines

Test #63:

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

input:

3 194262
102227 49278 42757
18014 11381 28473

output:

304208651
390414532
135154471

result:

ok 3 lines

Test #64:

score: 0
Accepted
time: 70ms
memory: 14132kb

input:

3 194230
101386 37118 55726
74537 33179 10957

output:

716754680
769124178
699898344

result:

ok 3 lines

Test #65:

score: 0
Accepted
time: 452ms
memory: 23920kb

input:

213 182154
87 78 25 67 24 44 14 56 14 76 97 42 2 75 43 85 78 85 45 86 10 6 35 57 59 32 65 63 100 61 11 14 41 47 9 70 69 5 70 9 23 62 14 83050 78 99 86 98 26 29 73 82 28 84 90 79 47 17 27 83 3 15 12 18 50 8 32 9 19 68 38 4 98 53 45 94 1 63 36 89 38 4 35 31 44 81 89 12 54 15 44 37 15 4 69 29 8 9 99 35...

output:

797610566
523553856
645441117
166945523
301040433
997693234
508090002
796059132
150069830
90846112
650480249
967877007
315716098
918752814
125479463
324254080
228585204
299522332
647590116
153067457
372499539
947148294
123209813
630180347
41875854
732614437
349961275
100705309
883976587
745490873
73...

result:

ok 213 lines

Test #66:

score: 0
Accepted
time: 473ms
memory: 25672kb

input:

238 187630
51 18 48 95 9 97 48 41 40 6 84 64 43 31 22 50 69 4 11 30 70 18 1 83 75 39 90 85 84 39 30 73 36 63 25 59 12 79 93 27 14 31 31 73 84 95 82 61 64 51 56 99 68 22 42 100 65 27 45 58 96 3 28 2 89 87 25 72 73 72 1 22 9 72 95 50 17 84 12 87374 38 98 13 51 65 23 89 6 25 26 70 42 16 9 6 96 64 37 57...

output:

565242746
868395925
140455076
265165954
122180975
528808722
936012811
982215808
298049348
786282581
974957585
150087761
191254837
319602454
100184660
981480409
826218318
667311394
919904675
466392933
697261512
435642762
665950025
203029780
537218995
225369459
306727188
225789641
194804635
793626257
...

result:

ok 238 lines

Test #67:

score: 0
Accepted
time: 275ms
memory: 19672kb

input:

496 191858
68 39 78 54 8 37 64 45 82 54 42 69 35 7 93 6 16 69 52 13 34 15 88 99 14 30 68 27 33 1 72 47 2 29 20 68 71 43 75 12 6 74 67 4 5 66 22 1 13 59 51 34 39 7 62 20 22 13 37 48 40 39 4 33 3 73 57 15 89 21 84 27 96 12 13 45 18 44 38 42 30 8 1 99 58 19 87 29 2 33 57 5 82 33 78 24 1 51 98 41 47 13 ...

output:

586583850
825870904
350407336
601409616
328251565
448489304
261426388
423051496
923690320
601409616
410817721
546441296
222176991
767188950
61537257
683658202
651251641
75513064
309107216
729704889
569870399
828169719
577711296
782159929
426750492
589037043
989842448
786983292
539135459
452368911
39...

result:

ok 496 lines

Test #68:

score: 0
Accepted
time: 380ms
memory: 23132kb

input:

453 192143
94 4 22 18 26 2 94 93 83 5 40 82 3 57 89 11 49 65 19 34 3 100 79 14 68 96 33 79 63 1 74 28 73 86 84 22 9 92 47 19 45 57 53 74 89 30 62 15 36 72 25 75 15 2 99 31 25 55 21 56 4 35 60 85 22 58 23 37 37 51 79 73 60 6 97 27 84 56 62 34 9 46 76 7 67 70 87 22 48 81 66 68 100 72 3 80 96 79 40 23 ...

output:

366273211
674667202
225514228
535770946
967186989
863796573
44000350
109069406
760187342
116202917
167108052
342604544
109697894
489295880
344534277
115666700
966599278
845270243
882791864
882044099
568487891
873262596
836054004
687575372
387785571
241889337
449929249
428031818
684413129
854992199
9...

result:

ok 453 lines

Test #69:

score: 0
Accepted
time: 559ms
memory: 29348kb

input:

218 189271
28 19 74 17 63 85 41 64 84 2 66 48 15 77 65 53 88 62 51 50 87 59 26 59 67 98 24 46 80 23 76 48 66 63 61 65 45 13 39 57 59 1 25 19 28 75 76 76 85 71 89 87 91 20 25 79 73 70 52 64 48 32 87 70 43 25 15 59 97 69 57 50 49 61 63 10 3 7 96 52 98 1 33 75 38 74 66 52 83 17 56 10 80 51 30 3 23 27 3...

output:

404696752
300487237
831879635
877015547
547003673
73215665
154298578
311636476
892432989
864401408
917325226
575932427
781045447
258107563
161621875
431715100
959245334
437489240
641458591
407887171
382857973
416050823
984328860
716005007
165542457
594141832
465646995
483021984
251595086
870527240
9...

result:

ok 218 lines

Test #70:

score: 0
Accepted
time: 722ms
memory: 30328kb

input:

714 199852
2 177 521 229 422 319 525 10 131 209 182 548 482 97 19 341 560 106 125 327 175 151 4 102 518 3 296 225 2 368 381 578 272 50 8 259 430 471 315 251 375 169 235 473 440 116 346 343 98 197 526 286 503 347 486 141 367 166 513 17 318 231 200 3 410 220 539 265 414 514 424 618 270 413 161 233 532...

output:

762729403
559284944
41126540
277276758
768530483
193135168
378371422
89151896
283218735
178191249
878891546
547849277
548853949
529440447
887740349
924439304
990983346
708404848
425376046
583237938
475135035
401709348
21156550
674390488
10440450
644971928
95582409
411783719
762729403
655399824
98937...

result:

ok 714 lines

Test #71:

score: 0
Accepted
time: 737ms
memory: 29628kb

input:

635 199858
600 214 536 622 579 324 201 453 555 580 328 333 592 35 378 32 70 136 445 456 401 634 440 461 396 117 427 48 540 50 52 172 165 353 181 240 628 31 9 618 144 537 85 198 53 568 57 556 363 242 523 4 69 623 448 4 367 525 132 516 83 7 54 251 79 207 252 166 435 394 518 430 407 560 480 291 305 581...

output:

947589988
15415612
972154988
141739739
548550909
687144335
653351789
31365412
236923224
405092870
905729027
881391612
993210088
245263865
848345887
246600168
40753953
809524166
468587721
622271843
504935454
513137137
239520586
352059030
405473849
863188548
975869721
981677695
866284911
403764696
920...

result:

ok 635 lines

Test #72:

score: 0
Accepted
time: 780ms
memory: 30356kb

input:

921 199971
142 392 301 333 131 111 289 10 332 346 88 54 114 227 413 7 349 395 383 264 247 402 8 193 272 430 76 258 391 1 86 55 144 255 241 38 168 147 158 1 12 10 118 274 190 177 324 115 349 7 287 169 142 166 251 155 138 232 277 7 16 257 276 174 9 27 71 164 25 5 60 163 152 81 31 9 295 170 49 226 317 ...

output:

122296101
967612746
820525338
86404894
525831117
971909763
284263631
606006868
372591869
73391864
787371531
828298992
511831826
38423357
888570330
322176158
71761967
865872005
612787521
402190509
985368030
420191824
3910790
68132628
412571098
854303452
203545395
301791451
994471440
408567907
2669183...

result:

ok 921 lines

Test #73:

score: 0
Accepted
time: 756ms
memory: 30264kb

input:

869 199975
292 97 175 240 284 350 197 407 182 398 285 244 377 399 46 83 151 394 75 372 22 315 413 450 362 12 424 159 427 370 11 225 110 10 60 203 66 201 267 321 135 243 333 262 208 325 91 111 443 303 195 174 334 179 294 216 89 342 287 51 71 387 447 134 252 317 428 34 130 381 219 77 271 190 432 88 40...

output:

188837837
683253179
5618262
435982551
275957055
559805737
750281417
906865134
766311943
535039845
32699628
353645027
747681086
880654555
854114047
964523503
449679564
608879932
362587028
648324753
558938386
479751956
668733221
350678978
848494651
197844841
481298970
72572495
362029525
283944390
6728...

result:

ok 869 lines

Test #74:

score: 0
Accepted
time: 774ms
memory: 30760kb

input:

1131 199850
65 114 71 96 275 321 346 245 105 101 123 209 53 38 127 162 227 358 128 141 181 177 166 33 179 126 292 16 43 298 75 247 151 346 145 43 9 275 150 45 327 323 131 22 237 242 280 300 31 340 94 106 326 331 92 82 327 293 274 347 81 141 11 270 121 264 107 94 23 283 40 190 89 185 308 192 285 32 1...

output:

441903182
297476073
735257480
892715345
698316204
847609127
779495004
462200091
17708689
994771011
235499371
305049499
163481050
486104533
46967251
171590653
894444545
334864490
531056655
228263470
9584922
456068851
89860570
955196094
624547446
940998685
369770200
814969317
316586864
883591660
27939...

result:

ok 1131 lines

Test #75:

score: 0
Accepted
time: 745ms
memory: 30812kb

input:

1066 199877
174 86 267 255 252 276 54 168 196 278 224 92 331 133 305 49 353 53 37 287 313 231 288 137 194 63 196 300 139 248 150 247 244 70 93 346 134 87 251 310 336 253 172 230 288 227 208 217 181 110 170 121 239 308 13 294 60 118 56 44 270 220 338 141 57 45 79 337 152 167 10 86 46 349 188 131 216 ...

output:

31689418
733455413
439461859
504479576
502779390
693717154
491085173
119074294
5459541
543908977
704537449
985670113
279355662
960113349
176117010
719878441
980191328
918912597
293076177
481559854
828768611
950205584
860910085
58354560
375260135
470577371
844488366
139752732
111521638
422472692
3312...

result:

ok 1066 lines