QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#23918#1832. Crab's CannonQingyuAC ✓445ms8960kbC++203.3kb2022-03-20 20:38:372022-04-30 04:25:40

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-04-30 04:25:40]
  • 评测
  • 测评结果:AC
  • 用时:445ms
  • 内存:8960kb
  • [2022-03-20 20:38:37]
  • 提交

answer

#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdint>
#include <utility>
#include <cassert>
#include <numeric>

using namespace std;

class Solver {
private:
	struct Diff {
		int64_t len;
		int64_t cnt;
		int64_t psum; // strictly before this segment
	};
	
public:
	Solver() : a{{0, 0, 0}} {
	}
	
	void add(int64_t x) {
		assert(stk.empty());
		doAdd({x, 1, 0});
		assert(stk.empty());
	}
	
	int64_t total() {
		int64_t ans = 0;
		for (const auto &it : a) {
			ans += it.cnt;
		}
		return ans;
	}
	
private:
	void doAdd(Diff d) {
		const size_t stkSz = stk.size();
		if (addSimple(d, false)) {
			return;
		}
		const Diff &p = a.back();
		if (d.len < p.len) {
			Diff p = pop();
			if (p.cnt == 1 && p.len > p.psum) {
				d.cnt += p.len / d.len;
				p.len %= d.len;
				if (p.len != 0) {
					doAdd(p);
				}
				doAdd(d);
				return;
			}
			const int64_t g = gcd(d.len, p.len);
			doAdd({g, (d.len / g * d.cnt) + (p.len / g * p.cnt), 0});
			return;
		}
		if (d.len > p.len) {
			d.psum = p.psum + p.len*p.cnt;
			stk.push_back(d);
			int64_t lay = 0;
			for (;;) {
				assert(a.size() > 1);
				Diff p = pop();
				const int64_t nxt = p.len*p.cnt + lay;
				if (nxt < d.len) {
					stk.push_back(p);
					lay = nxt;
					continue;
				}
				const int64_t dif = d.len - lay;
				const int64_t db = dif % p.len, da = p.len - db;
				if (db == 0) {
					a.push_back(p);
					assert(stk.size() >= stkSz);
					while (stk.size() != stkSz) {
						a.push_back(stk.back());
						stk.pop_back();
					}
					return;
				}
				const int64_t cut = dif / p.len;
				if (p.cnt - cut == 1 && p.len > p.psum) {
					if (cut != 0) {
						stk.push_back({p.len, cut, 0});
					}
					doAdd({da, 1, 0});
					doAdd({db, 1, 0});
				} else {
					const int64_t g = gcd(da, db);
					doAdd({g, p.len / g * p.cnt, 0});
				}
				assert(stk.size() >= stkSz);
				while (stk.size() != stkSz) {
					addSimple(stk.back(), true);
					stk.pop_back();
				}
				return;
			}
		}
		assert(false);
	}
	
	bool addSimple(Diff d, bool force) {
		assert(d.cnt != 0 && d.len != 0);
		Diff &p = a.back();
		d.psum = p.psum + p.cnt*p.len;
		if (d.len > d.psum) {
			a.push_back(d);
			return true;
		}
		if (d.len == p.len) {
			p.cnt += d.cnt;
			return true;
		}
		if (d.len % p.len == 0) {
			p.cnt += d.len / p.len * d.cnt;
			return true;
		}
		if (d.len == d.psum || force) {
			a.push_back(d);
			return true;
		}
		return false;
	}
	
	Diff pop() {
		Diff res = a.back();
		a.pop_back();
		return res;
	}
	
