QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#332308#3512. Reconstruction Projecthyforces 100 ✓762ms30124kbC++203.4kb2024-02-19 13:46:242024-02-19 13:46:25

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 3
Accepted

Test #1:

score: 3
Accepted
time: 1ms
memory: 3552kb

input:

17 16
5 9 820602362
12 15 661990359
3 7 465108516
4 8 964098009
10 15 316300031
12 17 549569610
2 11 5561636
11 17 531702040
12 14 596238403
3 8 99998311
12 16 567521418
13 17 568567387
9 10 848887843
3 17 836109052
6 9 847560030
1 11 624968387
10
1
2
333848741
633676456
788710914
847560031
86778526...

output:

9304783378
9304783362
5122576028
3188417740
4061996682
4491908682
4772406292
4795070710
5985710860
6695216606

result:

ok 10 lines

Test #2:

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

input:

16 16
5 16 385187818
6 14 411864724
3 7 164852293
2 12 391354169
2 7 435228973
6 11 854416534
4 12 439212614
5 14 695173104
10 16 927828676
8 9 131189828
5 15 767947284
1 16 838820882
8 11 610182376
4 13 30523087
10 11 138075469
2 8 831552303
10
1
164852294
517997627
532952074
554429523
695173103
76...

output:

7125581443
5042334046
3624596389
3669459727
3690937176
4001662210
4359738758
4810768246
6002095475
7084665335

result:

ok 10 lines

Test #3:

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

input:

10 16
4 6 1715825
3 6 109231030
6 9 716769352
5 8 412716385
5 8 979973270
2 3 291988117
7 8 881704066
2 10 98717471
6 8 319644386
4 7 321137677
4 9 892916245
3 5 387359451
5 10 422285579
1 4 292221410
3 7 719430921
2 3 963601808
10
1
260501526
260973709
319644386
321137677
589670864
691953995
696344...

output:

2538784710
1337951487
1335590569
1035054320
1033561029
1937201588
2034107346
2029716514
1983547454
2809959672

result:

ok 10 lines

Test #4:

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

input:

10 16
3 5 660000033
1 9 80000004
3 7 880000044
1 3 680000034
7 10 840000042
4 6 340000017
2 8 740000037
4 10 960000048
4 10 840000042
4 9 60000003
2 6 240000012
2 8 900000045
2 4 840000042
3 10 280000014
3 9 860000043
1 4 80000004
10
1
2
70000005
285574359
433690934
460000024
880000043
900000046
960...

output:

3920000187
3920000178
3310000152
2294425770
2333691029
2360000117
1120000051
1260000070
1680000077
2039999652

result:

ok 10 lines

Test #5:

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

input:

10 16
6 10 600000003
2 10 600000003
1 8 800000004
6 8 200000001
5 7 400000002
4 7 600000003
1 5 600000003
6 9 200000001
1 6 800000004
3 6 200000001
2 9 600000003
3 7 600000003
1 4 400000002
3 4 400000002
3 9 400000002
1 9 600000003
10
1
200000000
200000001
258929658
300000003
400000002
500000002
600...

output:

3600000009
1800000018
1800000009
1623211038
1500000000
1000000005
1100000005
400000002
1100000013
3399999972

result:

ok 10 lines

Test #6:

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

input:

5 16
1 2 31981305
1 5 201970624
2 5 603079673
3 4 275035114
1 2 951858119
1 3 280299948
2 5 796300945
1 5 569272101
4 5 887527441
4 5 967571752
1 4 111081214
1 4 809262988
4 5 211145676
2 3 444489247
2 4 200255458
4 5 998931478
10
1
111081213
161113445
280299949
718427710
728399770
809262987
8884721...

output:

620068253
333943221
243953092
154463600
591802585
591802585
456000237
587522697
791184078
795458168

result:

ok 10 lines

Test #7:

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

input:

5 16
2 5 600000030
4 5 800000040
2 5 480000024
1 3 820000041
1 5 820000041
1 5 180000009
2 3 580000029
4 5 240000012
4 5 20000001
1 4 340000017
1 4 640000032
2 3 700000035
1 2 160000008
1 2 440000022
3 4 640000032
1 2 580000029
10
1
300000015
440000021
490000026
510000026
510000027
610000031
7000000...

output:

940000043
520000026
280000016
300000015
300000014
300000012
100000005
220000011
140000007
859999843

result:

ok 10 lines

Test #8:

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

input:

5 16
2 5 300000003
1 5 300000003
2 5 800000008
1 3 300000003
4 5 700000007
1 5 600000006
3 5 500000005
1 5 500000005
2 4 900000009
1 3 500000005
1 5 400000004
4 5 600000006
4 5 300000003
1 3 600000006
1 5 800000008
1 4 100000001
10
1
300000003
300000004
450000004
500000005
589718792
650000008
800000...

output:

1000000006
0
4
400000003
300000003
241124858
300000003
300000003
300000003
899999969

result:

ok 10 lines

Test #9:

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

input:

8 16
2 7 430153138
2 7 893943464
2 8 833214512
4 6 163329985
3 4 233465756
3 8 38550411
5 6 743080156
1 4 209244193
7 8 39355439
2 4 172712848
3 5 206923229
1 8 304802566
2 7 735760552
4 7 135794118
1 3 478575480
2 7 46576406
10
1
2
46576407
172079002
172079004
206923228
735760552
814852009
89394346...

output:

839773774
839773767
544232862
311787482
311787477
275675565
1824048741
2204866816
2563599092
3305994837

result:

ok 10 lines

Test #10:

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

input:

2 1
1 2 278662220
1
610849757

output:

332187537

result:

ok single line: '332187537'

Test #11:

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

input:

2 16
1 2 237501112
1 2 564567289
1 2 329296846
1 2 952470985
1 2 972711062
1 2 411395464
1 2 210108505
1 2 217165898
1 2 303328173
1 2 504024991
1 2 918271145
1 2 632918108
1 2 10176179
1 2 158236886
1 2 624543444
1 2 976983490
10
7383337
70147274
216298255
336767816
740624528
771674531
847683012
86...

output:

2792842
59971095
867643
7470970
107706420
138756423
70588133
56121512
3543354
7950058

result:

ok 10 lines

Test #12:

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

input:

3 16
2 3 210630828
1 2 152719204
1 2 402081257
2 3 805101370
1 2 874200158
1 2 391606075
1 3 804321134
1 3 310682240
2 3 317739758
2 3 935231200
1 2 829221559
2 3 643729043
2 3 249369292
1 2 623283269
2 3 580337501
1 3 670599143
10
170566289
206880066
416731381
510774556
627449502
732096095
81031516...

output:

57911624
57911624
113641747
178256244
20445774
134502227
11207820
61031042
61031042
61031042

result:

ok 10 lines

Test #13:

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

input:

8 16
2 6 465502226
6 8 598166389
2 4 220729449
1 7 632507213
2 8 840878527
4 8 30774662
3 5 143649517
5 7 371011445
5 7 825955168
2 6 418428537
5 8 616793598
6 8 55814957
4 8 601368209
2 5 567195487
3 4 243014261
6 8 623632297
10
531671881
596690226
738441421
783890680
799395835
841474431
867425830
...

output:

788037485
670923990
1164842380
1301190157
1347705622
1506171744
1687831537
1850009364
1998464167
2498242068

result:

ok 10 lines

Test #14:

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

input:

8 16
5 6 649024859
2 3 440921114
1 3 205592537
2 3 262926962
2 8 170294743
4 5 486465021
7 8 329142807
2 7 487898682
1 6 956362526
4 7 630059396
1 2 817210556
6 8 927818663
6 7 895733279
2 8 966123901
4 6 617537793
1 8 509675622
10
27079475
34044140
121757839
128818569
142596878
169347841
175657430
...

