QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#316836#8167. Yet Another Simple Math Problemucup-team2000#AC ✓69ms3748kbC++202.9kb2024-01-28 04:36:572024-01-28 04:36:58

Judging History

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

  • [2024-01-28 04:36:58]
  • 评测
  • 测评结果:AC
  • 用时:69ms
  • 内存:3748kb
  • [2024-01-28 04:36:57]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long
#define lep(i,a,b) for(int i = (a); i <= (b); i++)
#define rep(i,b,a) for(int i = (b); i >= (a); i--)
#define pi pair<int,int>
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define f first
#define s second
const int inf = 1e18;

void submit(int ans) {
    cout << ans << "\n";
}

int get_sqrt(int x) {
    int res = sqrt(x);
    // cout << "x: " << x << ", res: " << res << "\n";
    while (res * res < x) res++;
    while (res * res > x) res--;
    // return 0;
    return res;
}

__int128 F(__int128 b, __int128 x) {
    __int128 res = b * b - 2LL * x * x * b + x * x * x * x + x;
    return res;
}

int bf(int xx) {
    int ans = 0;
    for (int a = 1; a <= xx; ++a) {
        for (int b = 1; b <= xx; ++b) {
            for (int x = 1; x <= xx; ++x) {
                for (int y = 1; y <= xx; ++y) {
                    if (x + y * y == a && y + x * x == b) ans++;
                }
            }
        }
    }
    return ans;
}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int t;
    cin >> t;
    // t = 0;
    // for (int i = 1; i <= 100; ++i) {
    //     cout << bf(i) << endl;
    // }
    while (t--) {
        int n;
        cin >> n;
        if (n == 1) {
            cout << 0 << endl;
            continue;
        }
        // int max_cand = 512LL * (int)pow(n,.25);
        // int mx = min(n, max((50LL), max_cand));
        // int ans = 0;
        // cout << "mx: " << mx << "\n";
        // lep(x,1,mx) {
        //     // 1 <= f(b) = b^2 - 2x^2b + x^4 + x <= N, and b > x^2
        //     // minimum is at b = 2x^2 / 2 = x^2
        //     int minb = x * x + 1; // it's also the minimizer of f(b)
        //     // maxb = (2x^2 + sqrt(4x^4 - 4(x^4 + x - N))) / 2 = x^2 + sqrt(4N-4x) / 2
        //     int maxb = x * x + get_sqrt(4 * n - 4 * x) / 2;
        //     // cout << "x: " << x << ", minb: " << minb << ", maxb: " << maxb << "\n";
        //     maxb = min(maxb, n);
        //     // // cout << "x: " << x << ", minb: " << minb << ", maxb: " << maxb << "\n";
        //     __int128 fmin = F(minb, x);
        //     __int128 fmax = F(maxb, x);
        //     // cout << "fmin: " << fmin << ", fmax: " << fmax << "\n";
        //     if (minb > n or fmin > n or minb > maxb) continue;
        //     ans += (maxb - minb + 1);
        // }
        // cout << ans << endl;
        // if (bf(n) != ans) 
        //     cerr << "Input: " << n << endl << "Correct: " << bf(n) << "\nIncorrect: " << ans << "\n";
        int l = 0, r = 1e9 + 1;
        while (r - l > 1) {
            int m = l + (r - l) / 2;
            if (m * m + m <= n) l = m;
            else r = m;
        }
        if (n >= l * l + l && n <= l * l + 2 * l + 1) cout << l * l << endl;
        else cout << l * l + 2 * (n - (l * l + 2 * l + 1)) << endl;
    }
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3612kb

input:

3
6
1
101

output:

4
0
83

result:

ok 3 tokens

Test #2:

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

input:

100000
73697
33010
17110
47753
12905
6499
31281
81851
77880
81156
73047
17517
37475
77689
74726
65569
63357
6041
61519
88597
1857
65620
55973
56676
28171
88517
65432
20685
41538
92074
39812
86863
83657
14646
76700
47385
10860
39669
52855
22282
53629
751
99085
6000
22003
31593
99242
61157
17982
91695...

output:

73412
32761
16900
47524
12769
6400
30976
81335
77362
80656
72655
17347
37249
77284
74378
65091
63001
5929
61039
88209
1780
65193
55696
56233
27889
88209
65025
20449
41209
91734
39601
86436
83216
14410
76176
47089
10697
39340
52441
22066
53361
720
98596
5918
21807
31329
98630
60812
17741
91204
6889
4...

result:

ok 100000 tokens

Test #3:

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

input:

100000
160180
187088
148262
131783
150002
191047
129104
182104
184772
178235
186435
138698
127656
123653
177758
100482
125119
167843
124055
103132
152479
104642
194899
132355
123847
193194
194873
178916
175841
117262
129672
150143
127638
194555
138335
172329
140523
110097
162171
109223
181161
175245...

output:

159561
186624
147530
131072
149462
190252
128610
181476
184041
177543
185761
138269
127150
123201
177241
99856
124609
167281
123503
102582
152079
104310
194436
131769
123201
192721
194384
178084
175284
116877
129025
149744
127114
193748
137641
171604
139876
109561
161604
108887
180625
174724
174724
...

result:

ok 100000 tokens

Test #4:

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

input:

100000
238477
256863
242340
219760
228952
207769
262740
218587
206771
293488
260702
275398
285009
280986
276277
288379
206627
233898
269368
289359
297756
296868
207800
228187
234948
285577
283037
262580
249030
256755
293865
276867
208279
275761
239079
268814
257050
254116
230023
222294
232350
268703...

output:

237835
256036
241633
219024
228465
207025
262144
218089
206116
292681
260100
274576
284089
280013
275625
287316
206116
233289
268338
288369
297025
295936
207025
227529
234256
284931
281987
261993
248062
256036
292883
276007
207711
274848
238144
268269
256038
253209
229441
221806
231413
268047
210681...

result:

ok 100000 tokens

Test #5:

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

input:

100000
999999997999951124
999999998000044057
999999997999964982
999999997999968201
999999997999963700
999999997999996275
999999997999971870
999999997999963885
999999997999977051
999999997999952461
999999997999994767
999999998000039863
999999998000026619
999999997999958630
999999997999950140
99999999...

output:

999999996000000004
999999996000088116
999999996000000004
999999996000000004
999999996000000004
999999996000000004
999999996000000004
999999996000000004
999999996000000004
999999996000000004
999999996000000004
999999996000079728
999999996000053240
999999996000000004
999999996000000004
999999996000028...

result:

ok 100000 tokens

Test #6:

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

input:

100000
999999999999913074
999999999999972587
999999999999957394
999999999999925037
999999999999900175
999999999999987311
999999999999909387
999999999999911617
999999999999965130
999999999999937693
999999999999940938
999999999999968793
999999999999900967
999999999999969472
999999999999951416
99999999...

output:

999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000...

result:

ok 100000 tokens

Test #7:

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

input:

100000
485634
702903
175391
667431
816875
788363
729015
642127
710727
792929
600860
276818
117734
946204
370130
817015
664789
158967
100650
988103
729721
564341
765631
994429
384089
70552
31177
728581
190172
570219
476533
991964
286865
817530
824770
893948
282986
573144
117053
692662
868106
996074
8...

output:

484416
701887
174724
665856
815409
786769
727609
641052
709120
791979
599546
275909
117134
944784
369381
815409
663724
158404
100178
986183
728419
563180
763888
992856
383161
70225
30976
727609
189377
568904
475587
990025
286225
816037
823261
892982
281961
571726
116459
691437
866761
994149
895936
9...

result:

ok 100000 tokens

Test #8:

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

input:

100000
4283064
4181899
6950894
1197034
4274577
1745181
1136059
5673541
3330189
3658740
1054078
8653772
3263782
4903429
7882831
2518096
5651061
4641583
1938694
1667040
8847284
1054859
1609442
6866810
4053982
8856328
9883074
5853225
6664188
5238594
1095042
7246725
2163117
3152986
7121326
5988575
49018...

output:

4280761
4177936
6948021
1195045
4272489
1742680
1134225
5669161
3326976
3655744
1052676
8649481
3261636
4900635
7879249
2515396
5647240
4639143
1936941
1664818
8843945
1052936
1607824
6863981
4051770
8850625
9878449
5850052
6661561
5234944
1093877
7241481
2160900
3150625
7118224
5984448
4897449
3141...

