QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#587355#32. Tollyellowbird100 ✓48ms43804kbC++172.1kb2024-09-24 19:39:032024-09-24 19:39:03

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 7
Accepted

Test #1:

score: 7
Accepted
time: 25ms
memory: 41760kb

input:

1 50000 49999 10000
28116 28117 4272
15866 15867 5673
38118 38119 8922
38575 38576 806
26221 26222 8045
16395 16396 211
17070 17071 1801
24810 24811 6670
44898 44899 6603
36986 36987 5958
5058 5059 5472
38952 38953 7947
25479 25480 937
34813 34814 8087
36873 36874 9102
38090 38091 4416
43253 43254 5...

output:

132581784
25180897
90096323
137505791
182756627
56626936
92687360
213071340
230587686
133760598
165611824
64778884
242205990
81064064
101519576
9635466
101928710
32361680
148988187
70570739
84559353
27969941
70881194
192597213
168605876
70339228
177355217
144544606
63764960
85559057
47845102
1259524...

result:

ok 10000 lines

Test #2:

score: 7
Accepted
time: 1ms
memory: 5740kb

input:

1 10 6 10
6 7 6635
7 8 4970
0 1 6312
8 9 7809
2 3 664
1 2 6891
8 9
2 4
5 7
5 6
5 9
3 8
0 8
0 1
3 9
2 8

output:

7809
-1
-1
-1
-1
-1
-1
6312
-1
-1

result:

ok 10 lines

Test #3:

score: 7
Accepted
time: 1ms
memory: 5604kb

input:

1 10 7 10
8 9 1074
3 4 2137
6 7 7767
5 6 9895
1 2 9710
4 5 6062
2 3 8917
2 3
2 8
1 2
4 7
2 5
2 7
3 4
6 8
6 9
5 8

output:

8917
-1
9710
23724
17116
34778
2137
-1
-1
-1

result:

ok 10 lines

Test #4:

score: 7
Accepted
time: 1ms
memory: 5608kb

input:

1 10 4 10
3 4 6490
5 6 2540
7 8 1090
2 3 1691
1 4
6 8
3 7
0 4
6 7
2 3
0 1
0 7
4 8
2 5

output:

-1
-1
-1
-1
-1
1691
-1
-1
-1
-1

result:

ok 10 lines

Test #5:

score: 7
Accepted
time: 0ms
memory: 6172kb

input:

1 1000 949 1000
473 474 6082
710 711 2134
433 434 714
567 568 5179
408 409 3769
513 514 6321
401 402 8814
988 989 6244
178 179 563
158 159 7702
263 264 591
879 880 6393
802 803 3905
573 574 1932
773 774 6873
205 206 7370
522 523 9710
461 462 9092
872 873 1984
255 256 11
280 281 7660
591 592 4640
519...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
27903
-1
-1
-1
-1
100126
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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 1000 lines

Test #6:

score: 7
Accepted
time: 0ms
memory: 6028kb

input:

1 999 948 1000
749 750 8886
67 68 9787
185 186 1131
460 461 1811
952 953 8489
35 36 1599
821 822 6767
864 865 8214
140 141 9881
586 587 8319
896 897 1414
613 614 3940
423 424 2063
991 992 4634
16 17 8820
826 827 8163
327 328 8776
212 213 8232
610 611 7322
693 694 9657
668 669 444
871 872 8760
101 10...

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
63690
-1
-1
-1
-1
-1
-1
-1
193476
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
117233
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
39568
-...

result:

ok 1000 lines

Test #7:

score: 7
Accepted
time: 0ms
memory: 6048kb

input:

1 1001 980 1000
481 482 4104
787 788 4428
513 514 908
583 584 3768
143 144 7946
715 716 4085
877 878 3716
760 761 3605
228 229 8237
206 207 4338
95 96 7475
889 890 3363
278 279 2082
752 753 1962
531 532 8964
968 969 572
497 498 8302
20 21 6956
101 102 995
221 222 8494
113 114 8089
837 838 4126
30 31...

output:

-1
57565
-1
-1
-1
-1
131431
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
144425
-1
-1
-1
-1
247166
-1
-1
-1
-1
-1
64718
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
50372
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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 1000 lines

Test #8:

score: 7
Accepted
time: 32ms
memory: 43788kb

input:

1 50000 49949 10000
22175 22176 7071
44427 44428 6667
20106 20107 8044
28928 28929 3806
35990 35991 8500
13247 13248 5160
10180 10181 8548
41465 41466 9259
24149 24150 5265
43232 43233 5623
41789 41790 2816
35050 35051 501
23410 23411 3928
39593 39594 4752
51 52 9779
15937 15938 2958
3718 3719 4988
...

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
562761
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
3241138
-1
143562
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
9081955
-1
-1
-1
-1
4052571
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 10000 lines

Test #9:

score: 7
Accepted
time: 20ms
memory: 41672kb

input:

1 49999 47498 10000
11534 11535 4097
49126 49127 1935
14597 14598 3715
46122 46123 18
9969 9970 6602
27587 27588 5680
10039 10040 3402
47097 47098 9593
28008 28009 6729
39859 39860 3158
13444 13445 8707
1197 1198 1229
40425 40426 408
19235 19236 5707
45808 45809 9761
25095 25096 9289
11944 11945 248...

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 10000 lines