output:

2512462934
2463710279
1849714386
1800289276
1703841113
1516584372
1483142623
1161418639
1143970702
961244421

result:

ok 10 lines

Test #15:

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

input:

8 16
2 5 1000000000
4 7 1000000000
2 8 1000000000
3 7 1000000000
5 6 1000000000
1 8 1000000000
3 4 1000000000
2 7 1000000000
1 2 1000000000
1 4 1000000000
2 6 1000000000
1 7 1000000000
5 7 1000000000
1 3 1000000000
1 6 1000000000
4 6 1000000000
10
1
135088580
307609158
603076651
650195021
669669538
...

output:

6999999993
6054379940
4846735894
2778463443
2448634853
2312313234
1775243869
1530171622
1325082087
531127310

result:

ok 10 lines

Test #16:

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

input:

8 16
1 6 532189510
3 8 898315167
4 7 327455852
1 2 906170185
2 8 960938761
6 8 897861726
2 4 453174432
4 5 152336150
5 7 206792331
1 7 11239617
2 4 165077825
6 7 563405317
3 5 485328950
3 8 356696843
1 5 342050537
1 4 438047406
10
500000001
500000003
500000004
500000005
500000011
500000012
500000013...

output:

520296662
520296668
520296671
520296674
520296692
520296695
520296698
520296701
520296710
520296716

result:

ok 10 lines

Subtask #2:

score: 4
Accepted

Dependency #1:

100%
Accepted

Test #17:

score: 4
Accepted
time: 247ms
memory: 12660kb

input:

500 100000
164 445 138720432
237 298 729987741
330 344 827132429
168 222 315723325
174 300 942084628
351 450 533923668
191 408 214586307
36 455 340245048
369 468 909213801
125 186 496349094
45 107 850096704
208 285 33790732
72 81 882721202
167 475 585387953
269 454 291608851
339 463 941177913
336 41...

output:

1496372164
656914893
730528938
815895919
755635308
799362238
689904162
766959060
676756449
1488838218

result:

ok 10 lines

Test #18:

score: 0
Accepted
time: 164ms
memory: 12392kb

input:

500 100000
264 364 93824845
287 496 33011968
86 431 220481554
174 428 612332828
110 368 371456554
173 472 621827026
187 432 636297294
244 278 956915836
140 386 75391843
116 307 675120056
159 462 833366390
288 304 260869578
486 497 654054
31 352 584152771
189 259 763567981
2 98 687031483
176 406 8317...

output:

28843919909
22123162366
22037780984
20105108858
14577053456
14863743416
15410142438
17252256366
22861706887
26949037643

result:

ok 10 lines

Test #19:

score: 0
Accepted
time: 208ms
memory: 11656kb

input:

500 100000
195 373 634355931
29 461 424397809
462 492 656219416
203 359 819494693
15 140 162741679
188 412 54667054
319 360 554457938
227 341 989182826
132 243 53563986
183 348 498007907
70 144 611338587
201 430 897793890
250 264 365649969
31 67 699798332
341 483 471910547
153 164 609195547
301 306 ...

output:

8295706016
3963954342
4221994501
3851488551
3823412505
4008298372
3366473959
3784443062
3809047508
6584432849

result:

ok 10 lines

Test #20:

score: 0
Accepted
time: 210ms
memory: 12440kb

input:

500 100000
373 430 457876957
250 291 456062556
84 320 245278135
109 477 591597027
144 321 972369869
212 376 533768001
328 402 589109799
153 199 721208784
125 403 197467902
26 115 125982237
245 413 437342650
31 163 900420706
63 239 931605911
15 211 927536175
210 271 167525990
216 363 117626426
41 313...

output:

2746612077
1453674859
1377894754
1296644842
1330461030
1348014856
1372421351
1402300449
1356405523
2843692394

result:

ok 10 lines

Test #21:

score: 0
Accepted
time: 213ms
memory: 12528kb

input:

500 100000
11 368 406104887
51 323 589936836
65 494 847260159
129 157 156249739
90 432 537898956
386 448 448959633
13 430 447148080
126 146 177275595
207 285 584989170
200 411 522546393
48 102 736622824
293 381 723765118
235 302 692883411
50 206 297877067
103 355 534235401
16 273 981143327
305 445 8...

output:

1923685261
959817237
996240111
992320665
931025041
895947711
964590750
899138570
900967400
1934746021

result:

ok 10 lines

Test #22:

score: 0
Accepted
time: 249ms
memory: 13340kb

input:

500 100000
206 482 761387004
27 471 666540115
272 431 406589468
253 345 973472585
62 454 929046671
128 464 170336535
239 341 998187363
228 246 673297273
382 431 868090994
33 493 487452465
50 138 888754863
73 161 106152827
56 365 912376268
361 473 116061360
4 245 808558488
43 219 988589141
243 469 97...

output:

1737523651
864221360
866204412
862509933
830400608
861316227
869922833
889810140
791199942
1737681758

result:

ok 10 lines

Test #23:

score: 0
Accepted
time: 251ms
memory: 11780kb

input:

500 100000
17 168 555144074
267 303 78086771
54 462 931418598
325 451 869740697
80 461 927306159
220 401 261526848
257 304 805227941
301 327 480893221
133 334 877240164
91 353 530173239
17 343 584247318
95 336 859607698
42 435 243440486
379 499 475187938
181 322 152925400
78 456 813888773
74 131 126...

output:

1527230003
774925022
784398293
854127739
788079342
819267266
770037699
768520081
754766491
1550106305

result:

ok 10 lines

Test #24:

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

input:

500 100000
275 447 292555263
93 474 73664591
54 400 860506647
271 304 84698614
263 324 970364395
196 311 291361070
418 474 821073253
255 312 586632046
163 176 576619043
316 496 892539648
191 217 937653717
317 329 978123146
343 385 534489956
2 459 150697547
140 238 646481836
177 299 30226196
448 478 ...

output:

1600919822
743981227
686178965
686396188
707440268
738432695
725029304
775587838
769765360
1538612577

result:

ok 10 lines

Test #25:

score: 0
Accepted
time: 244ms
memory: 12448kb

input:

500 100000
302 352 918000918
195 199 592000592
211 263 176000176
243 477 671000671
80 265 12000012
47 458 992000992
77 319 836000836
27 458 463000463
34 363 987000987
135 364 681000681
37 144 117000117
11 44 624000624
381 402 527000527
166 468 707000707
369 494 296000296
85 379 969000969
463 493 566...

output:

1688001189
810565728
710000781
731500631
768000768
714000775
719500655
680000755
748500720
1693502694

result:

ok 10 lines

Test #26:

score: 0
Accepted
time: 235ms
memory: 13276kb

input:

500 100000
22 341 800000008
118 288 500000005
212 319 600000006
427 494 900000009
242 325 400000004
260 418 400000004
310 330 300000003
128 354 600000006
27 424 400000004
18 296 500000005
55 149 800000008
224 362 100000001
34 114 900000009
92 258 800000008
315 463 200000002
350 400 600000006
237 273...

output:

49900000000
42496639893
499
24950000000
24950000000
24949999501
4604301942
12177997695
24950000000
49899995509

result:

ok 10 lines

Test #27:

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

input:

500 100000
68 335 692038474
33 284 844428357
119 137 54251993
178 266 184221133
121 311 406705479
417 487 950788589
154 193 115483171
61 325 255682953
241 370 692147226
106 261 29474912
12 192 323543731
448 449 399614487
132 240 130411555
151 283 364344301
293 490 8794798
198 410 278902047
273 298 7...

