QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#387251#8196. Zapobiegliwy studenthouzhiyuan100 ✓514ms80084kbC++142.4kb2024-04-12 11:03:382024-04-12 11:03:39

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 40
Accepted

Test #1:

score: 40
Accepted
time: 2ms
memory: 3964kb

input:

3000
3933353 70882522
431257009 431260553
90739306 181374877
122022862 131964741
563835356 563924377
118764371 334063455
26214655 62023860
40797538 289373132
85278264 154263043
559290951 559390997
140863766 181337311
30550198 99872053
53298927 164507323
398655954 398779690
454048567 454187653
256862...

output:

710
929 1635
1461 1635
406 1635
2128 1635
2176 1635
370 1635
2088 1635
2287 1635
1885 1635
869 1635
991 1635
1765 1635
2686 1635
988 1635
1952 1635
391 1635
433 1635
1706 1635
261 1635
1795 1635
5 1635
2451 1635
457 1635
1254 1635
2331 1635
717 1635
499 1635
1858 1635
2578 1635
1939 1635
627 1635
26...

result:

ok 

Test #2:

score: 40
Accepted
time: 2ms
memory: 4024kb

input:

3000
31030527 224953096
362558018 362950530
181784096 231354294
102853306 170479486
157957286 258809455
39420753 102841775
66680992 91375920
115393779 157957286
41333976 56861640
57405250 109915816
12325647 126099987
60106250 108557797
419465371 419502618
54901708 81479964
157718826 157957286
318294...

output:

1164
2211 1868
2764 1868
2636 1868
2817 1868
1305 1868
1487 1868
2129 1868
1071 1868
2384 1868
997 1868
1878 1868
1880 1868
797 1868
1354 1868
2661 1868
2067 1868
64 1868
1059 1868
47 1868
1544 1868
733 1868
2074 1868
1568 1868
2364 1868
2740 1868
1543 1868
2247 1868
195 1868
2727 1868
886 1868
2675...

result:

ok 

Test #3:

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

input:

3000
71012996 71094087
142103791 142153359
129250374 138842795
18535894 18554386
192995012 193103066
46363241 46370290
149525178 149638179
154963002 171398581
109691836 123828530
153720609 153864248
52639958 52757141
188195177 205887265
63643341 63689591
72539758 72605349
201057807 217241469
1334440...

output:

889
1038 2841
903 2841
1991 2841
516 2841
464 2841
301 2841
1013 2841
1248 2841
1876 2841
1996 2841
877 2841
1625 2841
515 2841
901 2841
1907 2841
1933 2841
2851 2841
1731 2841
2727 2841
1973 2841
2141 2841
332 2841
853 2841
818 2841
2139 2841
264 2841
1504 2841
2278 2841
1166 2841
782 2841
191 2841...

result:

ok 

Test #4:

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

input:

3000
74523187 74639447
69002241 74017833
38903521 53274148
27964195 28108909
90480259 90714386
80227337 80233197
74024120 74355868
87997733 91873572
115068358 115237960
81118691 82016815
71587720 71686990
54665074 79252306
83590436 83831492
101758617 102092854
11897307 12018869
83749552 83831331
775...

output:

950
287 659
1654 659
42 659
1653 659
2148 659
608 659
1507 659
820 659
2963 659
144 659
2575 659
1370 659
2298 659
1160 659
2875 659
2006 659
1619 659
2046 659
1888 659
1535 659
2645 659
1962 659
79 659
2212 659
501 659
1786 659
65 659
754 659
1319 659
1008 659
721 659
2260 659
78 659
1142 659
178 6...

result:

ok 

Test #5:

score: 40
Accepted
time: 2ms
memory: 3872kb

input:

3000
7051210 8589811
18502361 18548147
10825587 10925453
10814101 11820256
6634997 7192161
8159514 9623111
6343123 9208117
11598681 13563271
15947954 16110829
11889628 11939148
8237287 8288595
18548147 18620522
9481884 10648149
8589811 8719610
11820256 11855114
14689173 16361212
10814101 10825530
65...

output:

196
913 611
782 611
2197 611
518 611
1380 611
2655 611
552 611
1521 611
2286 611
1295 611
2051 611
2480 611
1814 611
1967 611
878 611
323 611
1846 611
2210 611
1712 611
554 611
287 611
149 611
2748 611
2401 611
1309 611
551 611
1094 611
897 611
1067 611
1905 611
803 611
2744 611
724 611
190 611
1171...

result:

ok 

Test #6:

score: 40
Accepted
time: 2ms
memory: 3808kb

input:

3000
9666113 9699478
6965840 7841200
10055382 12219484
10288891 10367080
6969527 7162495
8594370 9548407
10250084 10288891
10420507 10762472
10055382 10123746
12068744 12162702
6969527 7162495
898461 1193510
12945038 12957489
8815357 8915885
10762472 10764220
11051606 11190103
10250084 10288891
1076...

output:

97
1355 1235
527 1235
1926 1235
30 1235
1445 1235
2230 1235
2679 1235
2635 1235
2833 1235
2359 1235
1514 1235
1158 1235
2103 1235
1568 1235
2937 1235
1609 1235
288 1235
1121 1235
118 1235
1088 1235
643 1235
856 1235
997 1235
1192 1235
1517 1235
1348 1235
2625 1235
1746 1235
1009 1235
16 1235
1386 12...

result:

ok 

Test #7:

score: 40
Accepted
time: 2ms
memory: 4260kb

input:

2990
50340082 121213456
3227228 116175285
424744925 424887740
31439322 277401622
336388021 336431031
15931482 29319341
75260985 231708778
185165107 185293971
67367703 141831559
17406456 49981991
49079607 445176184
94084419 94416531
265132826 265169936
107853545 320822230
62144003 123579437
377801615...

output:

989
2338 757
2763 757
2191 757
1818 757
2282 757
2103 757
707 757
1004 757
325 757
1448 757
528 757
2050 757
1878 757
2690 757
2868 757
1524 757
1182 757
887 757
831 757
2563 757
2875 757
563 757
245 757
1381 757
2001 757
1664 757
23 757
297 757
342 757
2965 757
2033 757
1794 757
980 757
1265 757
89...

result:

ok 

Test #8:

score: 40
Accepted
time: 2ms
memory: 4056kb

input:

2990
250865254 250869884
286482343 431381520
67327525 67430639
51403719 51487566
289528053 289582672
423899248 490004400
258417153 458191427
461265317 465980729
394370749 491254041
403746044 408137448
290547180 290680587
319179787 323134772
223102834 223331806
432432647 436809367
213343887 357836802...

output:

1182
1097 1019
540 1019
976 1019
1992 1019
2164 1019
1968 1019
2875 1019
101 1019
362 1019
407 1019
1340 1019
1964 1019
1346 1019
2331 1019
1268 1019
2216 1019
2857 1019
978 1019
155 1019
2878 1019
448 1019
782 1019
2721 1019
371 1019
586 1019
1413 1019
1789 1019
1752 1019
18 1019
46 1019
2041 1019
...

result:

ok 

Test #9:

score: 40
Accepted
time: 2ms
memory: 4188kb

input:

2990
102788330 102925405
4878515 31638048
177455671 177533043
32255571 37544098
114232867 117557314
40689737 40719674
73751698 73933892
133909722 134297030
110647842 113985076
93078823 93091503
82870304 101468113
69527427 87652872
92822371 92926747
35890864 97925062
232144359 232402208
93726776 9656...

output:

813
2350 821
2414 821
1707 821
15 821
2775 821
805 821
936 821
2448 821
2810 821
1213 821
2097 821
641 821
632 821
301 821
2986 821
1796 821
653 821
2673 821
942 821
2733 821
770 821
2962 821
896 821
56 821
315 821
1790 821
1042 821
1874 821
2315 821
1830 821
289 821
2623 821
1191 821
1154 821
1762 ...

result:

ok 

Test #10:

score: 40
Accepted
time: 2ms
memory: 4168kb

input:

2990
35883857 36839641
17782252 51143143
68716248 76021874
76043743 76217639
33446237 33518833
39879049 41955106
44893112 73888169
38705671 40125877
53703222 64069313
60894195 61523325
25303122 25500733
37162379 45358432
10932450 11196880
33952191 34106194
86352421 87513151
21744478 28830372
8093553...

output:

714
1073 841
1773 841
2479 841
2838 841
2967 841
666 841
1816 841
205 841
2418 841
1694 841
525 841
1869 841
774 841
1940 841
2138 841
1310 841
2073 841
2127 841
636 841
54 841
437 841
2723 841
2451 841
402 841
2177 841
2311 841
487 841
1594 841
2920 841
496 841
316 841
2186 841
964 841
1416 841
580...

result:

ok 

Test #11:

score: 40
Accepted
time: 2ms
memory: 3752kb

input:

2990
15071564 16374160
14115610 15457074
18513886 18574399
16420710 16483561
14783931 15042254
12820856 13241099
14794431 15774071
20604285 20741904
8954839 8981274
13733211 13972852
11879070 14016942
19228344 21918959
23906126 24094967
11863974 11949391
18459398 18770708
14783931 15101427
12478133 ...

output:

214
2680 1299
494 1299
217 1299
149 1299
2557 1299
2013 1299
654 1299
2430 1299
663 1299
596 1299
161 1299
1014 1299
482 1299
2636 1299
1259 1299
1228 1299
2629 1299
1334 1299
42 1299
951 1299
195 1299
955 1299
2381 1299
1488 1299
1323 1299
278 1299
2545 1299
2953 1299
963 1299
2420 1299
2532 1299
2...

result:

ok 

Test #12:

score: 40
Accepted
time: 2ms
memory: 3880kb

input:

2990
5940513 5985963
7319348 7434051
6644317 6874055
7206754 9269298
9652129 9752692
4832948 5795408
5910136 6545830
9752692 9773617
6644317 7434051
5116164 5365823
8410392 8568019
5116164 6874055
5985963 5998318
2093281 2454423
9218895 9269298
5795408 5796544
5795408 5796544
6545830 6644317
5940513...

output:

90
2141 297
157 297
2838 297
2383 297
1088 297
1936 297
2803 297
1291 297
2206 297
2239 297
1343 297
1515 297
1628 297
774 297
830 297
1652 297
1102 297
161 297
226 297
1891 297
461 297
27 297
1878 297
8 297
722 297
2501 297
897 297
582 297
2536 297
1938 297
2664 297
2199 297
603 297
462 297
376 297...

result:

ok 

Test #13:

score: 40
Accepted
time: 2ms
memory: 3956kb

input:

1910
75202538 75470705
121439276 121919190
251206481 252242944
86382123 92860960
614158821 614579149
305272572 305846919
646930494 647247261
130693374 131191622
57240909 57310488
625780955 628286239
44326730 44369315
171865307 172643196
44326730 44895004
429513780 430793052
563643413 564501483
16883...

output:

711
147 1399
1808 314
663 1383
614 493
1454 1480
603 1377
1710 1702
893 297
1179 151
1024 171
1693 1647
468 1446
811 582
551 633
1847 764
101 552
411 227
419 166
211 16
198 1818
942 1519
83 132
1084 1890
1160 1376
285 45
562 127
1079 1819
1746 1884
1372 32
165 538
1680 1575
1486 1065
526 1572
318 13...

result:

ok 

Test #14:

score: 40
Accepted
time: 2ms
memory: 3852kb

input:

1898
184900554 185195808
596932543 597022839
135894103 136382082
254770095 255722821
628780718 629396361
89010691 89162557
642069578 643306766
229707657 230831841
274813298 276499996
135062542 136833638
204166458 206497511
683486146 685362282
149063878 149102082
229267785 230703363
72612168 73087843...

output:

708
1422 124
825 717
455 1658
903 959
280 951
1554 907
891 1653
1295 722
1186 1258
201 1783
148 51
1372 1499
1897 1547
1707 1833
1692 552
1396 716
160 1039
1230 1019
943 1610
1262 1538
87 566
1073 655
294 1842
291 1102
1600 1623
1442 1500
981 1098
1411 848
1733 1314
1702 1047
457 705
1364 886
1675 1...

result:

ok 

Test #15:

score: 40
Accepted
time: 2ms
memory: 3884kb

input:

1868
738941544 739319851
22325451 23612100
253148693 253538781
545244471 546518034
312379559 315502647
249862738 250436819
527886214 529214868
261028713 274340180
558238279 558989089
592442191 592639859
88075311 89041265
317641731 340661240
499536929 500333273
510190160 510669948
517022124 517833793...