Test #10:

score: 7
Accepted
time: 23ms
memory: 41660kb

input:

1 49999 0 10000
11705 30866
2730 32279
32802 46874
670 19831
7600 7743
24917 31066
32253 48714
35896 49551
34066 36763
27736 49552
3699 4980
433 39378
12731 21521
12403 18096
22278 36165
18691 28349
1225 43408
2085 41693
5173 39213
19930 36188
14465 22777
4510 35701
21899 45888
19047 44658
22130 262...

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 10000 lines

Subtask #2:

score: 10
Accepted

Test #11:

score: 10
Accepted
time: 23ms
memory: 23628kb

input:

2 50000 94996 10000
42590 42592 9309
11538 11541 4653
45675 45677 3309
869 870 6588
30563 30565 8686
30988 30991 9038
4495 4497 5335
25643 25644 6179
4890 4892 7897
18593 18594 2267
23266 23268 3778
42163 42164 8391
560 562 3808
48478 48480 7402
29601 29603 6345
42660 42662 6049
34298 34301 8993
152...

output:

9660551
-1
-1
29677497
-1
-1
25954841
-1
29026387
-1
-1
25117089
-1
2180255
8821457
-1
17974797
-1
31676013
22691306
-1
-1
22125829
21517896
-1
-1
-1
-1
12698182
19407256
12975298
-1
-1
-1
26717226
23860276
5148244
-1
-1
14080996
9293646
-1
-1
-1
-1
-1
19509063
-1
22475995
-1
35380640
17543002
19699...

result:

ok 10000 lines

Test #12:

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

input:

1 10 7 10
8 9 3477
1 2 1501
4 5 2771
7 8 9928
6 7 4122
5 6 5049
3 4 5916
0 9
0 5
0 1
0 1
0 6
0 8
0 6
0 7
0 7
0 9

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 10 lines

Test #13:

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

input:

2 10 12 10
3 5 6140
3 4 178
5 6 7541
4 6 7906
6 9 9146
6 8 3730
2 4 2337
0 3 4408
5 7 9855
4 7 4491
0 2 7776
1 3 5731
0 1
0 9
0 4
0 2
0 7
0 8
0 2
0 7
0 3
0 9

output:

-1
21638
4586
7776
9077
16222
7776
9077
4408
21638

result:

ok 10 lines

Test #14:

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

input:

3 10 16 10
4 7 8566
5 8 13
3 7 8339
1 4 3897
5 7 9851
1 3 4967
3 8 5413
2 4 632
0 5 2370
4 6 935
2 5 1643
8 9 8597
7 9 2072
1 5 8131
0 4 3500
4 8 7681
0 4
0 3
0 8
0 5
0 8
0 3
0 9
0 5
0 2
0 1

output:

3500
-1
2383
2370
2383
-1
10980
2370
-1
-1

result:

ok 10 lines

Test #15:

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

input:

4 10 19 10
7 9 3612
4 8 8280
6 8 3258
1 7 8936
3 7 3812
0 6 4507
2 5 9675
7 8 6874
4 9 9864
1 6 1680
2 7 521
0 5 410
5 9 9196
3 4 489
0 7 4013
1 4 3658
6 9 8929
2 6 6913
3 5 1536
0 9
0 2
0 7
0 2
0 9
0 5
0 6
0 4
0 2
0 1

output:

7625
-1
4013
-1
7625
410
4507
-1
-1
-1

result:

ok 10 lines

Test #16:

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

input:

5 10 20 10
4 9 3779
3 9 3888
0 9 6079
3 8 182
1 9 6767
0 5 4397
1 7 2299
2 9 561
4 6 2606
1 6 558
2 6 5671
3 6 6344
4 8 7895
1 5 6666
2 5 3001
3 7 7176
0 7 8399
2 7 7202
0 6 894
0 8 7928
0 7
0 1
0 4
0 1
0 4
0 9
0 8
0 8
0 3
0 3

output:

8399
-1
-1
-1
-1
6079
7928
7928
-1
-1

result:

ok 10 lines

Test #17:

score: 10
Accepted
time: 12ms
memory: 8132kb

input:

1 1000 979 10000
551 552 2582
599 600 8981
329 330 2091
628 629 1273
846 847 1835
41 42 5797
355 356 9008
317 318 3809
416 417 649
745 746 9894
414 415 2688
30 31 441
649 650 6733
544 545 1847
435 436 9919
910 911 6718
35 36 6817
180 181 7146
497 498 1875
397 398 2562
13 14 3241
780 781 4932
486 487...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
10399
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
65774
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
51355
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 10000 lines

Test #18:

score: 10
Accepted
time: 4ms
memory: 5824kb

input:

2 1000 1796 10000
76 78 5999
933 935 9
408 411 3139
85 87 3531
107 109 3006
410 413 6585
323 324 3977
80 83 5453
63 64 58
766 769 6995
722 725 4496
411 412 3840
42 44 1599
262 264 6587
767 768 4272
888 891 1238
780 783 7281
255 257 4649
654 657 1155
559 560 8536
990 993 316
550 553 625
153 154 3543
...

output:

747927
761801
1073354
95094
527505
656599
838904
149244
805665
672064
361906
299085
1072672
1166456
1585716
33396
1631403
589304
506739
1206263
1585716
1395897
697762
141839
325861
1572390
127280
683858
1008888
1493406
740077
1105321
1119130
1255863
1543657
501043
357982
165126
413234
1112979
734259...