	vector<Diff> stk;
	vector<Diff> a;  // first element here is dummy, i.e. {0, 0, 0}
};

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(nullptr);
	for (;;) {
		int n;
		int64_t l;
		cin >> n >> l;
		if (n == 0) {
			break;
		}
		
		bool hasOne = false;
		vector<int64_t> a(n+1);
		a[n] = 0;
		for (int i = 0; i < n; ++i) {
			cin >> a[i];
			if (a[i] == 1) {
				hasOne = true;
			}
		}
		if (!hasOne) {
			++n;
			a.push_back(1);
		}
		sort(begin(a), end(a));
		
		vector<int64_t> d(n);
		for (int i = 0; i < n; ++i) {
			d[i] = a[i+1] - a[i];
		}
		
		Solver solver;
		for (int i = 0; i < n; ++i) {
			solver.add(d[i]);
		}
		cout << solver.total() << "\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 3ms
memory: 3564kb

input:

3 7
1 3 7
4 12
7 1 3 9
3 16
16 1 8
0 0

output:

3
5
3

result:

ok 3 number(s): "3 5 3"

Test #2:

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

input:

2 1048576
1 1048576
2 1048576
1048576 1
2 1048576
51135 13546
2 1048576
13546 51135
2 1048576
1 51135
2 1048576
51135 1
1 1048576
1
1 1048576
1048576
1 1048576
51135
2 104857600000000000
1 104857600000000000
2 104857600000000000
104857600000000000 1
2 104857600000000000
5113500000000 13546
2 1048576...

output:

2
2
3
3
2
2
1
2
2
2
2
3
3
2
2
1
2
2
2
3
3

result:

ok 21 numbers

Test #3:

score: 0
Accepted
time: 2ms
memory: 3724kb

input:

5 96
7 12 61 37 93
4 100
63 2 16 35
5 88
7 43 70 23 8
4 29
22 7 5 14
1 2
2
2 3
2 3
0 0

output:

93
6
70
22
2
3

result:

ok 6 numbers

Test #4:

score: 0
Accepted
time: 2ms
memory: 3680kb

input:

2 104857600000000000
1357531731857153 1357531731857152
2 1000000000000000000
1000000000000000000 999999999999999999
2 1000000000000000000
1000000000000000000 999999999999999998
2 1000000000000000000
1000000000000000000 999999999999999997
2 1000000000000000000
1000000000000000000 999999999999999996
2...

output:

1357531731857153
1000000000000000000
1000000000000000000
333333333333333334
250000000000000001
200000000000000001
166666666666666668
142857142857142858
125000000000000001
111111111111111112
100000000000000001
1000000000000000000
1000000000000000000
1000000000000000000
250000000000000001
200000000000...

result:

ok 21 numbers

Test #5:

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

input:

8 90
3 37 36 17 21 25 19 6
7 85
43 6 34 14 18 35 9
3 95
41 5 9
6 46
5 7 1 6 9 11
4 82
22 40 18 42
6 62
2 7 14 11 5 48
10 87
8 1 65 40 60 16 14 20 11 21
6 84
26 29 21 46 11 1
7 72
5 37 6 7 4 1 25
9 43
12 16 32 14 10 13 9 8 4
8 24
3 18 5 2 1 4 6 12
6 11
2 4 3 6 5 1
7 40
18 1 11 8 23 2 17
7 19
3 5 6 15...

output:

37
43
4
11
42
15
65
46
37
32
18
6
23
15
8
36
25
15
25
18
62
23
7
44
4
16
20
17
11
37
41
7
6
26
45
18
14
84
19
9
13
19
40
10
4
45
23
8
25
25
62
23
42
11
23
53
60
35
11
25
11
4
47
34
22
59
12
82
5
28
14
35
29
32
16
10
64
8
14
20
42
38
30
4
32
15
44
19
5
16
39
4
18
24
39
63
10
23
15
29
10
18
21
34
72
1...

result:

ok 46052 numbers

Test #6:

score: 0
Accepted
time: 50ms
memory: 3580kb

input:

8 22
2 8 15 13 4 6 16 5
6 77
44 35 21 42 22 2
5 38
1 17 15 7 26
10 39
34 18 20 3 12 28 23 6 8 10
10 49
40 3 7 19 22 6 38 12 23 14
7 22
14 1 11 5 8 2 7
8 53
3 8 16 47 25 29 6 18
3 45
4 26 1
3 35
15 6 7
6 13
4 8 11 10 3 5
9 64
18 29 43 36 28 7 5 30 10
7 41
12 7 2 26 11 19 13
6 58
7 37 49 3 4 22
4 87
9...

output:

16
44
26
34
40
14
47
3
8
11
43
26
49
21
25
22
29
42
29
13
7
24
67
60
54
31
50
27
4
6
52
54
23
62
4
45
41
22
16
26
57
3
49
42
8
27
19
47
48
17
18
56
32
56
18
54
7
66
66
16
76
19
17
24
29
12
38
35
9
65
21
12
11
13
31
23
10
43
61
11
5
35
4
68
4
10
30
77
16
5
15
21
44
19
35
70
41
60
37
74
35
8
50
15
69
...

result:

ok 46268 numbers

Test #7:

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

input:

10 11
1 10 6 7 4 8 11 3 9 2
8 28
24 1 23 17 6 5 4 18
9 60
28 47 11 4 52 1 48 9 19
3 69
45 15 58
8 35
14 25 23 21 24 10 4 15
7 58
12 55 14 52 53 17 34
5 69
68 1 45 65 9
5 47
46 33 8 45 15
9 16
11 14 2 9 13 7 5 4 1
4 45
18 6 12 23
9 74
40 72 11 26 27 48 57 14 29
7 41
36 28 5 12 17 26 27
6 11
2 3 7 6 9...

output:

11
24
52
58
25
55
68
46
14
23
72
36
9
73
16
9
64
32
52
35
25
12
38
86
5
46
9
69
24
87
61
10
6
90
9
5
56
17
4
12
45
14
40
30
51
32
82
26
50
58
50
16
64
78
47
73
11
71
13
56
60
22
45
68
70
7
73
40
58
56
13
60
21
50
70
63
86
20
58
87
45
5
87
96
86
84
69
37
47
5
30
20
53
48
52
48
6
82
45
84
17
67
47
50
...

result:

ok 46259 numbers

Test #8:

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

input:

10 62
56 55 61 52 50 59 60 35 49 33
7 61
55 38 31 58 50 54 45
7 100
44 53 76 66 71 47 31
10 52
45 27 4 50 15 43 23 17 39 36
3 73
37 56 27
8 18
13 15 11 17 4 16 5 12
4 44
38 35 23 30
4 91
66 82 23 21
6 70
18 32 70 39 43 66
3 82
32 55 77
10 41
19 16 41 40 31 34 22 14 33 21
4 29
26 14 11 5
6 13
7 4 13 ...

output:

61
58
76
50
56
17
38
82
70
77
41
10
13
6
70
30
76
25
50
25
6
80
77
22
75
67
88
60
42
78
43
90
24
68
63
88
76
79
70
37
31
86
34
22
85
29
77
16
37
18
38
67
51
46
60
64
24
25
51
70
21
42
72
88
41
49
68
40
30
38
23
67
20
38
78
61
13
43
25
32
25
61
67
13
27
22
10
56
32
47
34
50
40
47
24
40
48
77
32
61
71...

result:

ok 46111 numbers

Test #9:

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

input:

10 57
50 38 37 21 40 26 41 54 36 18
10 38
17 18 36 23 33 10 27 37 28 38
6 15
7 8 12 9 14 13
10 20
18 9 16 19 8 14 13 15 20 11
7 40
40 32 38 23 31 39 28
8 16
3 8 14 5 12 13 9 15
5 72
49 43 20 72 65
6 49
29 49 27 28 16 46
5 49
23 40 49 38 47
6 24
22 24 19 7 15 17
4 26
19 12 24 18
8 33
18 16 32 28 21 1...

output:

54
38
14
20
40
15
72
49
49
24
24
32
98
13
74
41
18
69
76
71
19
66
66
66
61
45
61
60
17
16
13
51
97
79
65
41
46
86
91
13
35
28
11
13
31
72
58
33
29
40
43
58
86
42
54
50
75
41
15
31
35
31
17
70
82
57
73
63
17
57
58
30
65
18
89
17
82
60
57
36
9
96
46
38
96
30
67
29
66
28
10
12
67
27
73
37
19
70
19
31
4...

result:

ok 46070 numbers

Test #10:

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

input:

63 293
37 157 134 106 118 47 26 71 4 159 17 194 55 27 89 228 29 252 64 162 66 207 7 56 46 22 114 260 80 165 111 40 52 85 70 189 98 146 195 65 79 92 130 179 137 240 110 150 13 61 84 20 184 32 122 141 16 10 138 123 23 153 19
95 814
446 385 476 428 267 84 205 11 471 298 220 312 550 168 233 208 572 261 ...

output:

260
769
325
295
414
923
725
702
136
773
125
262
926
625
566
294
421
569
700
487
815
704
540
185
85
611
417
133
693
813
373
173
631
579
125
609
409
687
119
706
829
183
136
686
567
716
571
583
823
136
209
688
707
304
464
567
733
271
120
818
768
659
396
297
109
813
728
345
211
362
234
453
359
409
815
6...

result:

ok 5395 numbers

Test #11:

score: 0
Accepted
time: 3ms
memory: 3572kb

input:

3 10000
5253 9111 5145
3 10000
5290 5382 9250
5 10000
3505 3996 5174 3776 415
3 10000
8365 4600 3712
3 10000
3668 3914 3658
3 10000
3648 4610 2944
3 10000
4309 3980 8036
3 10000
7111 4982 3155
5 10000
8051 3974 4913 5725 3375
3 10000
2285 4959 7893
5 10000
9404 7812 9329 1856 1716
5 10000
3360 7886 ...

output:

1520
2314
5174
16
3914
4610
8036
7111
8051
12
9404
9607
9421
9533
8940
8558
8572
9622
1373
9530
9635
8787
9246
679
7665
8752
1613
1522
1881
7394
9843
5698
7
4
8866
7863
7402
8195
4
6505
9037
9957
7
7
5
15
8858
2759
9651
9286
7211
3560
4
1111
7
8533
9
7080
7679
9464
26
7747
7770
7954
9023
9000
9030
9...

result:

ok 756 numbers

Test #12:

score: 0
Accepted
time: 83ms
memory: 3576kb

input:

3 1000000
703460 841142 629499
3 1000000
10388 800310 409776
3 1000000
472386 13202 846619
3 1000000
77612 238304 760019
4 1000000
73618 988173 666955 401178
3 1000000
504784 342008 725483
4 1000000
94069 800796 901523 949145
4 1000000
571463 301658 812159 524251
4 1000000
418389 816602 935310 84498...

output:

841142
6
5
4
988173
725483
949145
812159
935310
937357
586497
693502
649037
913699
886160
850880
952605
861110
882630
4
643854
823043
41
6962
6
6
829090
722310
210085
920056
296289
798732
864152
7
633131
247906
22
989722
183772
197253
836373
912378
920857
339250
468839
350561
969414
4
570120
5
4
992...

result:

ok 75028 numbers

Test #13:

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

input:

4 1000000
80742 49379 33810 17194
5 1000000
59867 128221 148833 81216 15277
3 1000000
57215 50260 62505
4 1000000
72963 2157 4430 105265
3 1000000
239435 187963 38064
5 1000000
39522 68942 1827 22843 35773
5 1000000
275 106071 128158 116848 226360
4 1000000
33948 474210 8983 19592
4 1000000
10676 56...

output:

80742
148833
12502
8
14
68942
226360
7
7
6
110147
5
220682
123526
87370
85629
6
5
5
7
145757
87844
499984
5
8
159783
284307
30160
28837
129212
4
6
2290
246950
12
6
134509
10
210171
10
80579
4
123387
39780
52583
277282
16056
13
4
4
9
139975
107066
11
105537
25466
7
32
78202
18
6
82955
8
79104
21629
3...

result:

ok 74986 numbers

Test #14:

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

input:

4 1000000000000
662956367204 179492692315 457311598832 909993870149
3 1000000000000
50389870664 481695799893 851779529670
4 1000000000000
746384499370 850847313795 450964888390 174847542897
4 1000000000000
492850862659 333078318458 966932740546 519957480142
3 1000000000000
760782654349 822435407075 ...

output:

909993870149
5
850847313795
966932740546
822435407075
7
359193449505
454133446930
927467518175
304
7
969093256922
389127634024
447681967073
444998446496
730770754510
858842842962
331021552126
854825559754
673537963910
916598838698
980807853257
4
828115648973
866895247104
176886943849
660517964153
6
...

result:

ok 74940 numbers

Test #15:

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

input:

4 1000000000000000000
785347247462529337 908697380605284096 913266896167754843 163839551780037564
3 1000000000000000000
507651410281667900 848150431477376183 995843596581129265
3 1000000000000000000
260533312620360232 445682051809744448 548011275469794357
4 1000000000000000000
862489969044117957 190...

output:

913266896167754843
995843596581129265
548011275469794357
108204752640204011
937234861679968272
922453099130916407
7
939009064579454029
882332922150359400
6
619211329960885019
842159750621366164
5
821811728595706099
680314332110960591
677023906521548180
736193184424327440
460487015560329056
887132300...

result:

ok 75112 numbers

Test #16:

score: 0
Accepted
time: 62ms
memory: 3756kb

input:

61 1000000000000000000
699790364508723223 103857940650314001 429701147031876074 548858821893452386 258301858368920144 341499281895114339 503982825993906532 175780919411321750 904154400445271870 437757461291733790 834121354958808141 914099556687715827 31712113696437346 769515898875143961 749942025897...

output:

943688854418341090
986674393118622024
975949726180153543
993354240588495827
864922266157886520
983039371640484307
998639066448488333
984586437889216097
978182674567260668
995176933818585136
992188970586683685
708734523568703483
986358460201862674
949060723767579439
990648872524228369
987260689109217...

result:

ok 5916 numbers

Test #17:

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

input:

39 899337248656702163
87 19975061 107 4460583880 144 64958836011663297 32 403643 35012 4 1113965177 5 128900997285956449 237085479540671 8782280389 1416703843490 280431238664906 3788212440316893 795390502 616555728806509 2532356096255370 732634507685973249 34521502208905 1470044 79 1 30439680721 346...

output:

3788212440316896
7
457602647964432641
23142407224855846
502243634792807233
985108898348919
426176060150907329
307971287522866049
250435348526178657
388922999873682305
30100743222842
239493265471334945
329143334304
7
163929577541812449
1995961470309543
53266290346323833
374525043950812
23989881794156...

result:

ok 5962 numbers

Test #18:

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

input:

14 981734473889523251
978311977444048129 978516951554891777 981090866877063681 981494552649204353 981290463479964673 981089498962774657 981443580163399809 981652025881143553 980649141793765377 981417158069584897 981210457421499777 978966276780297985 981205940930355457 981402736969343489
39 749331363...

output:

7669156452196435
5853667760875623
5082059519444914
5700374797417927
8669011310369624
6102301033672835
5570717100925946
5260668108359753
7735097418686663
5402308504685878
7064520462531681
7718753199055625
7021600308221915
6948010523960449
5529267402088586
4940652637323541
8664428541990452
53702718347...

result:

ok 5950 numbers

Test #19:

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

input:

1806 623710179190433429
623668431895940865 623693062700611457 623607239885067777 623700096443278081 623684242844310657 623551887001651713 623626220577327361 623617140490087425 623609506311335681 623395389895040769 623660464629400449 623692716330897537 623640976013993473 623701403796962305 6236754764...

output:

4872735740778757
7026537315149598
6054183418107841
4883862836400253
4565376231670674
5809611744587573
7237451984107166
6919964951313842
6607909004024650
6993769271119017
4858296522966304
7036469589007690
4798938674002599
7031141712336524
6155679668901150
5632008697169369
7112716021472602
51682870312...

result:

ok 249 numbers

Test #20:

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

input:

1103 841985645046586607
841589959951035393 841840917739663105 841547057511276417 840933640625921409 841353709117646593 841146173246605441 841949638204589185 841523980506182401 840583285792832897 840967918493180033 840867320244072577 841556601815460353 840591433031160705 841887303284933761 8419203005...

output:

6578012475657056
6324915191536303
6764762543602926
6628123333690127
6827464748412881
6114145679286150
6994091482690133
6908473384878056
8886329823308989
7894630198294336
5665699576541701
7431541546020759
6015373497697357
8064622995282927
5237860148639454
7966167400104170
6306970443628382
51176673359...

result:

ok 237 numbers

Test #21:

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

input:

1662 904360516037819107
452480004922638010 248848425222695991 278022529907568756 540291432750935514 898042361209703144 354555513479425025 499773217382330311 534422426825050159 856332217822158507 643487604803565858 811549636963235330 865000754174446905 235083444952842861 658246435101505906 5482368208...

output:

903703154943213048
951972584327039194
513218170316078999
971669091695707446
647514465334062368
613419110917505646
587727745107694645
708300263016729579
791317490777398874
853310975917376520
505442547947881705
632256494055954276
741714849095242497
992190558293097870
589127990535401921
552022045313121...

result:

ok 234 numbers

Test #22:

score: 0
Accepted
time: 63ms
memory: 3760kb

input:

1933 885575418964954220
11 12417666262915561 4739 828 63078216586102033 3248005232099 84197131118 292198104 127885 326991880979189 775421305445 4175167253381454 6350282623 551 5470475837341 5989985385 422 629174 11550622 20921751 138097580293510289 17425162564568 208873498463670 47573297 40971 32609...

output:

877995136173060225
525819235692772417
542784804785634241
790764483877903361
891344829643232769
784536727507948161
610596552252084225
725207035715664513
657287447714909185
785608990868825217
606405101196684033
798512571741066753
615853892841329409
846917421122919297
803306198481270657
858335264505106...

result:

ok 242 numbers

Test #23:

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

input:

1642 604435094332938827
23152211856773701 139027909189476 97951059773184 29674358 91093370299954 10952254 101261967411 259104925033 1369125027981 585996 108954208890492 13287376913474 6716744597 94833 20341520930677773 9514057243423 4641334571902233 2664862883485142 12603500 2393516509 11942 5737098...

output:

573709861009930817
489205729683936193
687609739959156737
624220599620777601
740455961391989121
933309843926891265
609935533532112513
674521346278761473
810754782706406017
912843407133948033
505129301009757185
682840094732062337
567882309608181889
554234511014243777
906219202980290049
812657396017450...

result:

ok 245 numbers

Test #24:

score: 0
Accepted
time: 77ms
memory: 4092kb

input:

15781 828810472037214419
828800585861013377 828790475980385921 828715810029969921 828621757643076609 828712135247746817 828752421164566657 828748483274239745 828753317196050945 828742739775910913 828802355222112641 828785787591563521 828801323812767745 828804512085649153 828803428722251905 828715418...

output:

6475081798377322
5780418228599033
5586705437554380
7765461868501288
7769979350874260
7658680699044570
7096229970129888
4719288595321618
6095734013027735
6853897162059802
8024648343528998
5259304236568941
4548140934123564
5916638321124617
6071397291333301
7214267106676789
6015979462539364
66996962287...

result:

ok 22 numbers

Test #25:

score: 0
Accepted
time: 71ms
memory: 4164kb

input:

18188 942550607120914158
460266444518578822 496656942793394658 43592195965671711 869890082044041798 914584285953563635 277657894311065750 113174242814419413 887266497984380019 700090565442115257 373978785636592565 695275366234970933 642023027236680478 720947534112216001 815237555122097727 1811493739...

output:

942373528488286577
795182942758110176
876723317713222003
995302505836190034
843926313710763234
839571973114780572
599356782971698414
838572077394778067
762576203851234512
902422287451463370
866263174361980210
626037474473140073
560392246255721513
767482888019007824
910299853862293587
607633110439107...

result:

ok 20 numbers

Test #26:

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

input:

19070 518727794908266953
34381 108939596059630033 6097324 361825495419351873 2681 411642 8932984236634 4534986571054 114563144273824833 5871106 7408062778 32985579 16371344395962 796948 7641220465774517 47913329781916769 462 910 591334 92692419376 61303 699607277377 469774251126783 21200556336823785...

output:

517459799133669889
781859396727123201
871336498984705665
980357808142638593
656896747889414913
683311648184319233
744719313062224513
868658535840318337
604025149560545025
553480119114363329
861843957820257409
752463765628184577
992680630693466241
722687023966664961
515784436125669825
722454089920505...

result:

ok 21 numbers

Test #27:

score: 0
Accepted
time: 50ms
memory: 5188kb

input:

109438 770573614908754665
109354684 591504 638706738622752513 48378542721 6917933604292586 3565 157010830 201373599309326113 52420 1109350082863 502485873806763 2512777704836570 6523726639 1250802705 2899 83198238067804113 45820 29757204589992541 14477886061790 433231 52775702583847121 6623477 32990...

output:

770432084182982145
777551938070779265
644778176952749569

result:

ok 3 number(s): "770432084182982145 777551938070779265 644778176952749569"

Test #28:

score: 0
Accepted
time: 65ms
memory: 5208kb

input:

105860 650083579139937580
307515981482828094 407567278447254568 84139837779621932 57002927446845811 459933961830848385 304525825511724400 398561805257307508 493857088749061472 432912240458885916 398859578463449470 360056607108133937 256529415013811945 139614982975910754 49154488770346337 19334662348...

output:

650061557345528026
873308009553683883
575024810006228638

result:

ok 3 number(s): "650061557345528026 873308009553683883 575024810006228638"

Test #29:

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

input:

1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000000000000
1
1 1000000000...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 300000 numbers

Test #30:

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

input:

6 1000000000000000000
161 1 23 310 84 44
10 1000000000000000000
1 1945698 7711 122585 61419 488361 974777 244672 30774 15420
17 1000000000000000000
19580752460990743 38248912694028 2447706156077733 39160907136651887 76496657267174 78320618775705796 152990978292587 305977284387545 1 19124456347015 61...

output:

310
1945698
626536261768801570
52945
2157241055864835
3115431833191
762473128
51005800254796866
762473128
51
360639813910573
2952069138
557500
3355443229
12947848928690226
327180
917522
178759862254514709
432345529532284959
33516559
1133871366181
20340965113897
2336462209062
670806033
548732548114
1...

result:

ok 192 numbers

Test #31:

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

input:

10 1000000000000000000
1207325 75923 604891 151844 2409782 19163420 4809914 9600691 303066 1
14 1000000000000000000
7934277683 16229512158831 253772407398 32455057178820 8115748350551 63458655867 126901753861 1 4058370554538 2029433588991 15868555364 31733219330 1014841011525 507482644924
11 1000000...

output:

19163420
32455057178820
142945
54496148675
2157241055864835
3115431833191
3115431833191
51005800254796866
3115431833191
3115431833191
6979321886
371137585958436
9895604650024
12947848928690226
62277025825
2336462209062
738871813865518
105707136567379
6979321886
4810363371559
8912917
5404319552844600...

result:

ok 19523 numbers

Test #32:

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

input:

300000 1000000000000000000
104588095238078505 437954761904691833 84657142857129313 686730952380842505 546057142857055489 544147619047531985 531007142857057897 418723809523742529 433054761904692617 113314285714267585 347690476190420561 588090476190382097 546361904761817345 697085714285602753 13617857...

output:

300000

result:

ok 1 number(s): "300000"

Test #33:

score: 0
Accepted
time: 66ms
memory: 7984kb

input:

300000 1000000000000000000
289670894308479617 793953821136941057 151432276422521937 166322520324937137 450572764226921361 346575691056356049 331168048779957937 562505284551945521 281199999999550081 198521544715129521 369022357722986801 828974471543389089 729477560974442593 204919837398046113 6542502...

output:

300000

result:

ok 1 number(s): "300000"

Test #34:

score: 0
Accepted
time: 78ms
memory: 7756kb

input:

300000 1000000000000000000
148688861788379985 531256829267442673 91185447154325649 450302032519604721 284915040649950641 325810569105169761 499740650405704481 251476666666264305 164024308942826993 425469918698506241 697275528454168913 448355772357006209 32987154471491937 608337154470571377 647117967...

output:

300000

result:

ok 1 number(s): "300000"

Test #35:

score: 0
Accepted
time: 80ms
memory: 7868kb

input:

300000 1000000000000000000
696400162600511777 270226341462982273 2875772357718977 111544471544536977 240876016259777201 348380569105133649 542335772356855841 137366260162381841 856363495933589169 769738373982508257 428727723576549809 82488943089298913 27157398373940289 297338617885703121 36294292682...

output:

24390081300773985

result:

ok 1 number(s): "24390081300773985"

Test #36:

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

input:

300000 1000000000000000000
751494065039448017 246588455284158305 781277560974359713 31708699186941137 569279593495024113 651964065039607265 125944390243700929 450404308942368785 531500487804027649 615917642275437297 335713333332796193 525562439023549345 513671300812186257 430667967478985729 51416764...

output:

451216504064318705

result:

ok 1 number(s): "451216504064318705"

Test #37:

score: 0
Accepted
time: 58ms
memory: 8132kb

input:

279882 1000000000000000000
8936794086257136 35657018029502672 34857111212484768 97317759556420536 74919177160330816 41987164429518240 61135678561627072 62988094348405376 48937695361898240 5465500352028496 99313157693807800 86077758105771736 74128405326824040 22556657328152848 74957702960356008 58052...

output:

279883

result:

ok 1 number(s): "279883"

Test #38:

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

input:

282452 1000000000000000000
87367379474624328 103550201351185648 20791619645523464 45995833499117888 68227205979634352 89226150032540808 53223591322400816 66155947761785112 16511681283961928 12991138073412424 37556697427620160 4699353257681152 28605605106303128 18493972705876704 55730548536411248 273...

output:

282495

result:

ok 1 number(s): "282495"

Test #39:

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

input:

293715 1000000000000000000
239154167801 235237034936 237774516026 235741250681 235890832286 238891668701 239226837476 237448076801 235954389536 235688490506 238481119496 238352841056 239080533281 235888979171 238745532971 237184674116 237414337856 239231370716 238136026601 239279444501 237961267136 ...

output:

15649339

result:

ok 1 number(s): "15649339"

Test #40:

score: 0
Accepted
time: 29ms
memory: 6192kb

input:

190151 1000000000000000000
301799 987148 17676 458088 913445 231624 922538 798155 1257628 988226 849080 170605 1299474 83469 469841 436444 96230 15205 731543 501278 282409 122221 558055 768384 178564 953100 1169540 1012747 3067 64807 1294945 117391 1281995 1314692 944595 1214704 209462 8919 139322 4...

output:

190151
109849

result:

ok 2 number(s): "190151 109849"

Test #41:

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

input:

111830 1000000000000000000
921098189 19187 514967409 5595133731 6319 7050141395 6891060129 8007036881 72467 126531 145095 10248140367 8911440365 1255634373 105171 5656775715 11238264735 10685413191 70935 10473037293 84739 142435 160083 11311946169 1930485677 41439 1882809455 8194049671 3165572721 50...

output:

111830
119250
68920

result:

ok 3 number(s): "111830 119250 68920"

Test #42:

score: 0
Accepted
time: 50ms
memory: 5016kb

input:

106821 1000000000000000000
6146313353 123023 69791436000458 245712216394468 32843 48379774040878 28623 1374710079 1619072645 193878 2579946039 3616487969 4255380041 620755027 210609003117653 88507549931603 260969170957678 2408521701 148878662432473 6203844843 1173057331 1022890391 87353 3209672077 1...

output:

106821
107422
85757

result:

ok 3 number(s): "106821 107422 85757"

Test #43:

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

input:

1757 1000000000000000000
788780293 1262701 2383 1338431611 700769659 1481809 1078189 181008745 5573 1291935427 3673 4543 1411497043 604456135 5193 350387701 974401 803725495 2823 616909 934911157 1113 713 1406851 11907816301384346 3403 270949 161395 1081042021 1225512307 1086023755 413 511463767 322...

output:

1757
2689
5128
3174
2955
2124
2240
4004
4795
3027
5383
4199
1839
4773
2918
5384
3147
4355
2372
2121
2732
3249
363
1354
4604
2850
2387
3310
2700
2227
3828
4484
4975
2772
2537
3053
3829
4336
1578
3011
2682
2329
3674
3309
3551
2108
3132
2635
3335
5199
3598
3899
1530
943
3887
2670
2375
4842
3105
3365
31...

result:

ok 99 numbers

Test #44:

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

input:

72 1000000000000000000
492591214386408 17919561 77 53 1179 6169219005 16510742410072770 3848214321 1 29 1527209637 499319444451834450 1174226897928 4386 34105 93543 103415387455758472 596813799 136810593658 222219999 142 342535 180287 9581430147924344 12436418715 207 4761979436504 89486880540 179772...

output:

72
79
79
71
79
71
65
71
66
72
78
68
74
71
71
73
72
72
74
75
72
68
74
72
71
65
70
65
71
79
78
69
73
70
67
68
77
81
73
77
65
74
74
73
69
81
65
79
81
78
83
73
73
73
68
77
69
73
79
78
68
80
65
71
76
78
68
74
80
72
72
73
68
70
69
77
76
70
77
76
76
76
76
76
79
75
73
69
67
71
77
71
78
81
80
74
78
69
74
79
...

result:

ok 4065 numbers

Test #45:

score: 0
Accepted
time: 55ms
memory: 3560kb

input:

206 1000000000000000000
94971 104726845007261157 107354559 924874697242389 156627830162270541 5881149942119517 1140702384 312330785627298693 998119038 83100 17450475294 10446 2271602310807 106842 7763962170 4734 17617327419652581 273036 47460335165355 154326 935142607487411301 166197 741035526742947...

output:

206
220
183
185
162
201
166
175
228
201
204
187
146
168
210
245
202
213
245
216
203
215
228
192
182
194
217
208
172
194
169
211
183
215
142
169
247
175
206
190
188
196
227
231
182
220
175
212
176
165
192
199
182
186
203
208
222
210
161
187
216
164
188
179
174
164
185
226
139
187
167
167
180
226
200
...

result:

ok 1569 numbers

Test #46:

score: 0
Accepted
time: 54ms
memory: 3828kb

input:

3539 1000000000000000000
9569578000403 3149146069831003 144016855140841979 933442579616281827 369765079253 4549874251193 694636935 140351 601993366583 118805 4085417676533 3375161055489103 141611 50513 83651 783522553276223 116285 205745 160889 152195 169205 110111 125609 181805 215825 117797 242409...

output:

3539
2950
5472
2377
4280
3915
7510
5315
3057
4113
6920
7227
6025
5649
6285
4163
8248
5253
5347
4278
5391
4936
7083
5757
7363
6013
3453
3943
5789
5865
3847
2829
2949
4516
2687
7242
5667
4030
4194
3753
4117
6759
2984
6639
4708
4380
7569
6426
6235
2774
5032
3091
6601
4780
4114
3914
7876
5412
3063
4296

result:

ok 60 numbers

Test #47:

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

input:

30436 1000000000000000000
2839347387134506 1706605207678935 1562604312163195 5801 1497220121766859 1647253487229880 2089 9625 20809232 2131018657840866 176905288560 1836400609447852 1967363586045275 1273045754693707 42811077057885 2660708438373088 205493169829721 433170261388391 62906530932 10825 45...

output:

30436
20133
62377
53222
18664
27066
66393
21709

result:

ok 8 numbers

Test #48:

score: 0
Accepted
time: 62ms
memory: 4168kb

input:

16203 1000000000000000000
41192259584337943 39957225 75661577770393003 71605306 50230868246211 56786637 7027 20981894 93757273 8733 89870963 11513 8805 9045 1005 11217 45950746033147 13276862 28433471 80425540 4529 76288292646503095 35169683477599 23096508555843 5681 63697510 2795 69003168 53170679 ...

output:

16203
17237
15549
18322
25027
31793
19731
16133
19309
15188
25076
20120
24014
25408
10890

result:

ok 15 numbers

Test #49:

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

input:

64 1000000000000000000
269616020437791 33760651140999981 9454924267949 1488 38 5183 74354629899819 305670836106 828901720640013 72673852636170183 56696 1667020136328027 1890940618048 205954208816 1886756 2989558 106237581526 24966 448951246 50616869 28 4092360 709955089 1550584208 23594717 719023351...

output:

64
59
62
65
65
69
62
63
65
62
62
58
66
60
63
60
69
63
57
65
60
59
60
63
64
62
60
61
62
63
62
61
67
61
58
63
63
65
61
60
62
59
63
63
60
62
64
64
61
60
66
60
61
63
63
60
57
64
59
62
63
63
68
59
60
58
61
61
60
63
60
66
61
64
60
61
61
62
61
66
62
62
64
64
61
63
61
64
60
64
64
66
63
66
59
61
61
62
61
60
...

result:

ok 4821 numbers

Test #50:

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

input:

4622 1000000000000000000
30593117670475 183 16385785919475 25880784861975 458850789 339 41600283111225 1738191607 1985556599 21977285296725 2577 851 1773 1433 1595183721 17124285837225 2407 2117 2011 632779299 7347953592725 567072973 27920451301475 45152116048975 3161 601858675 1131 2581 2077 1839 1...

output:

4622
5375
4120
5475
5773
3160
4751
5894
4240
3631
4604
7265
5928
6631
2274
4624
7066
5916
5575
3467
5177
8184
5627
4209
5127
5809
5811
6083
8653
3040
4987
6560
6441
5705
5235
4235
2753
5398
5514
3570
6852
3435
4554
2624
4730
4310
5919
2695
4517
4916
4758
5824
6056
4415
5365
2831
4609
4810
7041
1230

result:

ok 60 numbers

Test #51:

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

input:

60 1000000000000000000
86245665479 651 4359936322 17 8484980 782528189 3875799 5462 5 163317642814263 35467103898835 1745334260 2609 1210511 487428411 429 56116308307873654 67 13726408489239 43489 2543155 20258025 207 6278407329658435 190399310383 110262721061347 231314 137 656889601609 69470 537337...

output:

60
60
60
59
59
62
59
62
62
62
61
60
61
58
61
61
59
59
59
63
60
60
62
56
60
59
58
63
60
62
59
57
64
60
62
58
60
61
58
62
61
58
59
60
58
57
59
60
60
63
59
60
61
57
62
58
58
58
59
58
60
58
61
61
59
64
60
61
61
59
59
59
61
58
58
62
59
62
61
58
59
59
62
61
59
62
60
62
60
62
58
60
60
61
59
57
59
61
62
64
...

result:

ok 4990 numbers

Test #52:

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

input:

300000 1000000000000000000
145194727 168523747 91755597 87857817 13840227 69714457 146649907 131682057 131710367 38745687 160506787 90463147 185305847 131992097 70299377 96101307 179400847 49607287 38424697 50195817 181944537 18043687 100256087 147739627 183137577 70394487 190745777 135397117 333011...

output:

20000038

result:

ok 1 number(s): "20000038"

Test #53:

score: 0
Accepted
time: 65ms
memory: 4772kb

input:

96780 1000000000000000000
539744 882900 159588580323 53157693303 1099457 7673627907 77241180879 64194033435 323462 43061 68130947751 1027198 248717 30971712627 706548 153951059823 79140887787 8545931079 383016 1046800 119324033907 77474381727 441954 59992018155 287833 84335106675 34116624063 819727 ...

output:

250034
250030
250031
250028

result:

ok 4 number(s): "250034 250030 250031 250028"

Test #54:

score: 0
Accepted
time: 62ms
memory: 5056kb

input:

93922 1000000000000000000
177485935 96095255 131318811 181949067 5589931471540061 41928751 3665715091502431 5665079640162081 131680367 140719999 122033979 207691677595521 2299420827660941 114713563 3582148522136761 4376083833908541 180481211 148110487 231838479232631 113079103 114987531 16066367 696...

output:

86447749
73394902
84840721
108472224

result:

ok 4 number(s): "86447749 73394902 84840721 108472224"

Test #55:

score: 0
Accepted
time: 50ms
memory: 5624kb

input:

152877 1000000000000000000
61132131892 48609838741 71958575799 87655 41687146062 265035 109111 18059383655 381075 34596517442 6976479435 24471759366 360487 187471 43087 20405713456 33639239184 228631 78348820417 30193297821 37319509767 33079452714 31740738559 318111 376167 26382410395 55845838266 95...

output:

294056
287325

result:

ok 2 number(s): "294056 287325"

Test #56:

score: 0
Accepted
time: 42ms
memory: 3776kb

input:

1342 1000000000000000000
79210 5312592254 158166024269105 17365 24862 2962791809 2826182813 199473967316218954 64804 5555638934 86721 335744326182395 34662 10750 754000343 6020989517 2645993033 122204 4583033168 1240512749 4967717396 764057447 23762110590194699 928323479 162553063153793 2873954057 1...

output:

63264
45978
45863
46188
52868
71102
77833
57497
72377
51713
79989
61549
72995
71968
62677
53427
49222
52705
78487
75382
63122
53995
73332
58212
74203
42031
56168
61197
56978
59749
87742
61240
72358
64472
53695
70782
56570
70573
67598
61679
72587
61592
65358
54621
77282
57897
66733
52043
73658
60743
...

result:

ok 203 numbers

Test #57:

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

input:

87108 1000000000000000000
40077522073 5950115795 32346567660 58222592912 62929865741 20455070868 47340147828 59775339884 71190234606 1767686040 2834765319 41180892593 35999909401 43959050066 51249385559 29756034113 24268341000 74851355342 13712742597 29263999759 50884958440 76226783802 68181589246 6...

output:

11344263211
10308338120
10445206928
19771336203

result:

ok 4 number(s): "11344263211 10308338120 10445206928 19771336203"

Test #58:

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

input:

81767 1000000000000000000
25177670358 48439444943 80916133621 7277076507 68605924892 68435452842 59334152508 27311114356 3184662580 7904362271 23999748046 30119179112 57250636248 8873432408 49609625353 3420046526 63463557494 2693895429 43071747657 50270755543 40431595282 359276982 47944853174 152844...

output:

11917724376
17558651932
13684073252
12482582896

result:

ok 4 number(s): "11917724376 17558651932 13684073252 12482582896"

Test #59:

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

input:

846 1000000000000000000
71114181377 69289678340 38001249903 7792688597 11331958471 13445033806 17240959898 40550632732 83206837925 19012106492 14268964053 49728251203 4500698238 28517473671 77927654372 71040389722 35982711493 33832358736 71653003843 20738888948 85480351006 75123972547 37150224966 50...

output:

12793299349
13090195934
11311915367
18091703808
17968307063
16970807469
11765980125
10306190783
14312510374
14353866765
17760039995
15414060124
14140601101
15710389332
10465656349
18481691740
18320628777
13234042556
13262208767
13934838984
11240712854
16713937700
15959785266
17690170932
18583530021
...

result:

ok 563 numbers

Test #60:

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

input:

64 1000000000000000000
3648012642 90877195916898916 961 518105283 107 123846634091482045 27308816244712 15036905072542 57 34807943 638529 57907757742315787 5048149302810898 4872440 444887235910472 1191760297804 375811177 1539 6600432 7846940146198750 242233981663677 317122435444 7 15384535438 26861 ...

output:

64
9
64
71
70
63
69
77
25
9
34
74
61
10
65
69
64
62
14
28
18
62
50
19
44
15
60
59
27
10
63
16
70
66
30
48
67
69
39
64
58
62
61
65
63
71
46
63
75
56
50
50
52
58
36
74
26
61
58
67
72
66
69
70
59
49
33
67
39
63
73
72
70
65
68
18
58
73
11
19
40
52
73
68
70
68
67
72
61
6
57
78
48
67
17
70
70
70
70
65
12
...

result:

ok 6355 numbers

Test #61:

score: 0
Accepted
time: 55ms
memory: 3696kb

input:

65 1000000000000000000
9151040851 89972473739236681 1902429819667199 5588900911 49 5633862041115485 542691 13563132495775 9380856331 634567213713775 9 927150892010719 971850871087 3348 116730529935 762775831 125491 483210676143 4210008031 2256576451 8877654798735531 2908971121039 47 8921225371 70957...

output:

397
709
368
429
403
435
461
387
318
248
652
739
14
603
500
408
369
543
544
485
501
439
473
579
774
611
484
512
537
798
472
413
677
370
367
334
428
476
459
367
426
305
757
570
356
590
319
678
93
456
394
557
416
345
477
501
105
366
421
276
432
386
362
384
481
439
437
629
416
492
61
509
364
494
552
561...

result:

ok 2866 numbers

Test #62:

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

input:

49 1000000000000000000
796179 127770552315 1 723949 319 11717303915411 5889 1112523767 6356027 7761906260222948 91276073001 98353572087325 465217131 902132676786176 13 67080 276324417988475240 1262818441367154 558248501 164265031629 372185761 418265333731 5 29231329 48909026765188 1522651812575 5561...

output:

106
80
23
56
26
78
65
38
29
80
95
94
46
60
102
92
7
9
21
9
101
20
68
70
42
60
11
56
14
74
46
19
46
57
44
69
49
74
51
35
24
63
84
52
11
31
8
14
59
66
12
23
30
41
93
11
55
85
65
30
13
63
55
90
23
29
13
47
17
29
49
77
71
24
61
21
29
64
49
45
10
23
49
61
81
18
34
42
88
92
22
36
98
74
14
42
36
42
43
52
9...

result:

ok 10714 numbers

Test #63:

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

input:

75 1000000000000000000
732992850475845995 322 2864119205 6443761 40135058825 7821717 557058144343913 9 186062980085 6505 537528232018230435 31 11955585 293197458946210985 55075 15 440134745 25933 726 51837 25 26473081293921145 349521 786333 58532137029239 199329154745 795728978792405 2309893 5429526...

output:

213
217
205
169
190
110
10
199
208
169
40
184
220
213
117
232
92
135
128
206
222
180
107
182
206
218
196
60
159
10
197
23
130
225
228
191
162
199
191
207
95
36
195
9
12
219
123
192
211
14
200
203
240
130
203
206
173
151
222
162
150
201
40
22
145
21
139
98
200
145
173
15
208
199
217
147
232
208
27
14...

result:

ok 5585 numbers

Test #64:

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

input:

30 1000000000000000000
99010666 103753878788661485 1199093 209 3362359531515 72812795201 126337419868 9417280759 1971099570650382 8075317449548 422657793360164057 457 12178618 1134673324928886 8 1422452630877 3895545236 52968 73497202852377 41115037980 16646 3603 886379719594 27 253835847 2982470792...

output:

34
17
28
29
23
17
28
18
33
18
19
28
18
31
26
16
22
12
55
23
23
27
38
27
28
28
34
30
28
22
17
34
31
28
14
20
36
15
20
19
14
22
22
12
26
10
26
32
17
29
15
23
12
14
15
12
11
30
11
24
19
10
17
29
26
30
20
27
22
30
19
15
28
19
14
10
23
27
15
21
28
23
19
31
25
24
20
28
27
15
29
11
19
21
11
25
12
26
32
30
...

result:

ok 15066 numbers

Test #65:

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

input:

1571 1000000000000000000
19068506 25633222694 1869 3455968 48516205383 781277300966911229 17070577 839 97101306243 212772165593101446 106998271233 356343048099544417 74488240781 61712158703 26892836420 11094285 4026305 8316079 127670752962724 707491646180318247 2445 159 14232888 81226655561332 14949...

output:

16011
30435
19396
12318
25639
37198
38197
11873
15008
15626
33477
22892
22536
23479
17969
16242
22858
21203
30019
26467
25325
11017
9773
16771
17083
26662
22657
12570
22558
24182
15941
20867
22521
21020
36073
7845
18716
14388
12021
11768
22597
15942
39325
19282
17569
14599
11708
20140
23823
19373
27...

result:

ok 202 numbers

Test #66:

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

input:

11 1000000000000000000
42993394917 3392333924286482 230192797337687837 502189991125 246506685 2120588235842 16276589772 95494628 1222 90730 33828516251604532
62 1000000000000000000
4194831 534112921439013478 329 111718 3417651270346399 139180226112 3709 7157857591684313 49199149351191 6112 2642528 2...

output:

12
75
80
68
18
77
79
69
72
34
27
61
43
79
19
84
66
13
52
68
16
43
74
81
78
16
77
73
88
72
79
69
19
53
19
79
29
15
26
81
34
61
72
80
74
76
84
90
14
39
41
61
39
38
54
54
66
88
80
20
18
63
59
15
40
74
80
45
67
78
29
79
46
73
60
41
81
90
15
28
73
18
88
30
84
36
72
78
40
12
18
25
18
65
42
82
77
41
64
67
...

result:

ok 5671 numbers

Test #67:

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

input:

52 1000000000000000000
1648143 1043353003503 1111153 6095853260710 1713745 1833588038156 4714838799396 4456742242267 1465403 7245744446842 1825480169043 1995535 3682412014636 66355 1690753 3100791539745 688359 1489089782872 277711951149 1923785 2114195 2815545956945 1636725 1076631 3043157 421270180...

output:

3679090
1908278
2219579
2567868
1241697
2175177
2227134
1513030
4098388
2294325
2705703
664017
2722157
1502195
3548388
4008600
2407758
2445389
3017035
1874997
1315455
2692164
3860440
1789026
2701337
1920467
1611246
3744953
896165
620030
2210179
3442758
1237042
2849076
2694122
2221873
2582372
1866115...

result:

ok 5457 numbers

Test #68:

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

input:

12 1000000000000000000
4704227 284757 558547990984598465 5028509 22976307973734 729097549961380989 7442077584066 2113087 419556814968086723 17058306865218 6976105693305 23715106857600
63 1000000000000000000
332750311526649815 2347075 4161957 3061277230891 4875957 105237 5196909 740168356575955223 42...

output:

5492723
3840142
2297048
1387349
975499
2997712
2919222
2151005
2307691
3876383
2612569
2765798
2267404
1366498
7690227
2698129
2846283
1906627
4308480
2703285
2179991
1867251
2920404
4078262
1034201
2538916
1404169
2451619
1088444
5143405
1021996
3569120
2781440
1211204
2951839
1932457
1512934
20368...

result:

ok 5442 numbers

Test #69:

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

input:

81 1000000000000000000
45478678424427 266562481 7688152881 641729547523317 6892982481 3330 621 10073664081 37799614457766441 12437929499851 47648653135 6039 855449333469441 99 214289975631069 15639856881 748589440496379 13908 107430082658007 19584 534869654550255 492 14049516081 75 428009761577193 4...

output:

526
334
139
413
210
414
179
639
369
217
545
286
512
41
685
632
156
189
380
171
438
636
528
330
489
163
492
267
528
151
180
394
643
16
489
110
450
122
611
269
362
422
132
497
345
38
310
18
176
275
464
607
367
496
19
558
98
257
403
719
414
443
223
839
539
588
629
355
641
461
514
61
25
239
96
520
66
42...

result:

ok 5486 numbers

Test #70:

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

input:

5 1000000000000000000
5000000000056 6 1 5000000000061 3
4 1000000000000000000
5000000000056 5000000000061 3 6
4 1000000000000000000
1 2 100000000000000012 100000000000000022
3 1000000000000000000
100000000000000012 2 100000000000000022
0 0

output:

1000000000014
1000000000014
10000000000000004
10000000000000004

result:

ok 4 number(s): "1000000000014 1000000000014 10000000000000004 10000000000000004"

Test #71:

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

input:

3 1000000000000000000
259695496911122583 420196140727489671 679891637638612256
3 1000000000000000000
259695496911122582 420196140727489670 679891637638612255
3 1000000000000000000
358890350005878078 580696784543856757 939587134549734839
3 1000000000000000000
283112225259590265 458085203100633574 741...

output:

84
84
84
83
83
82
82
82
82
81
81
81
81
81
81
80
80
80
80
80
80
80
80
80
80
79
79
79
79
79
79
79
79
79
79
79
79
79
79
79
79
79
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
78
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
77
...

result:

ok 100000 numbers