output:

680
1092 1196
1267 759
1084 1167
602 1139
923 819
516 1221
510 915
1059 53
1455 596
1849 1770
1170 135
1827 1730
743 1500
1572 498
23 1652
642 202
1569 1409
105 526
1672 658
255 413
480 631
272 345
44 1052
871 1454
919 1065
675 68
269 80
954 1375
1035 1716
1548 447
1406 643
887 74
434 835
592 1294
1...

result:

ok 

Test #16:

score: 40
Accepted
time: 2ms
memory: 4092kb

input:

1898
593691572 593906544
419361221 419442981
731410217 731573761
19426567 25770341
7209560 7370309
177180275 178264189
456333304 456650631
276969920 280173683
53912270 54256982
328109128 328601378
309178445 309374144
422353313 422624521
101935776 102094019
738549151 738791815
353088558 354042200
585...

output:

697
247 1807
875 525
1611 1829
1793 983
1159 79
350 414
1107 588
1000 355
483 1755
1213 516
176 5
503 1221
749 1158
64 1242
145 1751
1034 1105
302 148
139 873
1299 40
646 614
972 409
1663 668
1674 444
1015 633
1300 1439
1627 403
1204 598
1090 589
1389 1025
1548 1321
522 1679
664 1581
197 792
1356 25...

result:

ok 

Test #17:

score: 40
Accepted
time: 2ms
memory: 3908kb

input:

1844
102448427 104401885
10812012 11147082
420064916 421813703
661768204 662311317
508103199 511664791
442978839 443498253
241119414 241242725
396935383 397076925
580250057 580771846
432700109 433367374
646020379 646247214
29751892 30362447
37993837 44589226
709057845 716237087
359343035 374738552
4...

output:

674
1630 1305
300 1117
184 99
215 491
642 817
857 494
829 164
620 465
1327 1757
838 1742
490 2
1442 1427
1486 1765
742 1028
1423 708
1334 1193
555 714
1297 1276
105 535
486 1220
912 450
342 190
674 101
823 407
920 1697
1013 695
664 1606
994 69
1812 1129
597 55
658 1130
208 547
1677 12
1370 1571
699 ...

result:

ok 

Test #18:

score: 40
Accepted
time: 2ms
memory: 4080kb

input:

1889
564785915 566122852
519698913 520739863
435185494 435314066
645242669 645599840
28210897 28439640
593709195 593719822
565773316 566216270
519871611 521349793
378541513 425804871
578073871 578784796
48330689 48551496
604868766 604875993
138704249 138722239
38415541 39737338
230466551 231577842
7...

output:

697
842 1198
1569 1079
902 763
560 130
1670 548
496 1822
616 676
1232 170
498 1572
1593 753
328 1860
707 916
1047 1869
1735 1268
1835 792
615 1561
125 1481
492 320
1651 163
459 965
856 260
1431 387
573 895
1137 1594
1303 438
122 522
1546 400
1627 1309
1811 1747
744 1151
1842 1808
274 482
710 669
888...

result:

ok 

Test #19:

score: 40
Accepted
time: 2ms
memory: 4052kb

input:

3000
924 2077
3806 3807
3479 3480
3061 3062
1205 1796
1351 1650
495 2506
4363 4364
4040 4041
4420 4421
957 2044
3885 3886
1315 1686
794 2207
3509 3510
3151 3152
4254 4255
3830 3831
1385 1616
748 2253
3121 3122
579 2422
623 2378
3645 3646
1484 1517
32 2969
439 2562
3210 3211
4183 4184
3683 3684
3598 ...

output:

1500
1206 619
673 619
1794 619
2746 619
122 619
563 619
1721 619
2309 619
2990 619
2225 619
2815 619
2547 619
1861 619
2868 619
1394 619
319 619
643 619
1495 619
2728 619
2864 619
637 619
684 619
352 619
930 619
2109 619
1722 619
1259 619
1700 619
2347 619
2256 619
2294 619
2994 619
2997 619
999 619...

result:

ok 

Test #20:

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

input:

2
1 4
2 3

output:

1
2 1

result:

ok 

Test #21:

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

input:

2
1 2
3 4

output:

1
1 2