output:

757752292
717194658
704067788
772726816
759960270
752413531
759631031
720663003
726264653
707981453

result:

ok 10 lines

Test #28:

score: 0
Accepted
time: 253ms
memory: 12448kb

input:

500 100000
256 290 701132765
20 321 887584014
119 381 90681296
34 335 350746492
395 446 652677405
71 449 417444809
91 302 939701487
219 388 741199546
43 395 341088515
316 388 417446944
159 382 727174739
112 227 29804852
25 88 346805446
67 212 181040336
69 173 63781567
52 166 920986331
89 254 5509531...

output:

803046578
773447494
745943205
795572841
691416455
750817767
768983210
718809321
834645927
769848106

result:

ok 10 lines

Test #29:

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

input:

500 100000
78 253 445611
4 13 988315265
122 310 477230561
221 381 453108774
174 498 407378145
73 351 838759990
400 421 481072105
72 197 647703136
53 231 997448067
43 455 308208452
14 39 827255066
44 347 906170538
32 254 72339318
162 224 633667910
269 444 781938926
120 200 563995626
214 238 320562815...

output:

775673379
790623808
710873050
732976410
776287458
774325127
755310133
706549639
799161141
800267543

result:

ok 10 lines

Test #30:

score: 0
Accepted
time: 255ms
memory: 11912kb

input:

500 100000
181 495 235483804
322 335 186454421
309 455 328037772
281 335 426600923
115 175 823810750
408 431 478633678
197 488 657508344
23 278 517680268
202 366 367091380
103 184 752068035
118 262 430638353
138 371 251287271
86 138 160680002
50 149 710507074
162 379 490033169
332 343 544354219
124 ...

output:

756028579
791102776
741586271
734951498
774838728
749027015
783371160
790989397
756553167
740096820

result:

ok 10 lines

Test #31:

score: 0
Accepted
time: 230ms
memory: 13264kb

input:

500 100000
116 256 1000000000
167 206 1000000000
61 480 1000000000
125 254 1000000000
45 299 1000000000
195 215 1000000000
326 449 1000000000
270 444 1000000000
161 417 1000000000
228 364 1000000000
246 479 1000000000
80 340 1000000000
24 419 1000000000
77 264 1000000000
129 281 1000000000
276 401 1...

output:

498999999501
433136491499
400975255374
378477514527
320702969179
306870359340
303902849753
108678578258
98377982734
45266645280

result:

ok 10 lines

Test #32:

score: 0
Accepted
time: 253ms
memory: 12768kb

input:

500 100000
102 126 950426660
143 390 252766936
74 465 864055175
337 409 61451940
94 119 206515041
142 238 630788668
85 314 862241909
352 463 750651976
109 284 142804178
20 228 735157136
41 368 520239902
203 232 577731818
104 206 498862611
266 325 161649723
305 410 236342495
129 218 221543445
259 484...

output:

763982229
763982168
763981924
763981863
763981802
763981741
763981619
763981375
763981314
763981253

result:

ok 10 lines

Subtask #3:

score: 7
Accepted

Test #33:

score: 7
Accepted
time: 689ms
memory: 29864kb

input:

500 100000
367 368 954588401
353 354 625632578
140 141 660306284
456 457 2495669
53 54 680065921
343 344 901272496
387 388 236961915
108 109 518176428
148 149 500091031
431 432 243077810
204 205 905598941
447 448 509663878
243 244 526532179
465 466 353873370
150 151 146093752
437 438 164250881
106 1...

output:

2600140186
2598726519
2597797880
2597783409
2597564348
2597258461
2596154174
2595806870
2594842802
2594761964
2594146198
2593000993
2592937620
2592513969
2591170661
2591170162
2591169665
2589954500
2589954003
2589953508
2589560478
2588488803
2588216058
2587116168
2585801943
2585497023
2585282193
258...

result:

ok 1000000 lines

Test #34:

score: 0
Accepted
time: 727ms
memory: 29656kb

input:

500 100000
196 197 816137483
330 331 74907753
143 144 953056680
495 496 131320676
220 221 114592544
96 97 204000290
43 44 217333696
349 350 352447007
149 150 320966403
375 376 165026340
36 37 976553197
192 193 390846168
233 234 831273394
254 255 189593339
309 310 171820816
416 417 446446174
322 323 ...

output:

2447693424
2446617580
2446616584
2445057495
2443597806
2443499897
2443204679
2443204182
2443203687
2442931437
2442428517
2442084987
2441873622
2441323677
2441322689
2440617206
2439321602
2439262935
2439262442
2439261951
2436240337
2436225116
2436224625
2436224136
2436155187
2435113128
2433499428
243...

result:

ok 1000000 lines

Test #35:

score: 0
Accepted
time: 671ms
memory: 30124kb

input:

500 100000
162 163 811133093
298 299 788679484
178 179 813102299
246 247 738152350
158 159 931046952
232 233 727747271
47 48 402910158
424 425 610973763
316 317 155744554
50 51 282465215
463 464 430780688
307 308 464158937
420 421 499792474
5 6 579975486
367 368 540141740
59 60 976807316
165 166 867...

output:

2441215437
2441002863
2440364143
2439935502
2439935003
2439934506
2439198449
2439197952
2439197457
2436944712
2436931347
2434598907
2434369722
2434369227
2434368734
2433805728
2432765991
2432765500
2432512635
2432265662
2430650763
2430409682
2429532756
2429320153
2429080054
2428853212
2428133406
242...

result:

ok 1000000 lines

Test #36:

score: 0
Accepted
time: 522ms
memory: 29552kb

input:

500 100000
467 468 865684627
418 419 957819554
190 191 858700950
388 389 74327251
274 275 754632244
58 59 245954395
37 38 51715883
326 327 331707321
203 204 117454812
37 38 182995665
337 338 417357536
325 326 839343163
311 312 520088387
420 421 782331857
33 34 501988693
226 227 68622796
37 38 776940...

output:

204076787842
204075621679
204075107210
204074251924
204074187553
204073488454
204071113214
204070918604
204070809323
204070612717
204069965514
204068876696
204068219513
204067050855
204066189581
204065145174
204065064835
204063866237
204063468035
204062835303
204062163649
204061638202
204060087809
2...

result:

ok 1000000 lines

Test #37:

score: 0
Accepted
time: 558ms
memory: 29732kb

input:

500 100000
384 385 11672649
179 180 186786387
62 63 586066691
468 469 953119177
285 286 422580655
384 385 534436401
179 180 687217715
318 319 502505803
19 20 242207167
422 423 800573260
384 385 43373577
205 206 222708775
173 174 940861080
422 423 63294086
376 377 44046077
318 319 20431945
288 289 36...

output:

242241551750
242240634089
242240425507
242240293272
242238712939
242238641083
242238640584
242238640087
242238224595
242238224098
242238223603
242237224198
242236483678
242236453978
242236189648
242236189153
242236188656
242235635495
242235373079
242234931743
242234931246
242234930751
242234149641
2...

result:

ok 1000000 lines

Test #38:

score: 0
Accepted
time: 556ms
memory: 30044kb

input:

500 100000
200 201 639361595
200 201 153368535
200 201 522924278
200 201 551952114
200 201 881590037
200 201 18640424
200 201 177077553
200 201 88377909
200 201 854983263
200 201 693212945
200 201 578312422
200 201 747716190
200 201 886227716
200 201 892672257
200 201 750943792
200 201 914267324
200...

output:

247825295142
247823987263
247823783671
247822994253
247821948349
247820418415
247820070113
247819866521
247819866022
247819865525
247819791969
247819791472
247819790974
247819716623
247819716124
247819715627
247819314548
247817841937
247816616335
247816330063
247815581581
247815230699
247815230202
2...