result:

ok 10000 lines

Test #19:

score: 10
Accepted
time: 19ms
memory: 41756kb

input:

1 50000 49949 10000
27397 27398 8216
20920 20921 2495
2502 2503 6669
46149 46150 4010
5146 5147 7650
34862 34863 8865
24806 24807 6988
30624 30625 730
19761 19762 1485
43177 43178 7263
8208 8209 3956
33605 33606 5792
49977 49978 3506
33451 33452 8667
1119 1120 492
16100 16101 7548
14076 14077 3138
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 10000 lines

Test #20:

score: 10
Accepted
time: 38ms
memory: 23000kb

input:

3 50000 134991 10000
42339 42342 789
649 653 7166
48089 48090 2059
12919 12923 2883
31397 31398 3325
22999 23001 3318
22941 22946 1811
34381 34384 2600
36981 36984 166
1521 1526 7429
25020 25025 8541
48161 48162 4717
7101 7104 1582
6314 6317 4097
6001 6004 8149
33505 33507 5686
18113 18116 9033
4356...

output:

9962406
5565912
27158796
19977230
5117783
23714595
29015151
31589372
17106803
23571033
29907666
32941258
27412264
4695305
28723438
18160846
12125871
10288214
1959690
25816619
15378404
32647566
6336062
26360373
29449013
6857392
6559119
11529569
612558
20608803
5392410
11961565
12665095
24543577
27204...

result:

ok 10000 lines

Test #21:

score: 10
Accepted
time: 22ms
memory: 23464kb

input:

2 50000 99996 10000
9047 9049 8723
27292 27294 5733
21911 21913 4535
37730 37733 5192
18776 18778 9572
22944 22947 9822
4122 4124 4398
49745 49747 5920
27549 27551 6394
39547 39548 8534
21852 21854 1354
6097 6099 4037
28197 28198 5556
15501 15503 6901
5971 5973 8990
20171 20173 2898
15980 15982 346
...

output:

41452578
47693325
39216693
24717157
20413971
56455819
41606596
8753634
9652232
23974056
48627285
16584825
69087743
35204679
62812742
32597631
60673839
51072570
67201572
48779865
53173478
30425991
61587654
20155855
50423748
13503415
37674786
11740060
41040751
30252280
54589799
62157105
35833728
34546...

result:

ok 10000 lines

Test #22:

score: 10
Accepted
time: 20ms
memory: 24440kb

input:

3 50000 74995 10000
12372 12376 3080
47207 47208 4012
36430 36434 810
33844 33847 7181
31776 31779 5816
32882 32884 5475
42169 42172 9697
25381 25385 4093
15678 15683 3058
21307 21311 9804
36364 36368 8687
2842 2846 3237
45138 45141 7630
8232 8236 7005
14224 14227 7940
22701 22704 1619
176 179 8959
...

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 10000 lines

Test #23:

score: 10
Accepted
time: 26ms
memory: 12156kb

input:

5 29999 149970 3000
29425 29430 3680
15083 15087 3148
26277 26280 6909
15338 15340 7706
2866 2872 9254
8721 8728 5862
23254 23255 300
22035 22040 3612
18087 18093 1112
2501 2507 2890
10021 10025 7855
500 509 3065
5145 5153 7148
19873 19879 7802
13054 13055 635
3362 3367 3161
4255 4261 3894
9683 9688...

output:

3764442
5243754
2607597
4587502
3153637
1465255
477506
5935025
847906
604392
5724020
3241888
1044645
2667506
5282342
6344412
5112955
6025208
631462
3139490
3523982
1549129
6341143
404864
5824998
1085643
967110
5422152
2136409
731732
1344487
5124188
4053402
952056
1435153
5629580
3309755
5968236
1882...

result:

ok 3000 lines

Test #24:

score: 10
Accepted
time: 11ms
memory: 14580kb

input:

3 30000 89991 3000
9485 9487 5382
21401 21402 8333
27451 27453 5928
1931 1932 5888
18397 18399 3653
27639 27644 4636
16353 16357 2935
17090 17092 2205
3686 3687 9030
19845 19850 5302
26359 26363 711
10332 10336 3082
1412 1414 3003
9993 9996 8920
3964 3968 8466
4757 4758 5732
29829 29832 8481
28856 2...

output:

8679036
4913203
17897407
296049
5217982
6295329
5620636
5621954
12409947
13401980
863253
12055917
408984
510247
14827029
13294495
3749726
6285919
4161394
4320130
8993800
3949763
1521164
12039198
9937982
17511694
14072579
5271648
9369050
5711640
8436195
2870801
13655761
18210911
7606686
5146210
17262...

result:

ok 3000 lines

Test #25:

score: 10
Accepted
time: 20ms
memory: 12164kb

input:

5 30000 74987 3000
4430 4439 5896
19900 19907 9659
23983 23987 335
16466 16470 9025
16798 16804 3246
23840 23849 2578
7799 7803 1742
821 828 114
11374 11377 7517
19468 19470 1110
22308 22313 7479
7962 7969 9649
2665 2670 4784
8625 8633 2994
14021 14029 3952
19189 19194 2119
17880 17885 1254
19926 19...

output:

9993562
1471251
1718943
2268362
4788255
7336374
9257225
12382230
3207424
9460616
2678520
11802327
8333469
422569
2358731
1461724
8387292
7670160
5698128
1973189
7117077
12808647
3302126
279375
6323374
1098709
7173531
6001901
5457548
6995160
9424952
7441771
1450424
9624815
12855129
10164200
1039267
2...

result:

ok 3000 lines

Test #26:

score: 10
Accepted
time: 22ms
memory: 9068kb

input:

5 29999 74985 3000
1552 1557 5417
21249 21251 6634
14780 14787 9613
11827 11833 6916
5436 5442 3924
858 863 1621
10596 10600 8258
0 9 3211
20196 20204 1886
7537 7543 9643
356 360 9450
19987 19994 6768
12538 12541 4814
15332 15338 5779
1624 1628 5872
23276 23283 5001
24346 24353 4538
10747 10751 5009...

output:

9924413
6582732
8766260
7064566
1276932
6532814
11895733
4501200
2010107
9328222
9933534
2798767
2296526
5816111
12796397
1083030
-1
2557134
2113449
12298523
1587371
12830025
4336227
7797271
752087
5152962
12681987
-1
2214356
8434229
2563613
5171812
13131043
1880150
4513730
-1
6940431
7831889
776742...

result:

ok 3000 lines

Subtask #3:

score: 8
Accepted

Test #27:

score: 8
Accepted
time: 1ms
memory: 5760kb

input:

1 10 8 10
7 8 2626
0 1 4605
3 4 1319
4 5 1214
5 6 4454
6 7 4600
8 9 6857
1 2 2017
3 4
2 9
0 7
0 5
4 5
1 8
4 6
7 8
1 2
4 6

output:

1319
-1
-1
-1
1214
-1
5668
2626
2017
5668

result:

ok 10 lines

Test #28:

score: 8
Accepted
time: 1ms
memory: 5696kb

input:

2 10 14 10
3 4 5032
0 2 6758
6 9 3324
0 3 2553
1 2 6681
2 4 2802
7 8 7419
2 5 680
7 9 2800
4 6 8953
4 7 409
3 5 2008
5 6 4066
5 7 7370
0 7
3 9
1 5
4 7
2 6
2 3
6 9
7 8
7 8
1 2

output:

7994
8241
7361
409
4746
-1
3324
7419
7419
6681

result:

ok 10 lines

Test #29:

score: 8
Accepted
time: 1ms
memory: 5696kb

input:

3 10 18 10
1 3 9495
0 3 4077
8 9 2083
2 5 4
3 6 3677
1 4 6866
4 7 9963
4 8 1123
0 5 8661
2 4 2897
5 8 3306
3 7 8787
6 9 8289
3 8 3961
1 5 9692
2 3 6435
5 6 2955
0 4 8539
2 8
5 9
0 7
1 6
6 7
2 3
5 6
6 9
1 6
6 7

output:

3310
5389
12864
12647
-1
6435
2955
8289
12647
-1

result:

ok 10 lines

Test #30:

score: 8
Accepted
time: 1ms
memory: 5660kb

input:

4 10 21 10
0 4 9560
6 8 2638
2 7 19
3 7 4702
7 8 4989
2 5 7967
0 6 1049
0 5 7983
1 6 4053
2 4 2675
1 4 7770
1 5 2989
5 9 7532
3 5 3456
3 6 5546
4 9 3739
6 9 1152
5 8 3496
0 7 6334
3 4 3531
1 7 8458
1 4
0 2
2 8
8 9
3 9
1 8
1 4
8 9
0 4
4 9

output:

7770
-1
5008
-1
6698
6485
7770
-1
9560
3739

result:

ok 10 lines

Test #31:

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

input:

5 10 22 10
2 8 5917
2 9 3005
4 9 9934
1 7 2279
2 6 4170
1 5 169
4 6 9750
1 6 1542
3 5 9661
4 7 8595
2 7 9596
3 8 7613
2 5 2445
3 9 3122
3 6 3925
1 9 5829
3 7 6057
4 5 4783
0 9 5548
1 8 7698
0 7 1536
0 5 3436
8 9
5 8
7 8
1 6
0 9
3 4
3 7
1 6
5 7
4 5

output:

-1
-1
-1
1542
5548
-1
6057
1542
-1
4783

result:

ok 10 lines

Test #32:

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

input:

1 1000 969 100
804 805 2333
476 477 1142
698 699 47
105 106 1602
599 600 1533
165 166 3692
780 781 2047
462 463 7622
240 241 2179
771 772 4210
441 442 1548
316 317 4037
49 50 2795
446 447 8642
131 132 1994
564 565 5634
22 23 2788
361 362 8966
380 381 2945
80 81 2725
322 323 1651
587 588 328
768 769 ...

output:

-1
-1
-1
-1
-1
-1
-1
298017
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
71155
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
47057
-1
-1
-1
-1
-1
253261
-1
-1
-1
-1
-1
-1
-1
130184
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
46625
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
260139
-1...

result:

ok 100 lines

Test #33:

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

input:

2 1000 1916 100
681 682 421
944 947 3854
141 142 8999
107 108 9586
719 721 2389
992 994 2477
682 685 3228
716 719 3791
835 837 7702
9 11 7303
687 689 3233
327 328 1349
154 157 5196
569 570 8901
492 495 7367
475 476 4530
537 539 5699
21 22 1389
873 875 4095
71 72 6396
715 717 7038
534 536 3928
61 62 ...