result:

ok 100000 tokens

Test #9:

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

input:

100000
23338480
45671220
31612547
91544809
17941362
26429323
45152394
34119380
18957871
75013098
44853701
34637476
31645817
44871034
57062342
88925157
98862950
10461030
20791540
70285218
97042918
45247016
99026697
70028123
85201252
64732472
55998055
91399279
42054389
44290120
59686694
51689414
12917...

output:

23328900
45658361
31606884
91527489
17935225
26419600
45144961
34109798
18949719
74995954
44844200
34629958
31639760
44863204
57047809
88906555
98843364
10456837
20784481
70274689
97023934
45239076
99011092
70016087
85191145
64722025
55985856
91385839
42042256
44277906
59675625
51681721
12910141
118...

result:

ok 100000 tokens

Test #10:

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

input:

100000
698412329
711567069
329613633
155908288
934086790
639687281
168426402
916723873
343661959
285253985
920116797
582058897
137744672
792383952
901146770
588069812
774596572
859750243
711132549
532240255
985260742
157862111
372088274
377247240
827706897
362831281
280727164
689844666
737623783
193...

output:

698385476
711525164
329586932
155891409
934035844
639638715
168402529
916690464
343629399
285235872
920082040
582015625
137732177
792345406
901093142
588028625
774564561
859720804
711082876
532209471
985206544
157844999
372065521
377214084
827655361
362798163
280696516
689797696
737581968
193321216
...

result:

ok 100000 tokens

Test #11:

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

input:

100000
4753822169
3283171762
8196465355
1924628216
7973465107
8068075405
6115220983
5534949527
7398405036
2467709580
5673779238
4688076218
2577098956
1526939630
3552300200
8594409277
4886811720
1894384170
7207497895
8466761835
2241507212
3828146584
9968434726
8529282121
2481963084
8952765750
8921609...

output:

4753688809
3283060804
8196344487
1924576900
7973333191
8067979483
6115083601
5534836652
7398236169
2467614833
5673702853
4688003961
2577011158
1526867333
3552201998
8594230707
4886709025
1894338576
7207330816
8466579416
2241454336
3828025041
9968244805
8529118219
2481893770
8952587102
8921472165
858...

result:

ok 100000 tokens

Test #12:

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

input:

100000
91573725670
39707375551
54650489676
64267129941
88370193687
29754408533
60704762829
54286239283
13290652456
15626456656
40646713751
39992343827
70110750471
93588169039
86282918702
74196144627
11425364990
44058064469
68026397883
77519728818
41218510187
62552632288
10151291139
85947510892
70007...

output:

91573417321
39707015280
54650228729
64266813081
88369745392
29754180036
60704450204
54285808543
13290443118
15626250025
40646432183
39992000400
70110404719
93587658241
86282600121
74195767321
11425257882
44057699139
68026029124
77519366929
41218275800
62552253342
10151167009
85946959225
70007121734
...

result:

ok 100000 tokens

Test #13:

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

input:

100000
336614433991
293307962022
307651885872
533763505243
575680769069
789982754949
129034078788
668980238612
952985097607
442316099685
708568157897
487296030031
576493722650
952041486737
438131330563
553192840659
994332901268
609688081317
469518269467
844312508981
352814333793
323690907960
9454697...

output:

336613473856
293307027646
307651043569
533762340024
575679702971
789981438481
129033459782
668978801657
952984011681
442315424611
708566631696
487294744225
576492451441
952039794947
438130143396
553191868420
994331753969
609686920360
469516942711
844311050496
352813428361
323690230201
945468411904
2...

result:

ok 100000 tokens

Test #14:

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

input:

100000
9338406775990
5865297464821
7764657830710
8710469317620
1262592178439
1241203947470
1201355122667
2594550278033
7579666104848
2006548517418
4043441016563
5886451134171
1395091999128
8148349341075
7856358754123
2049205281140
5651936159511
2251062833788
2607988008873
8887794573463
3649334632713...

output:

9338402574400
5865294454569
7764654699169
8710465910041
1262590539776
1241202454106
1201353953240
2594547777600
7579662475298
2006545908676
4043437288900
5886446440000
1395089936377
8148345743128
7856354920561
2049203702016
5651931899863
2251060541553
2607985985476
8887791246847
3649331480452
295177...