result:

ok 1000000 lines

Test #39:

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

input:

500 100000
21 22 873151462
378 379 612026195
162 163 989212777
76 77 751915328
303 304 185565429
233 234 457853145
177 178 673457611
246 247 159319381
390 391 571398009
151 152 72939756
449 450 813592677
283 284 700587252
469 470 544983023
34 35 848404352
102 103 791439667
22 23 603504097
183 184 66...

output:

1638879180
1638879339
1638879657
1638880134
1638880293
1638880611
1638880770
1638880929
1638881088
1638881724
1638882360
1638882837
1638882996
1638883473
1638883632
1638883950
1638884427
1638884586
1638884745
1638885063
1638885222
1638886017
1638886335
1638886971
1638887130
1638887289
1638887448
163...

result:

ok 1000000 lines

Test #40:

score: 0
Accepted
time: 556ms
memory: 30064kb

input:

500 100000
82 83 193002933
9 10 896363780
281 282 485833581
179 180 890298617
76 77 167348080
230 231 636294898
351 352 53963089
170 171 471103993
373 374 244513016
281 282 706560414
395 396 150340040
275 276 247269971
138 139 21586679
135 136 853674721
170 171 370243234
257 258 658671459
312 313 42...

output:

115419843913
115419843907
115419843904
115419843898
115419843886
115419843874
115419843868
115419843865
115419843862
115419843856
115419843853
115419843844
115419843835
115419843829
115419843817
115419843811
115419843805
115419843796
115419843790
115419843784
115419843781
115419843775
115419843766
1...

result:

ok 1000000 lines

Subtask #4:

score: 28
Accepted

Dependency #1:

100%
Accepted

Test #41:

score: 28
Accepted
time: 483ms
memory: 18960kb

input:

500 1000
209 235 114595071
37 159 33706736
16 51 13680529
65 384 492798862
300 496 841778336
323 463 304849034
16 428 570397139
242 243 613760180
288 442 539699078
256 485 759965677
210 445 772907647
322 439 659704597
8 56 255604344
350 458 356371421
298 413 909180692
119 218 261315865
203 309 49043...

output:

136802636796
136802636297
136802200670
136801497579
136801014547
136800957661
136800658760
136800338402
136800306466
136800193193
136799895290
136799789003
136799624832
136799035513
136798900284
136798897789
136798500086
136797792005
136797619351
136796927737
136796013070
136796008080
136795844907
1...

result:

ok 1000000 lines

Test #42:

score: 0
Accepted
time: 484ms
memory: 19028kb

input:

500 1000
332 367 685432643
274 349 641986775
423 459 995724963
157 389 796220846
106 199 433560609
128 393 496907563
74 75 930504317
227 443 190889072
102 293 287248000
10 187 492110233
7 249 708066102
31 203 305276989
128 393 136195528
260 413 292839457
339 353 478997750
158 490 147822163
286 408 9...

output:

156132210273
156132209774
156132180333
156131495206
156130756187
156130025651
156129678347
156128689828
156128386935
156128283143
156127905400
156127805600
156127538136
156127523166
156127473765
156127332548
156127103507
156126465785
156126406903
156126132952
156126110497
156125204313
156124877468
1...

result:

ok 1000000 lines

Test #43:

score: 0
Accepted
time: 463ms
memory: 18972kb

input:

500 1000
188 414 343097994
314 428 425264188
228 415 362022396
146 216 660866257
265 279 956709014
442 445 467528083
268 284 16474792
64 210 528941665
6 454 995563830
204 292 400636777
109 407 384711869
124 136 741992895
326 403 993119905
88 464 584447741
144 296 808341990
27 104 516221313
224 404 8...

output:

138166099742
138166099243
138166095750
138166072796
138165680083
138165575792
138165151143
138164029890
138163087279
138162472511
138162253949
138162246963
138161167626
138161080800
138160635692
138160523417
138159954557
138157935104
138157747979
138157558858
138156690598
138156595788
138156313354
1...

result:

ok 1000000 lines

Test #44:

score: 0
Accepted
time: 451ms
memory: 18980kb

input:

500 1000
89 494 631110470
46 103 163992813
11 347 718751934
379 429 199761658
251 452 239100688
20 149 982449837
34 73 580397746
68 408 450245814
359 475 979112088
123 276 427827816
143 210 145411329
58 71 380343913
17 116 476883725
315 385 893372370
75 450 164844129
301 409 916190801
369 403 735835...

output:

146045611870
146045611371
146045507579
146045417759
146045319955
146044762073
146044161277
146043659782
146042935733
146041884340
146041316977
146041001609
146040574465
146040207201
146038868384
146038617886
146037718688
146037527072
146037448729
146035944743
146035261113
146034681774
146034154331
1...

result:

ok 1000000 lines

Test #45:

score: 0
Accepted
time: 476ms
memory: 19036kb

input:

500 1000
372 469 487976737
115 126 61180924
14 403 32716263
69 350 48479583
48 484 429212239
190 403 207503486
66 313 76747973
154 303 66085909
150 395 422396487
293 428 882954449
346 352 725301209
355 435 920573758
202 398 691114470
221 497 718250066
265 381 521783558
43 90 481752592
60 99 52713990...

output:

137660666428
137660665929
137659676911
137658755258
137658170430
137657444884
137656780216
137656698380
137656274729
137656118542
137655810659
137654621542
137653688911
137653326637
137652890012
137652818156
137652791210
137652699893
137652030734
137651807681
137651235827
137651234829
137650842615
1...

result:

ok 1000000 lines

Test #46:

score: 0
Accepted
time: 440ms
memory: 18984kb

input:

500 1000
419 421 597728131
58 97 381631250
380 496 135865730
14 226 273906633
351 446 219575356
359 368 14679665
392 494 691991300
245 395 937235299
158 236 106831725
176 481 644382739
20 260 209933724
165 422 139148009
150 331 299449150
216 292 335595260
66 125 626391766
413 448 798554757
248 320 1...

output:

141089534087
141089533588
141089109438
141088579001
141088500159
141088237685
141087511640
141087187290
141086760146
141086735695
141085228715
141083652873
141083377924
141082421840
141081168851
141079516662
141079235725
141078652893
141078458283
141078012177
141077901898
141077871958
141077832038
1...

result:

ok 1000000 lines

Test #47:

score: 0
Accepted
time: 458ms
memory: 19036kb

input:

500 1000
110 204 528000528
3 356 922000922
77 304 140000140
16 276 535000535
192 263 966000966
95 440 276000276
140 220 283000283
58 405 608000608
397 491 367000367
34 461 512000512
171 448 217000217
257 481 540000540
56 498 326000326
253 459 556000556
355 423 368000368
147 213 167000167
123 244 435...

output:

146415145916
146415145417
146415072563
146414797115
146414555599
146413924364
146413922867
146413810592
146413805103
146413069078
146412767682
146412750716
146412724768
146411995230
146411824073
146411357508
146411264694
146411178866
146410974775
146410166395
146409878971
146409764201
146409567595
1...

result:

ok 1000000 lines

Test #48:

score: 0
Accepted
time: 477ms
memory: 18996kb

input:

500 1000
63 81 800000008
116 476 200000002
193 215 300000003
110 189 400000004
141 443 600000006
273 360 200000002
129 271 100000001
160 188 500000005
67 139 200000002
16 268 300000003
37 500 700000007
38 500 500000005
39 497 900000009
20 459 400000004
79 106 200000002
208 283 100000001
77 484 10000...

output:

148100000982
148100000483
148098833322
148098721546
148098556876
148097964064
148097689115
148097495503
148096941613
148096286925
148095377248
148095236031
148095025453
148094249009
148093010491
148092849314
148090820879
148090099325
148090063397
148089984555
148089394238
148088700129
148087752029
1...

result:

ok 1000000 lines

Test #49:

score: 0
Accepted
time: 459ms
memory: 18992kb

input:

500 1000
294 325 575599037
364 366 362031317
255 343 175846087
48 206 299586510
88 104 928724327
324 475 121234673
455 490 744454734
128 383 575996751
160 472 926891220
16 349 228345853
97 300 996556348
310 370 80343619
15 278 897403925
434 465 710650741
218 275 610147342
259 345 896934678
196 277 1...

output:

135538494480
135537802866
135537473526
135537310852
135536303371
135535320341
135534068849
135533620747
135533417654
135532892706
135532296900
135532262469
135532129236
135531995005
135531551394
135531548899
135531510975
135530347806
135530150202
135530121759
135530103795
135529993516
135528979049
1...

result:

ok 1000000 lines

Test #50:

score: 0
Accepted
time: 484ms
memory: 19060kb

input:

500 1000
86 146 995598661
40 230 857463813
192 387 335410169
78 93 914623197
78 466 329332055
27 470 303218172
252 329 252997353
274 475 717654213
106 172 500264623
241 346 609079157
130 414 421360985
64 458 988560198
125 481 187374873
161 331 872651480
14 185 213985336
81 276 505911076
390 484 4365...

output:

141301671424
141301016736
141299900473
141299178919
141298925427
141298387006
141297244795
141296697392
141296623540
141296253282
141296014760
141295877036
141295834621
141294911970
141294668957
141294364567
141294315166
141294093111
141293712873
141293529241
141293504790
141293005790
141292838625
1...

result:

ok 1000000 lines

Test #51:

score: 0
Accepted
time: 459ms
memory: 18932kb

input:

500 1000
65 249 416180280
80 323 859857844
386 453 325433362
315 395 963829198
164 418 496041159
178 436 682248560
2 262 415802178
280 458 737170534
299 445 560125346
146 402 275800875
359 375 701215819
317 447 599850459
78 97 813876930
238 287 621780984
151 485 70407839
10 384 63421912
325 458 7098...

output:

69746048634
69746052079
69746069720
69746076480
69746084020
69746085346
69746086308
69746090572
69746099789
69746104690
69746106965
69746107849
69746108070
69746116442
69746130469
69746138204
69746138568
69746152114
69746159563
69746165530
69746172368
69746198784
69746212083
69746225525
69746233039
...

result:

ok 1000000 lines

Test #52:

score: 0
Accepted
time: 528ms
memory: 19060kb

input:

500 1000
301 480 43971792
20 169 646534395
243 245 679925412
159 193 591739042
42 387 214820760
53 434 687700579
192 392 544067793
87 451 624451318
325 409 898177596
180 489 724968470
90 279 82248636
79 379 102251919
199 323 190877012
68 117 311375556
96 353 83987546
206 414 780078789
296 459 748338...

output:

137844172596
137844032377
137844026888
137843892657
137843791360
137843760921
137843564814
137842622702
137842497453
137842339769
137842252943
137841346759
137841338775
137840658139
137840227003
137840081295
137839991475
137839879200
137839252456
137838993974
137838516930
137838436092
137838017431
1...

result:

ok 1000000 lines

Test #53:

score: 0
Accepted
time: 463ms
memory: 18928kb

input:

500 1000
210 388 1000000000
317 383 1000000000
200 316 1000000000
140 284 1000000000
14 482 1000000000
304 491 1000000000
321 477 1000000000
210 494 1000000000
291 345 1000000000
272 417 1000000000
212 430 1000000000
145 170 1000000000
125 366 1000000000
134 382 1000000000
208 332 1000000000
104 472...

output:

498999999501
498999329344
498999122259
498999119764
498998452102
498998322362
498997434641
498997369771
498997056898
498996243528
498994854811
498994277468
498994238047
498993844336
498993197632
498992852823
498991120794
498991015006
498990824388
498990405727
498989532477
498989479084
498989238566
4...

result:

ok 1000000 lines

Test #54:

score: 0
Accepted
time: 504ms
memory: 19016kb

input:

500 1000
137 353 996121209
145 412 729914386
190 333 184670581
266 372 380617048
266 337 398606147
319 395 794352131
262 443 496327255
88 90 952373704
163 353 548983482
159 335 739847705
178 368 571946359
96 428 298486461
87 484 184687464
351 357 932698238
221 246 325866294
195 352 622692530
55 268 ...

output:

69781269439
69781269390
69781269383
69781269369
69781269355
69781269341
69781269334
69781269306
69781269299
69781269292
69781269285
69781269278
69781269264
69781269257
69781269250
69781269243
69781269229
69781269222
69781269215
69781269201
69781269194
69781269187
69781269173
69781269159
69781269152
...

result:

ok 1000000 lines

Subtask #5:

score: 35
Accepted

Dependency #2:

100%
Accepted

Test #55:

score: 35
Accepted
time: 276ms
memory: 11464kb

input:

500 100000
201 305 640380488
399 412 534810919
109 293 4353546
4 40 282285675
32 262 778514990
28 275 523581321
316 493 141746644
303 382 163581791
97 153 769033264
183 432 847189327
2 424 131317355
51 378 747734166
225 435 933307810
376 481 729115472
104 376 734768869
14 201 447637708
174 431 14446...

output:

1458975536
1458975037
1390851480
1274106674
1158692902
1142124096
1123733506
1107518091
1099628357
1034882334
962300829
928536390
923459851
917465387
914618519
911706610
865181674
849718879
836816871
834041687
829221923
820928962
820884724
820082855
816085578
812880336
804333559
784180275
780208708
...

result:

ok 20000 lines

Test #56:

score: 0
Accepted
time: 175ms
memory: 11448kb

input:

500 100000
220 496 411607515
167 460 363572068
109 271 863681693
301 474 469590845
10 442 980110406
76 260 763003280
217 219 89400278
99 492 944933239
249 374 539138447
453 483 962180441
143 197 705819836
160 456 862631054
70 121 22760198
338 466 395479840
74 171 915583443
46 206 701681464
189 348 5...

output:

30810120002
30810119503
30805644372
30803507540
30771044354
30766752287
30739321879
30680721947
30673346072
30637408762
30635257078
30601330887
30589351281
30583644040
30573504827
30431367077
30389575621
30382456737
30316454014
30310270903
30290451574
30277748805
30277376855
30258913622
30252405993
...

result:

ok 20000 lines

Test #57:

score: 0
Accepted
time: 221ms
memory: 11500kb

input:

500 100000
37 92 168381839
5 27 354400745
124 272 492303229
174 458 767934987
215 307 609845909
109 142 189263303
138 160 227305620
298 351 321189759
201 437 112962607
7 402 465353862
186 430 124141165
120 124 432108899
211 303 938068862
209 453 589072551
231 362 154699341
130 444 401729024
72 159 3...

output:

7782944344
7782943845
7742933721
7700304522
7662856105
7656489805
7599131326
7565287113
7550813144
7459157577
7444492448
7415773265
7413100609
7393912773
7393001731
7390323610
7387529268
7364670575
7341778035
7278854142
7264290908
7251458779
7240875319
7219840092
7210687411
7187926651
7183893354
718...

result:

ok 20000 lines

Test #58:

score: 0
Accepted
time: 225ms
memory: 11444kb

input:

500 100000
332 471 14739668
45 187 240087328
73 194 965430396
155 480 131555153
26 133 509689548
337 461 972850496
44 475 53974105
358 388 457865225
192 265 230329534
130 253 746377986
450 494 68862361
172 455 396808034
98 149 63413794
196 491 690557845
21 270 360541749
153 300 319338172
111 240 258...