output:

378284
89918
656914
179221
125041
386972
524388
581178
1037586
430288
1127192
524941
818701
438905
494514
789753
112124
250117
784953
80926
825944
-1
362515
149880
695846
345733
1343341
285178
201127
238090
1351790
351763
225981
136328
281815
669043
591955
176827
317872
662020
446496
222203
204721
9...

result:

ok 100 lines

Test #34:

score: 8
Accepted
time: 2ms
memory: 5788kb

input:

5 1000 4676 100
41 46 2140
484 486 9044
850 857 7324
950 957 8186
109 111 1643
626 630 9419
88 94 1751
752 757 9595
413 418 358
72 75 4371
943 946 2676
660 667 1792
854 855 6981
565 574 7050
320 326 1719
361 367 6574
643 648 898
81 89 5525
940 946 1121
677 681 7101
489 491 839
923 926 4807
698 703 9...

output:

3956
109901
134822
182535
36055
103079
7928
198896
90333
19601
113523
23117
205343
156935
15857
60659
47055
18224
132897
25710
154514
37964
34495
125213
54105
30994
10957
124151
30299
112409
130063
80180
11978
39897
27650
149355
193543
18987
129662
97937
104479
76947
116829
32354
65280
72924
64626
1...

result:

ok 100 lines

Test #35:

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

input:

4 1000 3545 100
198 203 2915
12 18 5721
352 358 4407
170 175 3055
527 531 9680
814 818 3903
756 762 9955
108 115 8344
381 384 9489
67 69 3
40 46 4245
22 24 6809
686 689 8896
468 474 7514
153 157 8265
187 189 8875
585 590 5496
587 589 6345
980 986 5423
963 967 7350
732 736 4139
683 687 7971
203 207 8...

output:

174504
66221
97819
353352
374407
75008
32381
128538
133004
149824
136105
94999
325599
138648
162100
233460
208033
159034
59649
16369
20026
117773
78846
12358
160384
83466
111371
69156
168749
80484
185806
187258
159162
184961
124319
186526
36662
38731
34154
338232
132681
177281
135644
87926
101683
10...

result:

ok 100 lines

Test #36:

score: 8
Accepted
time: 17ms
memory: 41668kb

input:

1 50000 49949 100
28116 28117 4272
15866 15867 5673
38118 38119 8922
38575 38576 806
26221 26222 8045
16395 16396 211
17070 17071 1801
24810 24811 6670
44898 44899 6603
36986 36987 5958
5058 5059 5472
38952 38953 7947
25479 25480 937
34813 34814 8087
36873 36874 9102
38090 38091 4416
43253 43254 577...

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
7376019
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4997669
-1
-1
-1
-1
-1
-1
-1...

result:

ok 100 lines

Test #37:

score: 8
Accepted
time: 19ms
memory: 23496kb

input:

2 50000 94996 100
34528 34531 1839
19240 19242 5449
34314 34317 5854
22888 22891 9990
25945 25947 7989
43432 43434 9319
12964 12967 6750
40022 40024 3256
21903 21905 8074
6964 6967 3192
21862 21864 6117
46674 46676 5253
43821 43822 6644
26606 26608 8454
9399 9401 1697
41022 41025 3176
28346 28348 89...

output:

49741259
48374912
19207155
22647217
17774798
29747614
5340361
19982572
54143915
684419
24065717
9263818
5746365
60886343
12781346
19675691
33373808
1410189
49580415
380363
6844315
48233825
45306327
36499826
59456382
28551495
61942923
19924852
20280017
2119089
14454572
42527740
24198607
33787577
3846...

result:

ok 100 lines

Test #38:

score: 8
Accepted
time: 23ms
memory: 24516kb

input:

3 50000 134991 100
35553 35558 7976
10965 10968 7703
45523 45526 3438
2005 2008 2328
29785 29788 7293
46553 46555 3234
49244 49245 2519
30460 30462 1537
30440 30443 9855
39444 39447 6785
13471 13474 8596
45058 45060 1856
14559 14563 4581
14255 14256 7712
6224 6226 436
21008 21009 6612
25212 25216 28...

output:

14222960
7545690
10880867
18029190
17285795
6065038
2412666
18244764
2271968
12488014
9850802
826597
19329200
10226098
4985339
4173769
16858038
9846782
2610896
4331116
1663339
14657551
4187956
3682612
377125
2686940
14000683
4433261
2430877
2446797
3561559
3340816
15893166
20938219
15521511
13734046...

result:

ok 100 lines

Test #39:

score: 8
Accepted
time: 22ms
memory: 21448kb

input:

3 49999 149988 100
38182 38185 7117
26574 26579 2448
10182 10185 3524
25440 25444 9491
22119 22124 2442
21039 21044 7500
48083 48086 2092
34648 34650 2573
8543 8544 1155
40197 40202 4263
1684 1687 6500
9371 9374 5066
44004 44008 384
18087 18091 9819
1575 1579 1449
49914 49919 2019
31480 31482 7852
2...

output:

17107663
23141292
621341
1295683
2291576
4373582
11270460
4596235
3233417
25185520
20268032
4712253
26634181
14178726
5553724
10092384
8165168
1845185
9712493
8418437
14802139
10448327
15653736
25832571
15669068
6750659
4598079
16787279
17094874
971006
8521978
9333458
679789
5443738
384559
10259128
...

result:

ok 100 lines

Test #40:

score: 8
Accepted
time: 18ms
memory: 21024kb

input:

3 50000 112493 100
26748 26752 5717
48293 48295 9092
37809 37814 7979
5177 5180 5278
35227 35229 2047
34465 34469 2183
19347 19350 3656
9417 9420 4420
35351 35352 5352
45256 45260 5320
42553 42555 6892
39031 39035 4147
28500 28505 3297
11317 11320 4637
45790 45794 2472
4037 4038 4498
2889 2892 1832
...

output:

31689052
8249941
218655
22724421
27374136
3675608
5694054
6789785
6922139
26969406
12988958
28367310
19786300
22981216
7420198
22264016
28409508
28676804
10567747
1433775
26167200
12170914
33467319
8661791
19987185
419623
8267308
7252111
9695609
26167515
19162596
166361
17138560
3044929
5848151
1329...

result:

ok 100 lines

Test #41:

score: 8
Accepted
time: 14ms
memory: 10748kb

input:

5 30000 74987 100
1857 1862 7241
14744 14745 4183
23377 23381 980
16411 16419 6550
355 363 5790
11924 11927 4889
5570 5577 8401
17496 17500 2724
18088 18094 9162
17943 17946 603
5321 5326 6421
25063 25069 6269
24426 24431 52
29425 29434 6165
12911 12915 3911
3027 3033 4683
29784 29787 1726
29897 299...

output:

-1
-1
3296106
7389720
7031043
1999110
1241956
4831468
4298821
8678081
4265796
5841232
7182880
260615
8559835
485695
2944818
1771612
-1
5429768
9693711
3129621
3267842
677393
4722631
933583
3870459
3300919
3536512
2431913
8439705
11205591
4937478
2833977
109201
11320837
876933
6341297
1517793
1240934...

result:

ok 100 lines

Test #42:

score: 8
Accepted
time: 14ms
memory: 11836kb

input:

5 29999 74985 100
3221 3228 6500
28317 28322 9343
12962 12968 1050
24070 24078 6742
19964 19965 7304
23355 23361 5902
11262 11269 866
14753 14756 8521
18731 18739 2960
25554 25556 7772
19825 19831 4647
9016 9020 3818
3702 3706 8528
8459 8460 7651
3046 3054 4823
5108 5112 8102
17893 17897 8287
22479 ...

output:

6017948
5299722
2068346
1756247
8481225
1757546
-1
4631627
-1
12536157
812551
7914071
459812
7056625
4240968
4987414
764035
5960730
2533406
1055309
9253079
11027006
1099120
45709
6360443
927780
833459
4377332
2678102
1816785
598294
1905708
627343
1799172
1618565
-1
6581414
1174297
3076130
5787196
59...

result:

ok 100 lines

Subtask #4:

score: 31
Accepted

Dependency #3:

100%
Accepted

Test #43:

score: 31
Accepted
time: 23ms
memory: 26096kb

input:

2 50000 94996 3000
41957 41959 4719
41491 41492 8807
43759 43760 1726
34093 34095 2246
21543 21544 2913
27361 27363 8876
17062 17065 1783
39370 39373 7902
4262 4265 1270
38597 38599 6748
17616 17619 8462
42804 42807 2418
3884 3886 2805
25812 25814 5079
16012 16014 6404
26641 26643 2695
42835 42837 5...

output:

38955483
60252467
38360188
21925640
53349520
14298570
29977497
45689506
51519879
20090562
40245833
15461252
43240068
27085091
21603040
4608117
19565342
-1
7426290
5139167
18264256
10358378
46865859
11027377
25813701
28204975
2838030
2414118
7269464
13999368
46481678
41922933
25455904
42426814
521573...

result:

ok 3000 lines

Test #44:

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

input:

1 10 7 10
4 5 5026
5 6 6943
6 7 6213
1 2 1369
0 1 4750
7 8 8685
8 9 5867
0 1
1 7
2 9
3 5
5 9
1 7
2 7
2 8
5 8
3 9

output:

4750
-1
-1
-1
27708
-1
-1
-1
21841
-1

result:

ok 10 lines

Test #45:

score: 31
Accepted
time: 1ms
memory: 5672kb

input:

2 10 12 10
7 9 9969
5 6 3505
1 3 3778
5 7 4828
2 5 3690
4 7 8706
4 6 1161
6 8 492
3 4 3070
3 5 2134
7 8 2070
0 3 4764
5 6
5 9
4 7
8 9
2 7
7 8
2 4
4 5
3 5
6 7

output:

3505
14797
8706
-1
8518
2070
-1
-1
2134
-1

result:

ok 10 lines

Test #46:

score: 31
Accepted
time: 1ms
memory: 5600kb

input:

3 10 16 10
5 8 5067
4 8 1160
3 8 7881
2 3 8641
5 7 6780
0 5 3822
6 9 8491
3 6 5260
4 6 7296
0 4 2741
5 6 4937
1 4 7848
1 5 8728
0 3 9345
8 9 862
1 3 4544
5 8
4 8
0 5
1 2
0 6
4 5
6 7
5 9
4 7
1 3