result:

ok 100000 tokens

Test #15:

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

input:

100000
21287197703309
80225220105173
62201835347483
85828073530903
33266620810498
28373164709488
80165722501793
63649752311741
77876883566305
87389553104754
19348999898467
90585289291250
69480204651227
26806883973327
25088781191738
77584449380553
54326202322646
37024871187975
71745044929292
87588811...

output:

21287189600984
80225206633032
62201819850743
85828058782783
33266613016269
28373157609316
80165709728564
63649744137084
77876866238091
87389535008169
19348992765001
90585278730341
69480193488484
26806878560287
25088773688837
77584440089209
54326188565870
37024864057636
71745033419536
87588800688560
...

result:

ok 100000 tokens

Test #16:

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

input:

100000
461925988595662
733815344186915
264238822769451
255201595157604
773110247001784
504603338407129
252051745738805
431478992211894
166858580963248
936676094890388
279688881664070
347538535298296
118001518477231
150545928909756
771838938419447
410492953211058
603030970314283
554074734743089
54554...

output:

461925965806369
733815304567103
264238803608279
255201574864249
773110198774249
504603306244129
252051726042769
431478967706461
166858559201122
936676063466896
279688864657801
347538514823598
118001505106263
150545906181225
771838908478796
410492925390625
603030925529344
554074693589331
545546926446...

result:

ok 100000 tokens

Test #17:

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

input:

100000
5894009146616805
2476856326862828
3232558718701871
8396218067421859
1810666376255466
5545873675440379
8601624627154257
8077879530060255
2518668182780155
7824168257122245
1436660593329231
1465122925083228
2099350779068251
1683082260221361
8847029506537265
4605214849477293
9220596247820913
4114...

output:

5894009060686211
2476856241788982
3232558640888528
8396217965269320
1810666321205625
5545873541066884
8601624452073249
8077879437269887
2518668120359556
7824168141931584
1436660529923025
1465122862710833
2099350703843584
1683082214398225
8847029373252032
4605214757467832
9220596092884225
41149526895...

result:

ok 100000 tokens

Test #18:

score: 0
Accepted
time: 61ms
memory: 3616kb

input:

100000
68037587602011677
76630309667872566
97297435328515949
46968372184183581
59630660625698521
39148300495894679
13581567349666336
42124388875491820
77887570094466807
86054451900209305
43331197666080754
97960645347319347
59508001996503320
32423250536180031
98983447454263363
57502573009020275
33974...

output:

68037587178558392
76630309273217930
97297434831245739
46968371964520280
59630660308822201
39148300222178436
13581567171480361
42124388573783824
77887569799531807
86054451313864948
43331197323277669
97960644956142409
59508001652657001
32423250262558588
98983447058089801
57502572625489188
339748319044...

result:

ok 100000 tokens

Test #19:

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

input:

99623
355942381268932176
572732363888298294
198364115932909301
472038623989094254
478559638194732179
287650294028631833
719444395772271301
475511793379639876
773764545181392902
776307240804233476
429949818515620436
833579156045241430
647606040489400495
351924040104347413
903023144554091511
853573379...

output:

355942380131599454
572732362863762701
198364115176146915
472038623147448900
478559637427901759
287650293311086059
719444394599277480
475511792570524161
773764543470075677
776307239292462918
429949817585403953
833579154416924721
647606039478390756
351924039303171507
903023143318093024
853573377748341...

result:

ok 99623 tokens

Test #20:

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

input:

99623
237024468816860113
155875041941950978
637503853633856340
727928835742441195
812672314344586359
120000986351726693
662357670552584652
515915836070138445
154251793592847509
795147570482942791
654992393635417869
468770191739686399
704036517807426017
438236781070484872
672367723390736107
855971610...

output:

237024467921895307
155875041185183733
637503852626304457
727928834702755543
812672313263692816
120000985788417992
662357669211302464
515915835331478596
154251792903738536
795147569441304676
654992392711896009
468770190802515364
704036516580807921
438236780257735209
672367721907381124
855971609354941...

result:

ok 99623 tokens

Test #21:

score: 0
Accepted
time: 32ms
memory: 3668kb

input:

99246
220657779674204413
646288939313437688
307653819900896952
691312108923300849
773441891533305507
204900201222306189
839962672454678073
240807685903641882
712062355993781361
742769316591953300
625502764600882833
414003837330244926
403464280907039300
776188665636618584
241103019702183022
796216574...

output:

220657778852830827
646288938150556937
307653819108912004
691312107363565249
773441890293613401
204900200477481155
839962670769311076
240807685063610162
712062354390722848
742769315125714953
625502763610786084
414003836532827401
403464279915923913
776188664102684366
241103018906746084
796216573596978...

result:

ok 99246 tokens

Test #22:

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

input:

99527
599021952000796317
386833885691276636
705924628788540913
723134243584179833
208909051261577763
959678180389019804
437235467536268384
957954607826730947
632830737535518834
567967208764389311
936583409714202295
170358824398702106
151389849650550289
124465389775515640
119928441457878573
506445056...

output:

599021951202535411
386833884595042369
705924627446977728
723134242530492004
208909050459964416
959678179340737274
437235466500633241
957954606414918025
632830736324441281
567967207583682575
936583408524036025
170358823831011841
151389849159595225
124465389382176498
119928440940083827
506445054972519...

result:

ok 99527 tokens

Test #23:

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

input:

99018
341568970810374501
549576978652034425
249780052329340624
626119373435067072
299666571503216401
654218042180356202
592768816313826734
329239611479532163
735780524097248290
146849750609851967
970323953014920875
521001090432705067
191606203736412813
317645713607989165
246775017183857567
390317611...

output:

341568970015554475
549576977295806464
249780051398680009
626119372265769337
299666570733429025
654218041190761110
592768814890658126
329239610667814401
735780522526693581
146849750049620401
970323951682851984
521001089483618704
191606202943057764
317645712970046224
246775016231012636
390317610496321...

result:

ok 99018 tokens

Test #24:

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

input:

100000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000000000
1000000000000...

output:

999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999998000000...

result:

ok 100000 tokens

Test #25:

score: 0
Accepted
time: 32ms
memory: 3688kb

input:

100000
999999999930304345
999999998761206308
999999998848780264
999999999098238962
999999999164369521
999999999938252134
999999999431018136
999999995403999420
999999995007812246
999999996796630665
999999997781862894
999999999921720823
999999997050886918
999999996661578986
999999995429116659
99999999...

output:

999999998000000001
999999997522412618
999999997697560530
999999998000000001
999999998000000001
999999998000000001
999999998000000001
999999994000000009
999999994000000009
999999995593261331
999999996000000004
999999998000000001
999999996000000004
999999995323157973
999999994000000009
999999996000000...

result:

ok 100000 tokens

Test #26:

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

input:

100000
825596120220406673
567746539037492385
445853241117308154
550168346924850306
591081974698770522
615720078234119219
984669183659175267
136688292237640518
860124172794274709
367761369681808866
955857781204665943
742958714892637760
39855776838020879
166357183193620148
783379399096912506
967295987...

output:

825596119045326947
567746538126701476
445853240044956269
550168346182145014
591081973587562249
615720076863518929
984669182077890340
136688291692157209
860124171650009616
367761368970261973
955857779595882436
742958713617994622
39855776637261456
166357182414408369
783379397628375076
9672959859346124...

result:

ok 100000 tokens

Test #27:

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

input:

100000
972131728513579978
671141655406193344
668525225993848888
314955095481003545
153590182387449431
849824035786190027
746547207487422862
715956143039471697
240212848356324519
536190411865467832
190118086545897960
584019532853227177
823786627573281919
339406452940749277
361483970296784417
10281505...

output:

972131727388921494
671141654418146526
668525224853131378
314955094880795483
153590181939423889
849824034318180100
746547206544671770
715956142012151056
240212847516528769
536190411051056644
190118085785456929
584019531587430436
823786625908686400
339406452056688016
361483969252061195
102815057818128...

result:

ok 100000 tokens

Test #28:

score: 0
Accepted
time: 47ms
memory: 3604kb

input:

100000
728056150923568805
99723960650631544
538311039425823553
41958770689887175
572853267278650079
504103682784619960
498378039129973017
293077713103178385
827391119411225554
946457705528780911
664132068961707278
782575888093235554
279040446305104857
432606649421983014
41054504695467783
56901331135...

