QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#729818#9597. Grade 2yzhx#AC ✓186ms19660kbC++201.2kb2024-11-09 17:53:472024-11-09 17:54:09

Judging History

你现在查看的是最新测评结果

  • [2024-11-09 17:54:09]
  • 评测
  • 测评结果:AC
  • 用时:186ms
  • 内存:19660kb
  • [2024-11-09 17:53:47]
  • 提交

answer

#include <iostream>
#include <math.h>
#include <vector>
#include <functional>
#include <stdlib.h>
using namespace std;

using ll = long long;

ll gcd(ll i , ll j){
    return j == 0 ? i : gcd(j , i % j);
}

void slove(){
    ll x , n;
    cin >> x >> n;
    ll range = 1 << 21;
    // cout << range << endl;
    vector<ll> pre(range);
    pre[0] = 0;
    for (ll i = 1 ; i < pre.size() ; i++){
        pre[i] = pre[i - 1];

        ll tmp = i * x;
        tmp = (tmp + x) - (tmp ^ x);
        if (gcd(tmp , x) == 1) pre[i]++;
    
    }

    function<ll(ll)> cal = [&](ll up){
        ll ans = 0;
        ans = (up / range) * pre.back();
        ans += pre[up % range];
        // 0 1 2 3 4 5 
        // 0 1 2 3 
        // cout << "up : " << up << " " << ans << endl;
        return ans;
    };
    // cout << range << endl;
    // cout << pre.back() << endl;
    while(n--){
        ll l , r;
        cin >> l >> r;
        if (x == 1){
            cout << (r - l + 1LL) << "\n";
            continue;
        }
        ll res = cal(r) - cal(l - 1);
        cout << res << "\n";
    }
}