output:

2641431494
2641430995
2558931243
2540492371
2493055184
2467988849
2409628120
2392337770
2334926153
2294336339
2278610580
2229902304
2196723536
2196656762
2162001436
2162001091
2151911151
2128737626
2126795783
2126569700
2119629037
2108620882
2069598673
2066011434
2055592920
2043872900
2042984650
203...

result:

ok 20000 lines

Test #59:

score: 0
Accepted
time: 221ms
memory: 11400kb

input:

500 100000
115 215 698081108
394 422 158665087
245 246 412973189
250 306 669678288
216 323 964802669
50 358 764599102
275 288 815932292
60 306 498685245
89 239 570076903
43 104 324698612
300 440 177935162
111 263 123222144
131 476 70269789
298 373 146433404
420 490 803205779
59 449 105962310
435 479...

output:

1761986659
1761986160
1721233796
1689620400
1665964638
1657012218
1650015235
1635522601
1577004272
1568612938
1548465771
1534120792
1449307691
1426521404
1404572864
1381518346
1359341929
1339806063
1318317718
1300903283
1291685352
1262812388
1254208206
1158414100
1144211439
1141928402
1136613518
113...

result:

ok 20000 lines

Test #60:

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

input:

500 100000
160 442 302247194
48 160 429362479
127 316 524537191
140 326 874471248
84 468 918856948
420 482 797881870
113 145 899945933
118 304 900880487
304 365 775313492
250 476 907506332
69 421 391099636
14 223 749009849
214 384 367975855
315 378 474581028
116 265 150901876
196 243 860413616
68 30...

output:

1626575555
1626575056
1612902030
1576756350
1561609736
1534475892
1499039421
1478511911
1456531299
1438426811
1433856339
1367020718
1355599319
1337257379
1321432618
1299488145
1258917509
1180588849
1175276154
1168427949
1121042467
1116807893
1089334978
1086556228
1076198480
1070734522
1047347604
104...

result:

ok 20000 lines

Test #61:

score: 0
Accepted
time: 253ms
memory: 11400kb

input:

500 100000
263 382 454713960
104 461 304847878
13 115 805175492
24 459 399203342
25 124 858133469
23 295 472934607
61 435 315281191
83 500 882756677
89 370 580390412
325 402 79776880
271 326 772114862
288 354 831574672
47 322 933393848
337 365 689558573
123 432 795014284
233 340 689999079
135 321 27...

output:

1709575964
1709575465
1701105997
1653566436
1635802529
1623975613
1525428445
1420477832
1399432236
1392237697
1351975901
1323391837
1315264671
1208604448
1175199970
1146344765
1145139206
1141097068
1129682238
1122347275
1111022910
1046749018
1046103564
1043307139
1028692242
1002079259
996773246
9729...

result:

ok 20000 lines

Test #62:

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

input:

500 100000
148 286 475920445
411 491 657459803
84 141 555604049
55 460 997491495
81 105 878352475
99 221 595436842
42 90 106849743
84 178 554576022
66 314 364867503
97 121 627196570
311 448 141190049
47 365 567476910
375 447 615275661
129 136 794988194
223 473 329944615
194 481 49983934
358 461 7595...

output:

1453646696
1453646197
1445181738
1290201480
1212320991
1182451657
1166015851
1085540781
1043352019
1027918291
992859621
971701138
966831999
959915524
942339541
917455248
894854113
892789670
889290723
866255832
849849539
845326522
841558797
841096333
836428028
830939180
830501540
826203863
815405538
...

result:

ok 20000 lines

Test #63:

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

input:

500 100000
308 423 985000985
103 193 89000089
399 499 735000735
149 467 644000644
40 499 852000852
256 348 201000201
60 284 504000504
58 393 881000881
150 298 820000820
66 333 939000939
351 472 186000186
21 468 225000225
288 494 846000846
160 211 800000800
66 344 20000020
231 353 677000677
408 437 4...

output:

1746001247
1746000748
1686339310
1684877739
1673874789
1654800015
1653006609
1647967208
1646632882
1638164353
1627899923
1602331662
1555730052
1553997025
1514646883
1444879697
1412779526
1370242271
1309097805
1265864944
1249469301
1247001746
1247001247
1247000922
1233921297
1228597797
1191956647
116...

result:

ok 20000 lines

Test #64:

score: 0
Accepted
time: 251ms
memory: 11548kb

input:

500 100000
199 232 800000008
105 229 600000006
2 36 500000005
144 400 100000001
84 309 100000001
18 80 300000003
346 389 600000006
4 82 700000007
247 349 600000006
285 428 900000009
172 241 500000005
40 218 600000006
37 137 100000001
115 354 800000008
270 296 200000002
181 493 100000001
404 442 4000...

output:

49900000000
49899999501
49861848456
49850865965
49840443851
49840232275
49832367037
49822871566
49773662681
49755051977
49717402926
49677326240
49653335817
49608929807
49606829017
49583855556
49569309207
49567971887
49560767824
49553006378
49551550296
49546588240
49501283032
49481942790
49459876012
...

result:

ok 20000 lines

Test #65:

score: 0
Accepted
time: 250ms
memory: 11464kb

input:

500 100000
172 494 863143941
1 345 597403781
419 464 629283401
45 354 331837866
359 364 535145884
365 485 583409937
2 42 116200439
31 93 347471553
100 332 721667631
203 490 235683489
106 387 817674027
410 443 652269892
289 327 458934215
114 154 521371543
120 213 514661762
144 463 286283671
214 409 3...

output:

1361681247
1320696586
1304491025
1280777821
1275352387
1251573997
1219004354
1147151265
1135097328
1071182128
1058936250
1052953821
1017777558
1008086957
999906133
984692544
977156359
919080998
917761598
915122117
909472675
886097822
872813257
866933427
863780636
825407932
820007206
817026889
811350...

result:

ok 20000 lines

Test #66:

score: 0
Accepted
time: 255ms
memory: 11492kb

input:

500 100000
183 293 833796048
32 274 292750942
99 178 705341965
305 438 572692825
362 407 438392068
240 302 738677933
92 193 83067005
131 170 761083172
157 359 644344195
188 385 382768369
227 447 185521829
372 465 172509884
178 489 944672100
20 426 192535331
21 235 335646745
406 413 827270134
174 347...

output:

1526113521
1522538550
1495459278
1490801171
1486205994
1479950274
1455465997
1422516354
1419811828
1418787210
1417651240
1413999523
1411244908
1311008298
1282687435
1272535214
1253195669
1197567353
1179728278
1179648838
1155815179
1149880083
1128998807
1123691405
1105530165
1088659288
1066845307
105...

result:

ok 20000 lines

Test #67:

score: 0
Accepted
time: 250ms
memory: 11444kb

input:

500 100000
55 497 579207223
54 119 931112813
278 425 508766101
104 146 157707795
206 415 413629504
161 225 538102692
131 485 925372298
180 300 809778054
80 335 652409910
122 474 779393334
395 497 775795502
84 378 261004775
181 276 690500732
215 358 662584667
39 54 526173636
226 413 781602427
20 177 ...

output:

757482554
757469650
757424782
757356134
757390000
757412382
757412098
757424453
757429380
757422443
757418019
757373223
757262930
757266986
757241876
757231550
757087415
756823686
756777053
756673150
756090370
756009062
755950448
755794053
755675373
754938676
754877245
754398247
754035375
753442462
...

result:

ok 20000 lines

Test #68:

score: 0
Accepted
time: 254ms
memory: 11580kb

input:

500 100000
6 46 472467786
357 493 513263210
146 199 988085714
162 322 142293046
416 453 113392577
72 221 158520260
156 342 285780279
337 423 109916362
219 498 652439961
66 210 853727267
232 240 851834579
115 371 445476441
177 493 284859761
220 357 7913652
250 363 165560044
97 379 470386436
350 356 4...

output:

1612270311
1592975055
1560967232
1554120768
1552428374
1515948635
1508142538
1501951087
1497719107
1489956357
1485003475
1483834032
1475962509
1452371938
1443296903
1434206501
1406162867
1402144077
1401311524
1399426862
1392857803
1383368694
1381762551
1363777803
1340218983
1324432574
1297816199
129...

result:

ok 20000 lines

Test #69:

score: 0
Accepted
time: 264ms
memory: 11464kb

input:

500 100000
76 193 1000000000
230 368 1000000000
291 417 1000000000
108 193 1000000000
170 211 1000000000
147 158 1000000000
216 421 1000000000
280 495 1000000000
105 443 1000000000
226 391 1000000000
394 420 1000000000
3 22 1000000000
289 291 1000000000
374 419 1000000000
49 283 1000000000
80 115 10...

output:

498999999501
498987371807
498927717854
498874695611
498821234248
498820243733
498791830174
498706363949
498699545613
498692189854
498612340373
498591063013
498478854380
498466760117
498450038627
498447173868
498436517224
498387811830
498385768425
498230370843
498202186824
498200383438
498197418879
4...

result:

ok 20000 lines

Test #70:

score: 0
Accepted
time: 267ms
memory: 11576kb

input:

500 100000
34 431 280919563
299 491 963068082
316 448 549920482
338 389 611468787
87 147 573858568
256 426 855898449
141 368 134215293
289 474 716429223
302 414 322329225
29 375 165584892
398 410 286203918
319 454 771134623
15 378 821971687
149 493 367862476
107 311 787697538
462 487 246178592
46 10...

output:

782591411
782591465
782591546
782591600
782591627
782591681
782591951
782592032
782592086
782592113
782592194
782592248
782592329
782592410
782592518
782592572
782592599
782592680
782592788
782592842
782592896
782593031
782593058
782593139
782593220
782593247
782593328
782593355
782593436
782593544
...

result:

ok 20000 lines

Subtask #6:

score: 23
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #71:

score: 23
Accepted
time: 731ms
memory: 28360kb

input:

500 100000
26 252 9185931
29 422 274102647
243 352 808082644
103 460 995952274
89 305 493695870
84 271 773088591
117 157 318171504
163 234 140602436
285 474 801339225
87 390 453782158
22 298 117604157
303 335 141374480
57 181 198697536
115 224 55792422
107 251 488384664
296 404 108701977
368 421 666...

output:

1521433241
1521432742
1519501113
1517411301
1517087450
1516470187
1516469688
1516469191
1516231625
1514126333
1513087603
1512056328
1511324744
1511323752
1510060512
1510060017
1509870212
1509017322
1508775752
1508544042
1507282455
1507221323
1507220830
1507220339
1506928685
1506728848
1506340958
150...

result:

ok 1000000 lines

Test #72:

score: 0
Accepted
time: 628ms
memory: 28352kb

input:

500 100000
305 390 796693067
42 341 180154477
326 373 746237800
331 423 470491820
278 469 898889512
135 294 69551834
136 222 551020796
257 389 227703019
314 448 351964565
74 419 653197216
76 282 437982131
145 357 704796186
96 476 143853461
112 114 170481247
71 121 924725378
66 348 378147899
6 53 763...

output:

34259300198
34259299699
34258139025
34258138526
34258138029
34257693214
34257692717
34257692222
34255362257
34254384137
34253303552
34253303057
34252637507
34251156042
34250120249
34249644011
34249643518
34249643027
34248060043
34248059552
34248059063
34246325069
34244069312
34243637036
34243612586
...

result:

ok 1000000 lines

Test #73:

score: 0
Accepted
time: 706ms
memory: 28432kb

input:

500 100000
31 304 754759551
234 391 408762568
212 341 750417514
361 462 894599260
160 231 512715765
23 473 173476432
8 323 813832335
285 425 69006514
224 344 661696877
10 236 264471936
303 393 108138862
76 416 663884977
135 292 190421409
169 496 503566549
115 269 95575388
151 185 491894484
21 239 32...

output:

7681620179
7681619680
7679874677
7679874178
7679873681
7678759407
7676723695
7675747587
7675719755
7674299329
7674261557
7674079655
7673229785
7673229288
7673228793
7673079798
7672233843
7670147913
7667416998
7667416503
7667416010
7666441842
7666117448
7665713188
7664760219
7664621193
7663948248
766...

result:

ok 1000000 lines

Test #74:

score: 0
Accepted
time: 714ms
memory: 28364kb

input:

500 100000
293 455 99218604
20 277 610896060
35 239 534066163
190 304 461934524
86 431 61073593
124 344 850045875
40 155 387709404
169 175 585210079
208 396 98301348
336 493 291272615
390 391 452889516
133 166 483320531
121 474 408452562
1 399 612641828
39 404 636776461
265 452 869001385
209 402 138...

output:

2864942128
2864941629
2863554409
2863553910
2863553413
2863489797
2863044485
2862921726
2862847176
2862560904
2862459516
2861846715
2861824350
2861823853
2861823358
2860593778
2860498738
2859758218
2859716143
2859563683
2859469633
2859004333
2858887018
2857572298
2857368853
2857368360
2856987764
285...

result:

ok 1000000 lines

Test #75:

score: 0
Accepted
time: 726ms
memory: 28492kb

input:

500 100000
239 272 705777626
250 489 769174232
312 334 528875237
421 491 119586914
179 412 826260258
68 191 562344907
9 240 790027049
43 60 827851367
227 327 644952192
345 492 881598560
137 148 56020058
418 432 629675998
93 500 763036399
380 472 887852352
14 478 167972039
277 472 163395440
164 223 5...

output:

1904154251
1904153752
1901154263
1901050471
1900737361
1900647901
1900467490
1899678254
1899346755
1899346260
1899119055
1899118560
1899118067
1897750980
1897075364
1896312350
1896167996
1892828705
1886711336
1885806423
1885688092
1883273354
1882826544
1882103792
1881782678
1881641761
1881128175
188...

result:

ok 1000000 lines

Test #76:

score: 0
Accepted
time: 724ms
memory: 28304kb

input:

500 100000
378 484 393991899
107 490 459449657
235 417 390718697
293 330 854984823
328 392 313889290
324 353 85241482
173 260 793324765
303 377 24414045
60 459 730315706
148 446 10653330
141 464 602354077
250 317 931111666
200 487 405590099
245 460 139140379
116 229 529310478
74 105 650634774
128 25...

output:

1505883650
1505883151
1504369684
1503624178
1502903123
1502596737
1502596240
1500870159
1500845806
1500511822
1498793693
1498528295
1498527798
1498527303
1497219513
1497073983
1494133188
1492972908
1492453653
1491575028
1490888958
1490873613
1490169723
1489917273
1489916778
1489916285
1487855545
148...

result:

ok 1000000 lines

Test #77:

score: 0
Accepted
time: 687ms
memory: 28356kb

input:

500 100000
79 175 189601428
138 469 123978236
63 172 888641052
265 318 923543906
144 157 178775342
47 363 292074809
272 364 773595424
127 187 124318886
38 110 753714812
407 414 352952270
321 446 517362528
78 132 838148957
254 479 451208170
60 273 225577952
418 435 727083669
170 241 775835418
57 209 ...

output:

1459205607
1459205108
1458060402
1456635258
1455730072
1455671190
1455670691
1455670194
1454983837
1454355629
1453801474
1452596249
1452493370
1451876096
1450514813
1450363725
1450042166
1449621704
1448327516
1446611375
1446438419
1446437922
1446437427
1445315262
1445277147
1443593157
1443592662
144...

result:

ok 1000000 lines

Test #78:

score: 0
Accepted
time: 741ms
memory: 28352kb

input:

500 100000
56 309 713150438
308 376 441488047
400 464 131650519
234 342 323928605
110 280 894411518
105 368 381152772
65 434 458949491
121 457 243535292
269 448 759940181
454 457 249857608
267 500 805687883
51 92 350873523
262 279 194217023
227 471 755569815
10 352 559231673
291 452 223218996
249 42...

output:

1608018914
1608018415
1607411631
1607232989
1606550357
1604882200
1603851266
1603113744
1602108758
1601250478
1601018942
1600735510
1600255472
1600126231
1599837809
1599807370
1598528932
1598528435
1596960897
1596747187
1596538944
1596538449
1596252339
1595530134
1595052954
1595052459
1593253502
159...

result:

ok 1000000 lines

Test #79:

score: 0
Accepted
time: 707ms
memory: 28400kb

input:

500 100000
367 481 65000065
455 459 528000528
6 393 873000873
215 281 21000021
132 190 811000811
191 396 913000913
127 265 505000505
73 129 874000874
130 286 850000850
211 241 690000690
159 367 375000375
84 456 476000476
81 267 53000053
141 287 81000081
58 383 480000480
54 178 193000193
22 267 11100...

output:

1735001236
1735000737
1734759221
1734708323
1734618503
1734211818
1733716810
1733584076
1733403438
1733232281
1733207331
1731952845
1731815620
1730519218
1730205347
1729835089
1729089583
1728928406
1728185894
1727616036
1726776219
1726213347
1726211351
1725293690
1725219838
1725195387
1725065647
172...

result:

ok 1000000 lines

Test #80:

score: 0
Accepted
time: 723ms
memory: 28412kb

input:

500 100000
156 208 100000001
106 257 800000008
220 329 800000008
229 286 600000006
127 270 600000006
56 301 800000008
32 184 100000001
67 79 100000001
183 424 800000008
179 500 200000002
268 305 300000003
7 275 100000001
162 435 600000006
327 398 100000001
2 446 400000004
22 294 200000002
34 172 400...

output:

49900000000
49899999501
49899738025
49899472557
49899078846
49898368769
49898206594
49897439631
49897393723
49897307396
49897127756
49896442130
49896206103
49896122770
49895982551
49895473571
49895284949
49895154710
49894683155
49894573375
49894230562
49893297931
49893099329
49892880268
49890271995
...

result:

ok 1000000 lines

Test #81:

score: 0
Accepted
time: 719ms
memory: 28404kb

input:

500 100000
249 315 722439905
145 222 378674656
5 271 851929226
71 226 621441711
34 500 309356762
363 460 857492310
359 401 964946748
82 131 851330874
109 485 192971192
120 497 593459405
46 461 576797405
232 320 595022514
46 76 78046529
36 418 649889377
110 410 647036734
189 283 54272805
375 387 4949...

output:

1369770241
1369373536
1368796692
1368174439
1368003781
1367924440
1367742804
1366397500
1365449899
1365071657
1364604593
1363524034
1363328509
1362907759
1362567694
1361821729
1361479189
1361343064
1361137639
1360665409
1359979834
1359903604
1359891724
1358754754
1358368242
1357315531
1357260539
135...

result:

ok 1000000 lines

Test #82:

score: 0
Accepted
time: 707ms
memory: 28352kb

input:

500 100000
294 353 490717210
111 211 592976648
147 184 673649541
134 424 41618394
101 358 945854764
56 79 436750668
182 277 18393908
308 406 916159527
446 461 908235656
27 35 792720386
249 420 511241043
378 454 796838460
8 83 66233277
179 482 538976769
193 443 488525150
126 140 179413948
78 138 1712...

output:

1475106929
1474654205
1474209887
1473936040
1471978854
1471770114
1471758683
1471501734
1471486824
1471282557
1471185642
1471081272
1470712001
1469489381
1469485405
1469192672
1468717043
1468653427
1468525698
1468380077
1468292108
1466407484
1466059584
1465915918
1465610503
1465258558
1464563578
146...

result:

ok 1000000 lines

Test #83:

score: 0
Accepted
time: 726ms
memory: 28408kb

input:

500 100000
27 142 53302701
246 430 950175687
379 448 386335338
333 403 466428015
314 332 458409083
55 347 548521072
165 304 46135560
6 229 523405946
141 423 993877147
76 327 16882455
33 374 365049816
240 319 511495671
323 437 950844816
147 223 100697733
191 205 987161805
107 411 719017799
99 197 834...

output:

716345057
716329882
716293432
716285632
716273157
716261732
716258332
716252057
716249657
716236082
716228382
716182182
716178132
716171857
716167157
716154257
716151657
716145007
716143707
716131607
716122707
716121632
716120382
716115557
716098407
716094057
716082982
716079532
716057882
716048757
...

result:

ok 1000000 lines

Test #84:

score: 0
Accepted
time: 762ms
memory: 28368kb

input:

500 100000
264 451 118948356
230 420 69370578
124 176 605931963
74 324 116634811
7 150 91387038
161 290 287440812
359 423 410953235
378 442 324942881
48 373 1527477
103 303 314797780
423 444 620068435
290 402 213797622
102 109 912735484
46 140 45440013
225 341 408462823
222 348 350290155
167 272 545...

output:

1552036011
1551741102
1551668747
1551422740
1551366852
1550956674
1550878830
1550694200
1550584420
1550541506
1550168753
1550081428
1550038015
1549982626
1549796998
1549131332
1549041512
1548819956
1548810974
1548756583
1548571953
1548417263
1547707186
1547210681
1547086430
1547037029
1546293020
154...

result:

ok 1000000 lines

Test #85:

score: 0
Accepted
time: 727ms
memory: 28436kb

input:

500 100000
80 237 1000000000
182 332 1000000000
152 379 1000000000
31 210 1000000000
12 149 1000000000
56 155 1000000000
5 289 1000000000
83 102 1000000000
233 376 1000000000
68 387 1000000000
188 336 1000000000
271 381 1000000000
274 443 1000000000
228 380 1000000000
267 453 1000000000
196 338 1000...

output:

498999999501
498999613275
498998304897
498998236534
498998146714
498998026954
498997620768
498997301408
498996766480
498996635742
498995773969
498995526465
498993602321
498993161205
498993088351
498992290450
498992153724
498992089852
498992020990
498991718097
498991543946
498991410214
498991097840
4...

result:

ok 1000000 lines

Test #86:

score: 0
Accepted
time: 735ms
memory: 29016kb

input:

500 100000
208 474 475486154
121 437 511930004
121 245 708665463
223 330 456526997
369 391 148154279
139 299 110931173
153 172 456864577
76 173 398232779
87 459 550399478
131 175 674837680
48 434 635044827
112 127 547100016
16 417 798974720
87 120 554078992
96 364 719972112
52 104 796962621
213 401 ...

output:

1196052330
1196052539
1196052748
1196052957
1196053166
1196054211
1196054838
1196055883
1196056301
1196057137
1196057346
1196057555
1196057973
1196058182
1196058600
1196058809
1196059018
1196059436
1196059645
1196060690
1196061108
1196061735
1196061944
1196062153
1196062362
1196062780
1196062989
119...

result:

ok 1000000 lines

Extra Test:

score: 0
Extra Test Passed