result:

ok 

Test #22:

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

input:

3000
65358258 65908047
385965515 386042234
37731087 38183736
299401409 300119156
454768183 454951855
312689188 312965778
304032771 304164881
217183822 217316878
174450942 174542630
451680500 452256646
75963152 76196904
86254155 86565208
40119130 40279303
370158759 370442706
396706744 397157378
30651...

output:

1499
1461 1635
2128 1635
370 1635
2287 1635
869 1635
1765 1635
988 1635
391 1635
1706 1635
1795 1635
2451 1635
1254 1635
717 1635
1858 1635
1939 1635
2679 1635
1118 1635
1991 1635
508 1635
1823 1635
260 1635
1404 1635
608 1635
193 1635
2978 1635
2554 1635
618 1635
1374 1635
2403 1635
1414 1635
2993 ...

result:

ok 

Subtask #2:

score: 60
Accepted

Dependency #1:

100%
Accepted

Test #23:

score: 60
Accepted
time: 506ms
memory: 70312kb

input:

500000
407892396 407894065
654503489 654503501
9066405 84391111
140987019 171563436
14057278 19781051
34941076 145785516
234766009 234766141
20335659 44712015
336459606 336460578
317292502 317292578
13283779 15008155
6484755 100390340
465647488 465647776
381908371 381910825
102485960 185427558
76325...

output:

254096
182258 474568
172248 474568
416887 474568
490 474568
80776 474568
263191 474568
317979 474568
87283 474568
117193 474568
362905 474568
301026 474568
106283 474568
240113 474568
67009 474568
443049 474568
437360 474568
249007 474568
286766 474568
247565 474568
496160 474568
498600 474568
42782...

result:

ok 

Test #24:

score: 60
Accepted
time: 499ms
memory: 62944kb

input:

500000
13002946 68701866
4733539 43995294
31492413 103830172
170770666 171815325
12805604 155553070
73232678 89080638
122151560 122802318
121601488 122265567
98532673 245103395
23340940 81165159
404593991 404594275
130046140 150732609
48079081 245423481
478588967 478589353
34762052 141554385
6826022...

output:

123907
488164 20502
326421 20502
36068 20502
88440 20502
6767 20502
211490 20502
347188 20502
294696 20502
153647 20502
199844 20502
175442 20502
475270 20502
295024 20502
381786 20502
311316 20502
338196 20502
141895 20502
387311 20502
41801 20502
375722 20502
330701 20502
295662 20502
426001 20502...

result:

ok 

Test #25:

score: 60
Accepted
time: 514ms
memory: 53068kb

input:

500000
26643253 26762939
124973874 124973924
104836056 139539875
95035682 101884314
107671424 114521776
105444682 105444834
46748925 46867583
41225663 63736637
177953802 177958013
149360101 159964168
145683623 155425562
41865427 41988301
107339428 114192197
192436713 192436745
77497028 79907719
2318...

output:

107589
22766 362037
196170 362037
248468 362037
467393 362037
88294 362037
261578 362037
26827 362037
288956 362037
37047 362037
306884 362037
139075 362037
470113 362037
353551 362037
408994 362037
208824 362037
86367 362037
377891 362037
212543 362037
416044 362037
133174 362037
138687 362037
1715...

result:

ok 

Test #26:

score: 60
Accepted
time: 433ms
memory: 46376kb

input:

500000
61971783 62075841
66131430 66132218
56238154 56238690
70076915 70077077
38011798 49115996
86388430 86388721
50785655 51197023
66314821 66335131
35347975 35348446
41895585 41924952
56721852 56721957
54523356 54571508
64943486 64943599
83965472 83965737
73610011 73748884
17824907 53135985
77041...

output:

109835
9788 143010
320944 143010
75326 143010
375619 143010
254200 143010
439493 143010
470463 143010
487144 143010
72180 143010
388418 143010
279801 143010
114801 143010
197600 143010
402168 143010
396305 143010
431756 143010
360404 143010
134729 143010
279971 143010
40371 143010
466090 143010
2453...

result:

ok 

Test #27:

score: 60
Accepted
time: 313ms
memory: 39260kb

input:

500000
549476 1024522
829710 830282
415118 417693
900627 900646
612307 612794
425978 1066159
225433 225749
536172 676316
681207 681756
1493301 1493744
970766 972749
669865 1121461
1232252 1234410
772478 848691
1292705 1294653
645110 645345
555103 831576
1290503 1291102
1289304 1294653
63538 294731
4...

output:

2633
76354 169318
495558 169318
2017 169318
437730 169318
37799 169318
336021 169318
220957 169318
450892 169318
314148 169318
226516 169318
166976 169318
445505 169318
157534 169318
227619 169318
292632 169318
89834 169318
281347 169318
60494 169318
433023 169318
377998 169318
60704 169318
190561 1...

result:

ok 

Test #28:

score: 60
Accepted
time: 211ms
memory: 38564kb

input:

500000
59055 59158
34450 35028
60662 60881
34182 34450
34450 39260
50981 51138
59055 59158
49699 52035
41744 41887
57978 58874
35028 41887
41887 42178
36810 53188
52355 53188
57793 57978
32988 33087
38381 42178
41697 41744
51138 51327
34182 41697
32286 38661
36602 47074
36810 37022
51327 52035
49699...

output:

115
451842 240191
375754 240191
441245 240191
358607 240191
32827 240191
365452 240191
495885 240191
140021 240191
62527 240191
168041 240191
47173 240191
60128 240191
116050 240191
233168 240191
173142 240191
223373 240191
447557 240191
343166 240191
112684 240191
18130 240191
372923 240191
444663 ...

result:

ok 

Test #29:

score: 60
Accepted
time: 441ms
memory: 80084kb

input:

499990
948742631 949003988
768464404 768464571
384190932 384193353
80112927 80114309
589096347 589097682
70759321 70760675
28970784 28971152
394499087 394499682
683566590 683568937
209192916 209193238
392085104 392085884
371213970 371215503
891551959 891552951
389814151 389814198
352166345 352167268...

output:

462714
350651 233114
151479 233114
355613 233114
223993 233114
137551 233114
317601 233114
182587 233114
25417 233114
260147 233114
449764 233114
445850 233114
130295 233114
172224 233114
349909 233114
103439 233114
492963 233114
125381 233114
381690 233114
330609 233114
474248 233114
474313 233114
...

result:

ok 

Test #30:

score: 60
Accepted
time: 482ms
memory: 64004kb

input:

499990
429148896 429151777
8193013 218244899
219266522 219639868
4219530 37374453
106959371 107228024
99134307 99404667
143400334 143687917
41398062 88930525
82381795 114350328
32011271 125545161
72448978 216170891
88734159 117405370
87545495 201886821
471444790 471445433
13307185 64810927
166753731...

output:

136999
390346 361656
11267 361656
395253 361656
138896 361656
147050 361656
308328 361656
221624 361656
56088 361656
187970 361656
256333 361656
43139 361656
144080 361656
444559 361656
495542 361656
271059 361656
428515 361656
1272 361656
433479 361656
486771 361656
148918 361656
387849 361656
1028...

result:

ok 

Test #31:

score: 60
Accepted
time: 464ms
memory: 54268kb

input:

499990
23315946 27579365
40128118 40129415
122201100 122436620
156057106 156395362
5745239 24364747
15207076 15207801
84025083 84027386
210395536 210396027
39041366 39041750
109300727 109405655
131326726 131583213
131727123 131727805
42081188 46459629
165678828 165678937
91300895 91301245
112722726 ...

output:

193921
316495 395326
47085 395326
89703 395326
13675 395326
24158 395326
417943 395326
280137 395326
470831 395326
372105 395326
495517 395326
117636 395326
404171 395326
186360 395326
237690 395326
432922 395326
250498 395326
358678 395326
76157 395326
470067 395326
454553 395326
360160 395326
1693...

result:

ok 

Test #32:

score: 60
Accepted
time: 472ms
memory: 46752kb

input:

499990
19455659 49619275
52349364 52350224
3529937 19390686
17301372 45920111
20272556 35225907
61461723 62247708
46884837 47695311
92020790 92023872
94218595 94219721
59105993 72668879
78211271 78211555
1544311 2791589
94958034 94958055
35529888 47505235
7271832 7272908
63636409 63637185
83764915 8...

output:

74447
273274 269238
350748 269238
115279 269238
103522 269238
334840 269238
451897 269238
292909 269238
116279 269238
452478 269238
234828 269238
299182 269238
92793 269238
3045 269238
88461 269238
155361 269238
177097 269238
218188 269238
27585 269238
9644 269238
365190 269238
135884 269238
477972 ...

result:

ok 

Test #33:

score: 60
Accepted
time: 310ms
memory: 39432kb

input:

499990
1151472 1152459
593018 594473
289315 788469
168692 237090
903501 904065
248851 249454
845938 846960
634849 911812
296612 697067
430952 431473
1146908 1147314
686201 686275
713130 781179
679476 845874
945092 945517
235256 295919
285724 285728
470234 584188
163959 237783
172934 272433
350474 35...

output:

2703
497094 321065
299212 321065
212423 321065
193919 321065
50099 321065
226247 321065
332045 321065
310180 321065
338244 321065
4185 321065
380989 321065
11323 321065
457517 321065
31153 321065
378540 321065
260438 321065
87773 321065
55848 321065
324106 321065
103629 321065
342978 321065
206368 3...

result:

ok 

Test #34:

score: 60
Accepted
time: 182ms
memory: 38552kb

input:

499990
57043 61353
61827 62133
74447 74553
57185 57707
53474 56355
53474 54680
39723 41557
38262 55213
59832 61282
61353 61827
50045 56355
49221 53141
41557 48901
48901 49221
50930 57185
62794 63258
50045 50062
13991 15757
58756 58961
51322 52678
50045 50062
53474 54680
53474 54680
51322 55213
55213...

output:

116
424013 427733
376585 427733
149452 427733
38158 427733
210408 427733
273931 427733
20765 427733
112874 427733
426737 427733
442495 427733
381054 427733
189236 427733
419429 427733
354045 427733
111780 427733
177262 427733
293860 427733
351107 427733
367584 427733
345732 427733
373211 427733
1158...

result:

ok 

Test #35:

score: 60
Accepted
time: 239ms
memory: 45340kb

input:

314300
524197415 524210323
496787896 496793207
82238259 82238773
251533834 251535738
662752628 662756074
305708987 305710968
553082058 553810952
426801990 427316637
700885978 700889113
324634315 324637427
172597379 172608941
621945256 621949200
689378341 689378842
590173930 590240692
204585773 20458...

output:

115875
280586 123677
261966 310191
242613 110972
234815 133436
110831 150390
122307 292800
224796 39618
251262 92761
115821 166234
152018 234343
58879 295539
177264 148665
275203 206280
247640 169750
128093 191589
116086 251073
143647 61661
213663 42619
152705 264844
278644 27421
10182 250312
40005 ...

result:

ok 

Test #36:

score: 60
Accepted
time: 240ms
memory: 46896kb

input:

314891
313105072 313170057
87030149 87030975
229859890 229863423
732365163 732366171
357433917 357445674
35469970 35470819
172235014 172240393
650294966 650296073
131063544 131157054
739570398 739621168
499910260 499914127
639003360 639004212
224364032 224364999
201227273 201240314
562437749 5624382...

output:

115983
108106 243340
133346 287829
174713 68349
169549 36444
119443 302094
256820 134041
260561 153972
22185 181009
166660 244010
98359 247369
166931 193119
111135 259327
39665 262136
8039 115478
17237 26484
244 165608
255101 92503
207767 12967
306284 121077
197369 211610
210129 284794
292162 26951
...

result:

ok 

Test #37:

score: 60
Accepted
time: 242ms
memory: 45012kb

input:

313988
371199163 371214227
393965363 393965725
709122126 709127065
475663022 475665087
233764642 233764949
326625060 326629570
374334307 374340009
342871007 342871349
75596724 75603086
4391767 4391826
230091427 230100616
371989094 371991773
288609870 288612889
13547924 13551501
441364388 441369905
7...

output:

115630
51934 193191
177303 225878
170079 275649
88003 154975
70835 41024
202509 19231
253496 249226
151289 88638
31839 84869
247277 251123
227664 197239
22923 31640
56558 236672
309834 122187
259380 37250
301501 85533
48692 294973
93708 279352
76979 79676
279520 182151
80747 243988
142948 166300
224...

result:

ok 