output:

728056149861540096
99723960102074049
538311038352048900
41958770445860748
572853265928878896
504103682066723649
498378037762925635
293077712225109529
827391117991797241
946457704226494084
664132067492818362
782575886490563085
279040445310254452
432606648166560000
41054504438028799
569013309880024681...

result:

ok 100000 tokens

Test #29:

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

input:

100000
595410838979504189
835536799253816398
444334830861481353
906885195480157456
93207011866280452
136780218367466620
259968424710898346
273624579663278982
323762766053883989
392598428025320001
150349523781548603
852389602409163496
74828280484013232
160503988985377640
982302529031595828
9744368166...

output:

595410838098120131
835536798187398357
444334830074822404
906885193947040000
93207011438445681
136780217992581409
259968423997958573
273624579004263805
323762765040405601
392598427397463488
150349523259615572
852389600651557633
74828280165141889
160503988257660100
982302527341776433
97443681519217824...

result:

ok 100000 tokens

Test #30:

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

input:

100000
654063826468826464
554666354304343127
891492182988786077
718657652199695000
325993152413925410
931324165040034858
409662884888072688
443994853809317161
546715350890235545
991396634407425786
391646312248382838
15685823502959353
676933143070159568
995589104114727808
897335590392320331
771220270...

output:

654063824953168801
554666353252938656
891492181849277112
718657651148200913
325993151730324621
931324164040165318
409662883693363876
443994852973521003
546715350137688484
991396632514072576
391646311546754389
15685823326705249
676933142183643024
995589102760588996
897335588551644583
7712202685190585...

result:

ok 100000 tokens

Test #31:

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

input:

100000
20695258201809
68852712758099
48921966342
6327226897268215
1546892060
19399941524098515
86047150549201
635810770732199
37892965562494
9786554374154
1409680964948324
9419301546540
9297018780969178
40733063118
756923917558
328776259026460
972165099595770372
7228460095624
663969514
322960080
885...

output:

20695250271595
68852704071684
48921570830
6327226777313689
1546848900
19399941285803584
86047138200483
635810742110879
37892956226461
9786548695716
1409680914669689
9419295803161
9297018678835858
40732795613
756922620169
328776240121201
972165098214023185
7228457039241
663938289
322927378
8858921723...

result:

ok 100000 tokens

Test #32:

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

input:

100000
255927976814
23453157882086343
24991692926044
986419947655
84411131068713195
65651549619
422552056496684
735454697694602791
4447525265
923949398
81099266459
243996084201602
592473140175226999
252518988833506
3389880691709
6657473579
19339467100727294
3536969113
2167404127906
60031996616658
59...

output:

255927214394
23453157632600644
24991685163190
986418430596
84411130688467969
65651250625
422552016924186
735454696072437559
4447422721
923916816
81098884520
243996053262581
592473139233426639
252518959289605
3389877510244
6657366324
19339466946553744
3536900499
2167402284100
60031984376961
596364811...

result:

ok 100000 tokens

Test #33:

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

input:

100000
16449489440446969
364559585463714601
22473911766564196
30011396328576576
43925956607556
1532536778026384
18899312936451984
400518238595200609
150707082518430201
686143741186767721
229158343945029321
100723681354563136
71474509841703241
388876079477298436
121381533615769729
49364609610627441
1...

output:

16449489183935844
364559584256139204
22473911466738169
30011395982100625
43925943352225
1532536699731129
18899312661502441
400518237329470404
150707081742010000
686143739530091844
229158342987619600
100723680719823249
71474509307008900
388876078230099849
121381532918972676
49364609166264484
11350419...

result:

ok 100000 tokens

Test #34:

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

input:

100000
191577482028922498
1238775450922567
21388990837560024
342029520922410000
313555689885310097
84226190341030144
29712077080767228
829579087728656332
15447292672231045
3441574363894486
75121585721747927
133595778610198968
7240350134521009
188798825389377422
913066694220114755
294453879503786211
...

output:

191577481153531201
1238775380530087
21388990545060516
342029519752744201
313555688765389227
84226189760595169
29712076736023402
829579085907031690
15447292423656771
3441574246564624
75121585173581584
133595777879183844
7240349964340516
188798824520357689
913066692309024289
294453878418514120
9015972...