output:

5067
1160
3822
-1
8759
-1
-1
5929
-1
4544

result:

ok 10 lines

Test #47:

score: 31
Accepted
time: 1ms
memory: 5632kb

input:

4 10 19 10
3 5 9448
7 9 2515
6 8 1759
5 9 946
4 9 6455
3 6 6101
1 7 9811
2 7 8423
2 6 314
0 6 2359
5 8 2887
2 5 9978
0 4 632
0 5 4688
1 6 7426
7 8 6159
2 4 8164
6 9 2041
3 4 7085
1 9
5 8
4 7
5 6
0 7
6 9
1 5
2 9
7 9
0 2

output:

9467
2887
-1
-1
-1
2041
-1
2355
2515
-1

result:

ok 10 lines

Test #48:

score: 31
Accepted
time: 1ms
memory: 5688kb

input:

5 10 20 10
1 9 2774
3 9 3248
1 5 5910
4 6 2074
2 9 2773
0 5 3540
2 8 919
3 5 769
0 8 7909
1 7 512
2 6 2169
1 6 7449
3 7 3754
3 8 7224
4 8 5755
0 7 8226
0 9 8529
1 8 603
4 7 2265
0 6 7480
0 1
0 7
6 8
3 8
3 7
3 8
2 7
3 9
1 4
2 6

output:

-1
8226
-1
7224
3754
7224
-1
3248
-1
2169

result:

ok 10 lines

Test #49:

score: 31
Accepted
time: 5ms
memory: 6048kb

input:

1 1000 989 3000
881 882 5734
777 778 3875
337 338 8438
286 287 5384
658 659 544
878 879 1510
111 112 1056
788 789 3408
177 178 4097
77 78 2639
442 443 4434
284 285 9126
997 998 223
39 40 2229
419 420 7168
632 633 318
409 410 7801
980 981 1521
892 893 6029
733 734 7971
746 747 9049
682 683 4316
934 9...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
768144
-1
-1
-1
-1
-1
-1
-1
-1
879588
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
940808
-1
-1
125369
-1
-1
-1
13879
33743
-1
-1
-1
-1
-1
538037
-1
401725
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
133631
-1
-1
-1...

result:

ok 3000 lines

Test #50:

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

input:

2 1000 1896 3000
621 622 3199
860 862 5494
169 171 452
416 419 6177
504 506 7288
309 310 8848
849 851 8062
486 489 668
166 169 388
141 143 7541
228 230 1377
569 571 7119
265 266 5770
271 273 7951
846 849 4407
75 77 7226
332 335 5957
856 859 7466
524 526 1463
651 652 3327
157 159 3829
471 473 7228
32...

output:

181303
701983
372248
97083
281714
1017537
654366
447932
624875
177387
463964
30934
701784
439221
392923
959246
1069172
692227
420699
357321
612553
730899
827371
728311
70687
403813
662805
449947
145226
673147
110009
779329
283871
718691
247125
474253
303180
118681
286277
390355
51621
740877
619070
9...

result:

ok 3000 lines

Test #51:

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

input:

5 1000 3980 3000
130 139 640
879 881 6686
219 223 9204
802 806 3729
447 453 1806
578 581 1996
524 526 6615
979 984 4831
326 332 9956
699 702 5461
619 620 8959
681 688 9388
56 64 1951
624 628 3531
480 486 5055
710 718 9621
293 298 7551
334 336 1200
121 129 2536
493 498 461
641 647 2188
157 164 9677
3...

output:

96629
157062
64990
6495
6957
32970
196965
191372
124067
74610
244667
188313
16225
23976
59277
16395
57483
58075
21382
8346
218251
13573
132492
124231
23018
157993
225249
126246
90599
51966
113005
62799
127871
140538
17139
38580
47213
43143
82378
20997
45105
34873
191193
83779
158799
63877
192492
227...

result:

ok 3000 lines

Test #52:

score: 31
Accepted
time: 6ms
memory: 5848kb

input:

4 1000 3187 3000
136 142 113
551 553 3235
865 871 5045
696 703 5112
877 881 6455
817 823 42
442 445 4229
440 446 8457
848 853 1466
174 176 6264
246 251 6480
856 863 658
399 403 2278
231 234 2581
814 817 1003
268 273 1866
355 357 423
350 354 5825
619 623 8596
166 170 6147
474 476 257
772 777 1717
927...

output:

4614
113756
197596
159552
234959
198253
26466
141438
182641
4217
136943
11491
267331
41052
168521
297916
11150
183041
425010
284849
164239
10376
207353
164827
385470
64135
158275
189221
339548
88194
96134
222061
189998
278034
113161
61657
149933
84805
254834
129546
29730
295360
62644
81829
165084
84...

result:

ok 3000 lines

Test #53:

score: 31
Accepted
time: 16ms
memory: 43804kb

input:

1 50000 49949 3000
38012 38013 7330
45183 45184 785
1645 1646 3446
16117 16118 853
46540 46541 1033
24165 24166 296
48357 48358 5556
32141 32142 8113
40912 40913 406
30135 30136 2941
558 559 2830
17061 17062 6974
16372 16373 2985
44295 44296 1469
6915 6916 4308
29115 29116 5356
18991 18992 7170
4968...

output:

-1
-1
-1
-1
-1
718369
-1
-1
-1
-1
-1
3733192
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
7416251
-1
-1
-1
-1
-1
-1
-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 3000 lines

Test #54:

score: 31
Accepted
time: 31ms
memory: 21196kb

input:

3 50000 134991 3000
35553 35558 7976
10965 10968 7703
45523 45526 3438
2005 2008 2328
29785 29788 7293
46553 46555 3234
49244 49245 2519
30460 30462 1537
30440 30443 9855
39444 39447 6785
13471 13474 8596
45058 45060 1856
14559 14563 4581
14255 14256 7712
6224 6226 436
21008 21009 6612
25212 25216 2...

output:

14222960
7545690
10880867
18029190
17285795
6065038
2412666
18244764
2271968
12488014
9850802
826597
19329200
10226098
4985339
4173769
16858038
9846782
2610896
4331116
1663339
14657551
4187956
3682612
377125
2686940
14000683
4433261
2430877
2446797
3561559
3340816
15893166
20938219
15521511
13734046...

result:

ok 3000 lines

Test #55:

score: 31
Accepted
time: 31ms
memory: 24504kb

input:

3 49999 149988 3000
43212 43216 7337
15183 15187 8199
39161 39164 3966
22989 22994 8295
18041 18042 151
22141 22144 8477
3689 3691 6318
27885 27890 4302
36673 36676 5850
34096 34099 1915
49277 49279 9524
43629 43634 3555
24027 24032 4358
14674 14677 59
35233 35235 6214
41706 41709 7462
44704 44708 6...

output:

1217106
13242067
1361397
24017596
29150176
14900018
15003152
4971226
6699096
960514
8782573
7047130
7379450
13823964
637539
20574266
4306864
4602247
16668277
20210387
6226579
2004449
5082133
13357855
9011322
22468500
3293421
17559118
18520492
2505879
15701007
21977654
19706322
2413103
11212340
59728...

result:

ok 3000 lines

Test #56:

score: 31
Accepted
time: 23ms
memory: 24272kb

input:

3 50000 112493 3000
3608 3611 8884
15324 15327 595
34329 34334 1804
40063 40066 6037
33303 33308 6766
30057 30060 2129
33796 33798 3874
145 147 3883
12721 12723 5090
8658 8662 7890
34301 34303 1327
42578 42579 8325
8901 8906 1743
39376 39378 3733
1072 1074 5955
3225 3229 6564
19080 19085 6321
43436 ...

output:

-1
-1
11846367
13199421
8904390
1932276
-1
5118064
14205794
-1
-1
-1
-1
9098808
14066085
1817698
-1
2935142
-1
-1
-1
5862957
-1
-1
945505
-1
-1
6813094
18191426
1838844
15472855
8373666
8525513
-1
-1
13946827
80771
11643298
-1
5832919
-1
-1
3603072
1421190
-1
5827869
-1
4342305
3680506
15501372
1268...

result:

ok 3000 lines

Subtask #5:

score: 44
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #57:

score: 44
Accepted
time: 48ms
memory: 15048kb

input:

4 49999 197980 10000
23190 23193 5666
30793 30798 6971
30900 30907 3446
23498 23503 1310
39212 39219 4596
5381 5387 2288
44028 44033 9956
49044 49049 6778
39479 39483 3991
21216 21223 7921
17532 17537 3161
41904 41911 1217
41551 41554 2519
39002 39007 8084
9958 9960 8377
10678 10680 8308
6719 6723 4...

output:

10372359
12737539
518984
3762779
14624968
9374425
5850269
6836335
11644896
1254288
2494179
7228338
10554605
5206511
16456822
6668189
14657706
5142930
1966255
7204380
441754
869440
2120487
1772096
9093063
1045292
450769
16361136
9238942
13415040
790667
1702397
8792357
12188689
11753
9168756
10323973
...

result:

ok 10000 lines

Test #58:

score: 44
Accepted
time: 33ms
memory: 41672kb

input:

1 50000 49949 10000
47426 47427 7678
44318 44319 2792
11250 11251 5019
30029 30030 2001
23146 23147 3036
44670 44671 7701
19586 19587 181
17946 17947 5205
37997 37998 372
40264 40265 6792
6621 6622 8683
9732 9733 4249
21136 21137 8258
40258 40259 9348
48041 48042 1086
47391 47392 5976
40302 40303 13...

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
7352394
-1
-1
-1
2185730
-1
-1
-1
-1
11122848
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1934774
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 10000 lines

Test #59:

score: 44
Accepted
time: 22ms
memory: 24840kb

input:

2 50000 99896 10000
19382 19384 7829
32475 32476 3631
12370 12372 9447
17934 17936 9488
36180 36182 245
39979 39980 7158
35263 35264 4846
26569 26570 5438
4575 4577 5368
31431 31433 5521
12412 12415 8525
17865 17867 735
21182 21185 1206
23051 23053 4486
88 90 1764
32736 32739 9347
33863 33865 9621
4...

output:

21740433
16178378
8044556
11516406
47574616
20154298
10668428
46641299
18274080
25719916
11336945
29642579
4342177
5744150
9564568
11115705
19742068
55376766
19546493
21911570
8400997
19778106
5360237
39809519
3779427
8402514
19456955
54303241
12693324
25130480
2532169
8157818
37848130
58482390
1105...

result:

ok 10000 lines