int main(){
     ios::sync_with_stdio(false);
     cin.tie(0);
     cout.tie(0);

    slove();
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 22ms
memory: 19576kb

input:

15 2
1 4
11 4514

output:

2
2252

result:

ok 2 lines

Test #2:

score: 0
Accepted
time: 146ms
memory: 19492kb

input:

500696 100000
110442401300 646889080214
337192 670162015551
508011001649 508011014425
94418501628 94418501634
824168677375 824168677376
732815842309 795402573302
353241304050 846773277757
622033633276 622033633284
760381702139 760381702143
207714 795408271057
382792 952061527685
686173 331215904334
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #3:

score: 0
Accepted
time: 162ms
memory: 19460kb

input:

465262 100000
119442423888 249533375982
528365238401 528365275157
654839906300 654839906303
135820863700 135820967840
336231 918143221477
568175915485 568176067832
993015103483 993015103488
951474 444595379179
298623434750 298623434751
257961 410491919396
996297715292 996297994388
17765498878 177654...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #4:

score: 0
Accepted
time: 146ms
memory: 19544kb

input:

599394 100000
683408 868635908987
347999512025 347999739145
740945 377178907084
399211757563 399211757568
766968 548821086083
630762 702128377806
756554924031 756554924036
904713771313 904714518208
17026878789 17027129255
11601638470 206412869961
253365321722 253365321730
785476956554 785477402085
2...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #5:

score: 0
Accepted
time: 155ms
memory: 19460kb

input:

255255 100000
693776785134 693776920782
174578728959 174578728960
109045569231 631173362385
470661333171 470661439492
401883 183360880923
436203696728 436203931780
165055 339075075373
640081 299360395352
864237441330 864237509663
730335563579 730335652091
194265481215 194265481219
40664920117 406649...

output:

48406
1
186110004314
37959
65357983202
83815
120861662355
106705381500
24327
31556
2
13697
28081
260202193146
52511483770
4
46174459075
3
175347987986
2
47909
258154440479
327427357801
2
22468
54932
46381156133
45666301683
94552873123
55243
2
152254920558
2
109713294365
91231052949
144890963440
1
19...

result:

ok 100000 lines

Test #6:

score: 0
Accepted
time: 166ms
memory: 19472kb

input:

504735 100000
890566082557 890566082559
106681282682 350150954751
14542620333 14542688528
962703917051 962703917057
100450168807 730499846454
90869911943 879001649039
367411155928 367411237841
162790964603 162791319243
843464048636 843464048641
50183553762 50183754394
536413208571 536413208579
76470...

output:

3
91776653818
25745
4
237499194819
297088721196
30767
133683
4
75618
5
14803350036
102273946312
294367282076
90067
26374064222
218863908151
5920
116441
80585705578
78122672310
26247
4
2
362715381968
5
118998177006
1
46573605766
3
294440148616
16240766556
148286820503
170413778829
308538368031
80990
...

result:

ok 100000 lines

Test #7:

score: 0
Accepted
time: 152ms
memory: 19472kb

input:

510510 100000
636202516477 636202516483
766250113730 766250554933
783526 196225463076
79706372523 706598274579
942892 658373730973
467824279548 467824279556
21452896555 313469857150
378837 377299671727
240905 332480727153
498636101528 498636124308
976243856348 976243893391
292392 796495578924
544557...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #8:

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

input:

5 100000
577002044614 577002044615
927612729821 927612729823
458108524625 458108524631
280764605824 668589153220
952951869418 952951869419
529611 683061174939
139562629162 943958766161
682886119356 682886119359
809277569284 809277569288
273256 823615062996
553997 845861944424
810372 355828187260
560...

output:

2
3
4
193912273697
0
341530322664
402198068500
4
4
411807394869
422930695215
177913688445
0
0
4
3
384044390963
2
225492836247
123433323681
163157461936
325461532446
1
143731759371
302892329368
432434490591
3
4
380078319798
2
475791735460
2
0
175885810334
1
106930234833
0
248426664239
3
3
2
142058695...

result:

ok 100000 lines

Test #9:

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

input:

67 100000
554948711586 554948711636
107216748533 551267140383
563444278266 563444278271
296834528251 296834528257
945075901986 945075902057
820833 418403638528
42398724782 775548809425
136440466958 136440467007
137424666397 245095767595
293841341489 293841341519
389980376654 389980376662
65049866518...

output:

41
333037793887
6
5
52
313802113274
549862563484
36
80753325903
24
9
204510681731
473854242629
97253383657
475906911704
2
410453985059
65
592074124647
58
116232829554
3
26550484176
9
8
608544154442
4
596001232498
7
7
295977286700
37
206073186915
280442942335
42
4
546702626742
7689840672
25
206159337...

result:

ok 100000 lines

Test #10:

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

input:

647 100000
463906998888 479659267251
268847 751155874289
651417786367 651417786370
497555 155709224392
622915482618 622915482628
777631 838255026695
243048678285 883954678899
772196356537 967103315725
82204086763 82204087076
66104 324475714342
991803 866563791381
463633987995 958099429201
383184 307...

output:

14767751592
704208380099
2
145976931409
9
785863358495
600849375577
182725274236
296
304195920221
812402624603
463561351131
288610355562
129966561457
283627883934
147229474948
7
912956605545
1
4
571081297966
248
359551529842
583
6
743201235071
7
3
189759269108
432607129516
6
5
434423260186
275
25074...

result:

ok 100000 lines

Test #11:

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

input:

4889 100000
767055827601 767055829288
490893 294465817432
199109591038 199109591039
399822153968 880358292711
825864 747773295851
118874 331319816798
928131530748 928131530753
533475 556937288088
417423462211 417423463757
285188 108197134613
199505599366 261970387618
533517149327 533517151742
848403...

output:

1636
285263285082
2
465519384412
724404580300
320965957363
4
539532481036
1499
104815697882
60512763621
2338
366584431777
3
761707061319
835258241886
2
238377636719
1469
2
45526221069
8
7
4
7
782134351716
902323964729
4
4
265399465733
1
5214
6
3271
2823
789992986908
355206949764
1151
65083701660
112...

result:

ok 100000 lines

Test #12:

score: 0
Accepted
time: 128ms
memory: 19480kb

input:

71473 100000
656103964666 656103964671
498648624075 498648637229
390504315038 647137082392
570202 924129361870
280087103369 431002142325
298239920694 774852456682
706167805477 706167829997
18668 138509788321
253794 654841194475
552838823872 552838883299
593165270991 891051126522
792248 278481571911
...

output:

6
13051
254627823863
916909035485
149736015217
472889000553
24331
137427662078
649724995836
58966
295558622282
276305148576
58150260531
8727462519
65958
34832
32273
1
374742818985
974579726797
703332411703
6
112493
2313
16964
280078382150
493585564078
5
876393142339
67113
51312803819
277929355688
5
...

result:

ok 100000 lines

Test #13:

score: 0
Accepted
time: 174ms
memory: 19488kb

input:

947137 100000
939374 755248253137
224227105223 472382869959
92509901532 701330847277
221867943268 946309636964
736631 404594275091
520041 340554160109
970446602238 970446602242
160354561278 751516102516
64990740479 64990740479
188023308283 188023308288
981243156946 981243222322
223384960026 44150610...

output:

754509767562
247913425109
608226394050
723734231081
404198427581
340221068165
3
590584235039
1
5
65313
217908137513
162936
8
149195
475632034863
3
292614
125979
3309
523598
336729889389
3
718959183140
1
701322266556
648513042428
6
157001
6
4
891628987081
839203
245040
137154282443
199050435598
25288...

result:

ok 100000 lines

Test #14:

score: 0
Accepted
time: 186ms
memory: 19544kb

input:

999763 100000
871469416445 871469416451
66152 791908961867
777345764209 777346045153
269291 297435009460
669356 360116089360
421377007492 783648031951
636957491199 636957491202
786893578508 786894249495
492327403515 492327403523
679508 654247174373
555190 965731300993
726894 279530730056
39378256871...

output:

5
790362198664
280395
296853812946
359412069573
361563463880
2
669686
7
652968669672
963844552936
278984046121
391256570836
978790360056
373170
4
679003
232633722051
448204751658
289995000591
3
939539712284
122172522837
385970821243
52443
575552777171
54043795511
525802
217025558619
446523
778017
72...

result:

ok 100000 lines

Test #15:

score: 0
Accepted
time: 22ms
memory: 19656kb

input:

1 100000
391128977208 391128977208
596942630965 596942630969
208018 606593799103
629194896599 629194896599
349835863178 349835863178
531106536425 776212608295
736525416802 736525416802
81923833591 317949656478
536473402655 552509399268
125131 497916267917
403831493758 403831493758
696952420329 69695...

output:

1
5
606593591086
1
1
245106071871
1
236025822888
16035996614
497916142787
1
10
5
220224934734
3
623653273712
9
648891320826
1
412548830081
412088340787
7
564864603389
1
1
257968996149
1
8
8
5
3
6
1
1
272014261929
151772775392
1
80372883001
1
1
2
299815189372
10
6
1
298043332434
1
1
854736150528
1
1
...

result:

ok 100000 lines

Test #16:

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

input:

2 100000
758526525122 758526525123
753936160590 859158984661
26535137895 26535137895
564271028730 564271028731
711952536666 711952536670
790359672043 943726684203
435502479435 435502479436
121060162676 121060162677
359667370690 359667370691
478817631208 478817631212
812248015589 812248015596
6181512...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #17:

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

input:

3 100000
24691846236 341259021863
714216586901 714216586908
259148730493 844443182807
457275421319 457275421320
98781229257 669738760586
321053 811263087185
13162197867 13162197870
202655903257 881659511955
259358 802637353294
785078825439 785078825444
942153 103384490120
122802029301 729542418061
9...

output:

158283587814
4
292647226158
1
285478765665
405631383066
2
339501804350
401318546969
3
51691773984
303370194380
269958513002
2
74924429694
2
1
2
1
3
70429702195
241249447499
470706562246
78656025842
0
431033976245
4
241328845145
1
108871160908
340255412791
158043593114
1
220836034262
0
104792341383
1...

result:

ok 100000 lines

Test #18:

score: 0
Accepted
time: 23ms
memory: 19656kb

input:

4 100000
722281 443384947629
86664587353 324201622503
245349873311 245349873315
175982845019 175982845024
432550 736216269818
171590280136 508562801889
618116936997 618116936997
948084444166 948084444171
702702 144148118524
364674079494 364674079497
177575 715611307093
107472152849 107472152849
1732...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #19:

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

input:

7 100000
111919 743718616059
523659287368 523659287368
245471760349 553829494481
614120354856 669430133590
22629119298 22629119300
539599 745145023148
486095 843802845277
969042 554186773997
931566775024 931566775028
31966289852 930499523722
284112002551 356420776812
119673342427 851433032770
331290...

output:

557788878105
0
231268300599
41482334051
3
558858362662
632851769387
415639353718
3
673899925403
54231580696
548819767758
232614392975
525487347816
0
3
1
5
86165388386
360068376382
694603606282
233347242084
533826145835
108604191618
458618907533
157211652805
181250755950
2225841643
589880548634
10717...

result:

ok 100000 lines

Test #20:

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

input:

7 100000
622139772189 640000155839
391363202276 885229865071
346196433402 790170321594
448404081067 448404081074
525947686553 951212468213
121169762105 121169762105
356544 276820457484
487450872223 487450872225
95363 513671491121
547716725977 547716725981
387887 129953927667
50843054908 50843054914
...

output:

13395287739
370399997098
332980416145
6
318948586246
0
207615075705
1
385253546819
4
97465154835
5
2
307679581038
283704812986
123073533974
584183961069
4
4
97707885301
403143845777
3
302031392595
3
187820385583
3
358760297210
432241559576
3
467685977099
4
5
5
4
5
3
6
511185598119
245222679478
50285...

result:

ok 100000 lines

Test #21:

score: 0
Accepted
time: 28ms
memory: 19488kb

input:

8 100000
366400915729 366400915733
684392350325 684392350327
285245 214255825661
103593999005 103593999008
965484240575 965484240578
161546092620 161546092626
951271375924 951271375926
770521275532 770521275535
941095585941 986581251985
803235011628 803235011630
645731158877 695991077305
45775594242...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #22:

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

input:

11 100000
669051652735 669051652735
877243269011 877243269019
850419164670 850419164672
158815952879 158815952879
489840291580 489840291587
752213621740 752213621747
55794826964 55794826965
941861431034 941861431040
196583183070 196583183073
907909 981643237848
315820206695 374467005638
541098710143...

output:

1
9
2
1
4
4
2
4
2
736231747456
43985099208
3
722135261157
3
608103843675
5
698081144503
491160715009
2
652900259546
539932224939
524014742128
0
3
3
5
1
401731442879
601617546785
1533137988
411981326738
71779427079
273029831683
101347191614
439161235330
4
326237766169
493003769186
187651025713
231032...

result:

ok 100000 lines

Test #23:

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

input:

15 100000
370733552743 846025785317
704846483896 704846483902
823242012418 823242012421
738342779308 738342779313
623880 996009603226
943977910357 943977910360
48849266792 967656445044
477358889392 477358889407
703324 439306245776
486339370467 486339370472
894803874812 894803874816
456567948523 4565...

output:

237646116288
4
3
3
498004489674
2
459403589127
8
219652771227
3
3
3
422626924039
3
1
3
22334595866
6
3
192178511492
133855778438
4
2
271367731968
3
3
1
3
4
27997297309
371805898614
1
3
5
7
3
5
464271485614
125369118844
3
309975232416
161612963670
198526987626
108622022810
7
4
185796609368
1692380858...

result:

ok 100000 lines

Test #24:

score: 0
Accepted
time: 22ms
memory: 19512kb

input:

16 100000
98788506653 440540963668
535420546192 535420546199
231298925787 231298925795
381702182124 381702182131
328803258805 563742989620
314346394687 314346394688
890159323974 890159323981
530704635691 530704635699
99434175584 683373100346
991875062694 991875062696
371807 269145581267
442487 95176...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #25:

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

input:

17 100000
54362055497 147985001118
876496 477843960613
106891 709672065030
306924266436 996224036927
995924082949 995924082965
643287377759 643287377763
2781474146 2781474148
375426376412 375426376418
386740701936 567330766426
9010114550 857133260980
873409 120744869918
8414689437 8414689441
9211256...

output:

46811472815
238921542064
354835979072
344649885248
6
1
0
4
90295032251
424061573215
60371998255
3
9
17801431984
3
97928651803
859824627
251157828289
178245252062
1
223137004080
373963692072
167122082992
6
39917784688
1
6
415470492041
379023585701
249622808354
10
301957216245
95448547284
0
4
49876843...

result:

ok 100000 lines

Test #26:

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

input:

31 100000
10901671691 82472557488
384021 551539566831
62734929959 78048367121
395795101317 395795101339
43282636412 43282636420
957323 810640071029
465195115870 465195115871
691819 810559452544
662400 960059754130
229377636412 229377636416
122755 546495244115
148188693642 148188693648
856721 5854564...

output:

67097705436
517067983885
14356347341
23
7
759974169101
2
759898838181
900055398497
4
512339176277
7
548864656141
264859272082
104807789786
648399866704
4
560343191522
8
429857894273
60397071009
14
8
16
651659044117
17
321219332328
7
439223449317
6
373093791341
528789116278
632899334353
99099381573
5...

result:

ok 100000 lines

Test #27:

score: 0
Accepted
time: 27ms
memory: 19656kb

input:

32 100000
155735 750112787488
357067194463 357067194467
468233974493 468233974496
249871685947 249871685953
942736466458 942736466468
924860539913 924860539930
330353874550 922407090560
306153 195572065029
618899078478 618899078479
152667014940 152667014946
97848555295 97848555297
718091 47091020747...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #28:

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

input:

33 100000
480387 898702164368
699081 264190356672
962703259839 962703259844
997274873019 997274873025
834096 983636468720
29314499709 29314499711
966847 348105812742
705753649215 705753649220
253106761723 253106761728
679229223867 679229223872
389526 229031581749
366524039839 366524039857
2955414489...

output:

449350841984
132094828800
1
5
491817817313
3
174052422945
1
5
5
114515596118
18
20
80578436226
15
0
171510923232
1
0
0
436922955883
258427082850
134476888783
6
5
296181722074
23
170855347632
0
73087084095
1
269604161280
5
479732942015
5
5
0
481246282880
1
3
95166099625
167515086848
3
17
6
4
13951325...

result:

ok 100000 lines

Test #29:

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

input:

63 100000
913367727727 913367727736
412121933596 412121933616
56484932469 995474316690
852381 336011858384
188403375892 547617500981
995775831758 995775831788
374579 240886408402
793809042936 848846037206
259847962270 958122846660
9262360725 688493906559
314217101524 836649148973
112171383948 880078...

output:

6
12
528181528625
189006190876
202057945364
18
135498394026
30958309277
392779622470
382067744533
293868026692
431947731740
105105304325
355838248595
2
330179302634
6
16
119994121829
22
285539307040
375100117956
307730689547
378584983894
7
2
437013483511
402848905625
19
5
259877253895
4
498611067866...

result:

ok 100000 lines

Test #30:

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

input:

64 100000
471395066877 471395066881
438473 902727315692
672862287842 672862287847
850886 340667131459
99650392829 99650392834
796733723372 905730497448
697797462397 697797462399
265808108765 265808108780
976992 411947176250
721202550709 721202550718
197456562067 197456562081
493022616045 49302261606...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #31:

score: 0
Accepted
time: 23ms
memory: 19540kb

input:

128 100000
91603940106 251561910219
168321780346 168321780353
385689602090 407095617398
303404834240 303404834287
688598 259583478304
612138 205016090066
336379 895154672827
9239018597 13437935060
6685677836 271215997780
175409982205 175409982207
696307 717748342940
656977141945 656977141997
479969 ...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #32:

score: 0
Accepted
time: 34ms
memory: 19544kb

input:

130 100000
704265675354 704265675357
41508 861595945082
289656422626 289656422636
552270046462 552270046468
475614 949049171015
573954132798 573954132928
771099 792688365789
601419 956368269270
208300653130 971355048363
991092 772565242977
296798399266 489127668993
508729 378182270377
139438974408 1...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #33:

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

input:

253 100000
752320955901 752320955908
570081517052 570081517060
493092478638 675356572836
881236 208801494696
549484116452 661273847542
478514127354 478514127363
708054620937 708054621046
759556315647 759556315651
658578525962 664449808952
839648834127 839648834205
350980754428 350980754433
646962624...

output:

6
7
159481082425
182700536779
97816014705
8
96
3
5137372615
70
4
37
79760807096
5
7
77
91
298502026408
817610699798
673374112644
30
3
658288814529
108088919014
29
285568648092
51
301650225586
556318581763
25
566389871315
44
769075939501
160
871806125551
39
324280410782
646871063290
5
468683646578
36...

result:

ok 100000 lines

Test #34:

score: 0
Accepted
time: 27ms
memory: 19452kb

input:

256 100000
332292 165430561939
112302 720803516384
740012356863 740012356866
279541233232 664220091196
726498339807 907412106762
21098667795 72134226135
545155 348760082171
734557586267 734557586429
285243198793 739259323882
682032771275 777382025617
580362606000 815644441297
247061 844534829069
349...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #35:

score: 0
Accepted
time: 24ms
memory: 19544kb

input:

512 100000
161330932735 161330932740
267225830485 267225830667
991315 197030318457
419191 626985903215
958313 487104146583
679978616826 679978616833
828794 744194804843
588072 176441006408
310788878845 310788878851
894316656429 894316656553
500443187707 500443187715
81986 373176776064
497687 9084929...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #36:

score: 0
Accepted
time: 44ms
memory: 19652kb

input:

515 100000
844603915262 844603915267
473846548476 473846548484
135999042555 135999042559
329082469917 858217184077
740545 723345826192
153436729339 153436729345
396453925338 867601169623
531985 181557330752
489337837088 489337837358
598133987428 767733113667
915130664955 915130664964
211376 55971838...

output:

4
6
5
396851035615
542508814259
5
353360433216
136167599077
205
127199344668
7
419788632829
6
2
295108689692
408405152164
439624779261
3
555314806467
8
7
2
579380489163
142165943184
243781694577
216272009326
641649871552
164167046629
153
647
211740690085
175959956952
173
585240447804
327180322540
65...

result:

ok 100000 lines

Test #37:

score: 0
Accepted
time: 69ms
memory: 19424kb

input:

1021 100000
748170088662 748170089240
703038 682743151669
452557414398 452557414403
624046 429140176963
912681998763 912681999172
142559470640 142559470791
937608016790 937608016868
337443 459068859702
1624 212681986038
800641 199235452309
684371071995 684371071999
645138 283455588685
641041838074 6...

output:

577
680075485940
4
427463226538
408
152
79
457275285844
211851195413
198456391311
5
282347697676
7
4
11
36
52
758320117075
216
479138900688
841
489848151975
418484598021
561265983800
3
763594892890
590
121489702170
6
415
7
305501723767
261283655145
2
899
132061334915
307
60
545483568492
778742814911...

result:

ok 100000 lines

Test #38:

score: 0
Accepted
time: 20ms
memory: 19612kb

input:

1024 100000
979980381178 979980381187
791534333946 791534333954
416195 486556578163
156219950512 661117986196
301093379071 301093379076
372791985952 395356083188
680394455820 680394455820
127425572859 127425572863
646142 660485651193
569961 330131631096
676348623814 676348623864
130895366312 1308953...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #39:

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

input:

2048 100000
582701996389 804921966777
966272 688290471671
16640594503 876964496285
664548715427 875418562629
228884064253 228884064256
353638296785 353638297269
529073184764 529073184771
132776915720 975184066037
867197302783 867197302785
333838730561 333838730945
181683806730 795004469514
872309 76...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #40:

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

input:

2049 100000
327000809646 760495515622
277836757813 797743315525
778491 547182312227
654470856703 654470856705
22523708203 22523709829
819000 441516329851
390544 315800488465
560006 870047874041
678739095748 678739096318
144347160530 863104871005
337262362621 337262362624
425676864953 769931405524
54...

output:

216747352064
259953278737
273590766372
1
390
220757754948
157900048914
435023657076
0
359378854540
3
172127269660
1
5
346228935459
244160389634
440026805324
6
431057310721
306178862240
399731111287
316310468798
393588690824
2
228668268544
252267587080
463709493414
342261729078
4
85392036480
0
2
1492...

result:

ok 100000 lines

Test #41:

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

input:

4094 100000
894326833146 894326833155
800931 634842640178
402105258959 402105261374
938152709381 942106219926
65827436110 752152470439
803824050172 803824050179
576349909751 707834043864
833103982591 833103982591
728338027353 728338028801
240665718322 995166478957
221518007336 221518007950
557996437...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #42:

score: 0
Accepted
time: 27ms
memory: 19492kb

input:

4096 100000
358963 729127052929
531960 466046933138
726047 227135660765
574567886847 574567886850
133706790941 133706791649
831817314947 831817316490
765233221629 765233221634
426001667541 426001667871
134574440425 289071381748
567114863538 567114864318
951566074157 951566076044
228542445468 5707895...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #43:

score: 0
Accepted
time: 27ms
memory: 19448kb

input:

8192 100000
633553133567 633553133570
848102219726 966592436507
600480605997 600480606168
773554047639 773554048954
971322 144551958051
633812981814 889336736471
791572299775 791572299776
686657 581011813480
545651 422131623523
836901700723 836901701692
347504456592 347504457160
909240 561560265345
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #44:

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

input:

8195 100000
588151750654 588151750657
138063630983 138063634001
16953840991 16953845484
300184289275 300184289279
63280049494 63280050695
192436 270689821926
789073534952 789073539592
469325 418105956734
146330517893 872566276631
176163625331 487977352638
743174455291 743174455298
302516590481 30251...

output:

2
1869
3134
5
602
203017222071
3686
313579115378
544676819018
233860295600
6
6342
5
1398
8245
6
597158784600
6355
5
384579809233
35825889765
127369390608
1
48251669277
474327436019
563709111435
618861445818
589252967461
3
302139199127
684139943260
161589186146
1517
571275069406
682404297692
1
161254...

result:

ok 100000 lines

Test #45:

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

input:

16383 100000
360671 215393262689
295110298676 295110308360
674018 697192626425
170718 290359879733
584342619887 584342621581
606956 348435454919
581274261983 581274270218
24790899209 24790900929
172101989673 172101990492
710051627007 710051627010
113365063455 446636344769
118408677888 791491914706
5...

output:

139142973327
6257
450383277851
187571237806
1095
225087550712
5321
1112
529
2
215291945888
434809141755
2
592934659850
529716325453
344947418486
487803292640
218737159926
1369
2
2
4
4
928
3
2053
2
448589155932
579518379968
1329
559711901078
118556112289
2
279605964993
5917
1863
2570
3474
21494466775...

result:

ok 100000 lines

Test #46:

score: 0
Accepted
time: 27ms
memory: 19492kb

input:

16384 100000
176670852012 176670852570
149380511636 149380512333
572212760052 789329715644
698890636743 698890637297
299207123585 463369496279
859932785439 859932785953
24722522858 24722535537
928589454169 928589455249
232287 927171880013
123504839098 486255919577
263759445204 825467497059
835185377...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #47:

score: 0
Accepted
time: 27ms
memory: 19464kb

input:

32768 100000
792416 140149860084
612207127711 635952294435
344869 973365632563
142452458390 142452479253
295069167551 574700692811
590917533693 590917533700
660611507651 660611517333
154351566847 154351566852
49377533696 166661839689
736571425317 940034162363
638363926525 638363926529
148686105573 3...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #48:

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

input:

32770 100000
386872890105 796189356865
960238 158733912271
106675961853 106675961859
358682675287 358682707658
243519030681 330548740872
408130133883 505989191919
159601065979 159601065984
207811025180 272688454549
928166162364 928166175548
101785179824 101785195317
50620 749009119802
581348729263 9...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #49:

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

input:

65534 100000
727519 734889941140
709628067839 709628067844
215801921531 215801921539
979031771468 979031780176
715943 368872363153
600277 986122599159
458158833658 458158833666
944329 269041824045
352246104060 352246104063
611100852218 611100852223
497842479524 963235435301
490146114612 490146120620...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #50:

score: 0
Accepted
time: 34ms
memory: 19492kb

input:

65536 100000
458178232316 458178232320
350722195453 350722195460
122265 465036103663
340168940196 340168968673
90894480783 645354828080
720779 683315143320
346290 683511038862
787748269813 787748270838
916740964347 916740964352
461165006003 461165023229
250919386970 799158031256
574832390270 5748323...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #51:

score: 0
Accepted
time: 23ms
memory: 19652kb

input:

131072 100000
860136391249 860136400101
35697 441650586129
526229 336640112571
110964084607 921745256333
990015 599300137529
808033976319 808033976321
49119572302 701625210161
561366171643 561366171652
478967234555 478967234560
818073 573360333038
382885451933 382885487479
628049329846 628049413394
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #52:

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

input:

131073 100000
122322715659 122322876827
637465891527 637465997524
272931905565 594551065116
367988905520 367988999057
556249120766 556249120771
350805069826 350805209457
895238275068 895238275073
783286 846203478899
486182304939 486182412382
484176354657 484176503384
255200 458939327085
343002344557...

output:

63900
78037
160809590755
33682
2
45426
4
423101336650
57439
74329
229469486478
0
6
361653135792
6
69917487691
134900361207
149827878912
493107297584
56353
73391
348797796429
80503
362443309056
220883714048
4
4
165862942489
379777808265
424733545667
213012918903
462752019846
2
200111314606
2015001252...

result:

ok 100000 lines

Test #53:

score: 0
Accepted
time: 167ms
memory: 19448kb

input:

262141 100000
550096325702 699294061662
740794 540858146374
303418 804759262138
392080916474 392080916484
539451 125619696760
424887333876 476220175701
491792507526 491792611802
543130472857 826584737359
122470 283946678200
259438154315 672820961139
666976652826 666976693524
839851 885898869353
4320...

output:

135629338342
491670544355
731572261426
9
114195051817
46664510873
94793
257676258272
258123779361
375788789358
36998
805332351772
87532
94118029055
2
386378279870
117124335862
21373
687634281772
3
110420
158466
306289078760
109733
9
566038588
3
52220
6228
25460
141260
132164405176
6
31415
6
150528
6...

result:

ok 100000 lines

Test #54:

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

input:

262144 100000
188027261220 468541225869
441439547775 441439707096
536512036863 536512036868
252130885631 252130885634
722184 691497713908
283102993888 283103053392
883446799640 883447000776
29025 703561961875
14762 748510078805
853424 812574481465
899552 401224531637
147719995818 394101618456
475715...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #55:

score: 0
Accepted
time: 30ms
memory: 19472kb

input:

524288 100000
618055 601893434596
719559065594 719559065599
307169332346 307169552002
159282364412 159282364416
183003772727 491032214436
719357214718 719357214721
153277782464 153278191426
327546683371 661402262742
481129875082 481129955830
196076 652020750435
428068 397968641698
657025 74681856965...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

ok 100000 lines

Test #56:

score: 0
Accepted
time: 44ms
memory: 19488kb

input:

524291 100000
40396 902227103026
413462 876480753908
813562871390 939296651786
211365221925 211365412945
378624307629 412213581163
409783500796 409783500802
37845613455 37845713701
865604 951294223105
78085185205 164472602116
788601925360 788601974560
85881520127 85881520131
109452 560664803137
3311...

output:

676670267999
657360232127
94300315095
139097
25191927403
5
50123
713470025140
64790596090
24600
3
420498536146
179329992494
566366
463226582588
620031
547471765329
407818
634167923542
457944832924
15036
7
638494172304
6
312794276223
510464
562777
569694441074
5
46985
1569
8075
3
14158
177114
3750242...

result:

ok 100000 lines

Extra Test:

score: 0
Extra Test Passed