result:

ok 100000 tokens

Test #35:

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

input:

100000
23517737541080
14338150230623
3090796060357
23890648359
5072954391687
55599615945227
15204758851581
75123389390622
19286543377
6750445778245
47264098762321
26329018454762
29658752620227
44361434351841
43793913583807
76204798775294
4058069236227
89715089958022
7722896580097
22975648197266
1713...

output:

23517727842064
14338142657476
3090792544227
23890339231
5072949887047
55599601032200
15204751052929
75123372055876
19286265627
6750440581923
47264085012544
26329008192402
29658741728260
44361421030969
43793900348416
76204781316225
4058065207300
89715071014416
7722891022081
22975638610685
17130569102...

result:

ok 100000 tokens

Test #36:

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

input:

100000
276521761481756098
40654510891683
347597930686041541
508086180837799996
132606099374740579
891748402457011411
133476174766179676
19491783905347830
969719997130607577
149492139784011921
171943001019921498
6301162014952691
364795075323991728
248698951147106558
69434493457126546
1212460871942565...

output:

276521760430116496
40654498183744
347597929506929859
508086179412292881
132606098646529135
891748400568398103
133476174035519958
19491783626215262
969719995161217161
149492139010789689
171943000190650404
6301161856285784
364795074116086329
248698950149746009
69434492930122530
12124608499240000
11684...

result:

ok 100000 tokens

Test #37:

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

input:

100000
468209960998844330
914373128764359812
478112874812785422
53918725712687660
767379138711209472
964716017898775142
589708642056986342
326238020758042512
118368423876718500
838164700436815962
832093111009730262
288194261439937452
90877566363378906
415688057476470
9763311460490370
300428377639781...

output:

468209960314585636
914373127808131216
478112874121328356
53918725480483600
767379137835207681
964716016916575561
589708641289061449
326238020186870016
118368423532671376
838164699521302609
832093110097538884
288194260903100176
90877566061919844
415688037088041
9763311361680900
300428377091667841
256...

result:

ok 100000 tokens

Test #38:

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

input:

100000
143471616119543255
175295610657793783
648514940459890
254911132688126254
131750035021437251
893169334736536863
741734943051843554
165956805960163258
153900089900739379
416367660344283899
117394527139178259
1680044302873993
599060542545710209
799495743298031820
215747966472334505
3512138981722...

output:

143471615740766783
175295610239110596
648514914993933
254911132183239006
131750034658463375
893169333791460496
741734942190603201
165956805552785293
153900089508438360
416367659699018324
117394526796549409
1680044261885649
599060541771720195
799495742403886561
215747966007847728
351213897579586441
3...

result:

ok 100000 tokens

Test #39:

score: 0
Accepted
time: 53ms
memory: 3728kb

input:

100000
311828570335204767
598135945908551311
273617353862811845
78123523817828312
64949455481142
318118671511935385
491827068284383321
38262031746999266
15599995636556525
86220966771161025
154548069566606507
234257488302371821
39534247534589055
25483863056377990
127033220099346260
29918706582564
174...

output:

311828569776729407
598135945135132560
273617353339660521
78123523538292736
64949447410884
318118670947900971
491827067583059419
38262031551349634
15599995511603364
86220966477496761
154548069173416487
234257487818362369
39534247335694012
25483862896682281
127033219742852522
29918701100401
1740076208...

result:

ok 100000 tokens

Test #40:

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

input:

100000
68560941983562
38699727449009
24296455643594
36860386196900
338244020158
544691971055
3891953649610
49082347568520
501057993168
59178748736758
99368131311095
20124137682040
12768905262963
589063157519
51417181683504
81496487479138
1548114514057
65494132101180
14496405174809
31198877089617
728...

output:

68560933703409
38699721228099
24296450714449
36860380125625
338243438569
544691233023
3891951676806
49082340562641
501057285313
59178741043984
99368121342736
20124133196046
12768901689600
589062390015
51417174512926
81496478451597
1548113269824
65494124008336
14496401367395
31198871504020
7280461428...

result:

ok 100000 tokens

Extra Test:

score: 0
Extra Test Passed