Test #38:

score: 60
Accepted
time: 246ms
memory: 46376kb

input:

314720
127910026 127915340
44213788 44221005
415670340 415680822
267281528 267326436
662014024 662015886
79675208 79723878
419407728 419416799
312926269 312939470
642030849 642039591
705170049 705175015
651863414 651865844
660584439 660671580
756898987 756909683
554710169 554711107
504664750 5046772...

output:

116002
171563 2615
143762 179548
224865 98083
132054 253007
287578 253249
210585 177014
78523 154370
26479 136896
45921 81970
23789 4862
306933 101552
16940 96040
183738 264599
14690 208672
297342 257526
234431 219741
263471 274073
303554 24148
35534 298250
192542 77816
99819 81810
175270 45246
1047...

result:

ok 

Test #39:

score: 60
Accepted
time: 231ms
memory: 46148kb

input:

314720
347052617 347055339
724335968 724338799
750657412 750658553
615943191 615948897
663480371 663480534
439021379 439031125
201335524 201336439
713978966 713980236
69216691 69217406
303017614 303021225
350670549 350674031
215332258 215341384
45162666 45166153
423902103 423903988
429147104 4291483...

output:

115948
232190 9923
248384 303478
221189 13633
279469 180134
34634 142577
234065 121180
252284 16118
166609 43380
223533 53518
170025 248475
155192 215014
108288 211239
227751 146394
258599 203378
195396 299993
264151 270234
18016 237811
38296 89877
302587 262698
106903 145604
69122 78481
9419 49173
...

result:

ok 

Test #40:

score: 60
Accepted
time: 245ms
memory: 45364kb

input:

314447
679834604 679834918
658898707 658902690
371281102 371419988
108638749 108639370
728623301 728676550
148515084 148519334
383249460 383249917
688976425 688988953
246712312 246758901
324468223 324632740
215454415 215457585
324225156 324292922
716083076 716191643
148316304 148326023
467091813 467...

output:

115900
276362 134285
192943 291204
134722 270018
214044 256994
107947 313109
103248 167356
153732 18851
109131 290758
291443 34141
12290 51423
128675 37022
118533 198845
106198 122241
16368 155773
275364 259510
286306 270098
172983 309064
30038 57579
35629 51347
38728 122762
13201 227496
84845 22638...

result:

ok 

Test #41:

score: 60
Accepted
time: 411ms
memory: 72516kb

input:

500000
663930 663931
181262 318739
155097 344904
529821 529822
249900 250101
139591 360410
576099 576100
718720 718721
695797 695798
191707 308294
50250 449751
547024 547025
3527 496474
113290 386711
37128 462873
7336 492665
155485 344516
17961 482040
641728 641729
686672 686673
142381 357620
749763...

output:

250000
190642 17931
76517 17931
499300 17931
25506 17931
297175 17931
354623 17931
86470 17931
403037 17931
283361 17931
32572 17931
210059 17931
141495 17931
222051 17931
474472 17931
459016 17931
185328 17931
35840 17931
10316 17931
403325 17931
139850 17931
146930 17931
131957 17931
315076 17931
...

result:

ok 

Test #42:

score: 60
Accepted
time: 0ms
memory: 3652kb

input:

2
1 4
2 3

output:

1
2 1

result:

ok 

Test #43:

score: 60
Accepted
time: 0ms
memory: 3884kb

input:

2
1 2
3 4

output:

1
1 2

result:

ok 

Test #44:

score: 60
Accepted
time: 394ms
memory: 68384kb

input:

500000
334052756 334053121
3441473 3441605
235556626 235557202
224036358 224037627
168105326 168106795
2918751 2919905
296780188 296781094
417453734 417454217
358680743 358685659
10891367 10892114
72332955 72333855
304396338 304397913
453299019 453301641
452531125 452531586
226391530 226394485
28647...

output:

249999
289205 134053
237194 134053
448174 134053
344551 134053
55536 134053
349333 134053
360668 134053
69582 134053
185273 134053
469592 134053
149445 134053
425156 134053
414497 134053
472552 134053
109959 134053
240996 134053
177892 134053
357884 134053
418978 134053
50001 134053
82135 134053
717...

result:

ok 

Extra Test:

score: 0
Extra Test Passed