QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#451103#6349. Is This FFT?EXODUSAC ✓3493ms128200kbC++174.4kb2024-06-22 21:03:212024-06-22 21:03:21

Judging History

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

  • [2024-06-22 21:03:21]
  • 评测
  • 测评结果:AC
  • 用时:3493ms
  • 内存:128200kb
  • [2024-06-22 21:03:21]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef __int128 i128;
#define rep(i,l,r) for(int i(l);i<=(r);++i)
#define per(i,r,l) for(int i(r);i>=(l);--i)
#define eb emplace_back
#define Debug(...) fprintf(stderr,__VA_ARGS__)
#define Exit(p) fprintf(stderr,"[exit]: at breakpoint %d\n",p),exit(0);
#define File(filename) freopen(filename ".in","r",stdin),freopen(filename ".out","w",stdout)
template<typename T>void read(T &x){x=0;T flg=1;char ch=getchar();while(!isdigit(ch)){if(ch=='-')flg=-1;ch=getchar();}while(isdigit(ch))x=(x<<3)+(x<<1)+(ch^48),ch=getchar();x*=flg;}
template<typename T,typename... Args>void read(T &x,Args &...args){read(x),read(args...);}
template<typename T>void cmax(T& x,T y){x=max(x,y);}
template<typename T,typename... Args>void cmax(T& x,T y,Args ...args){cmax(x,y);cmax(x,args...);}
template<typename T>void cmin(T& x,T y){x=min(x,y);}
template<typename T,typename... Args>void cmin(T& x,T y,Args ...args){cmin(x,y);cmin(x,args...);}
template<typename T,typename U>ostream &operator<<(ostream &os,const pair<T,U>&x){return os<<"("<<x.first<<","<<x.second<< ")"; };
template<typename T>ostream &operator<<(ostream &os,const vector<T> &as){const int sz=as.size();os<<"[";for(int i=0;i<sz;++i){if(i>=256){os<<",...";break;}if(i>0){os<<",";}os<<as[i];}return os<<"]";}
bool membg=0;

constexpr int N=257;
int n,groot,mod,fac[N*N],ifac[N*N],rev[N*N];
int f[N][N*N],h[N][N*N];
int g[N*N];
struct Barret{
	ull p,m;
	Barret(ull _p=2):p(_p),m(((i128)1<<64)/_p){}
	ull mod(ull x){
		ull q=((i128)x*m)>>64;
		x-=q*p;
		return x>=p?x-p:x;
	}
}M;

bool memed=0;

int qpow(int x,int y){
	int res=1;
	for(;y;y>>=1,x=(ll)x*x%mod)
		if(y&1)res=(ll)res*x%mod;
	return res;
}

typedef unsigned long long ull;
void ntt_transfer(std::vector<int>& f, int len, const int g, int tp) {
	f.resize(len);
	for(int i = 0;i < (int)f.size();i++)
		if(i<rev[i])
			swap(f[i],f[rev[i]]);
	std::vector<ull> temp(f.size());
	for (int i = 0; i < (int)f.size(); i++)
		temp[i] = f[i];
	for (int mid = 1; mid < (int)f.size(); mid <<= 1) {
		int len = (mid << 1);
		int cur = qpow(tp ? g : qpow(g, mod - 2), (mod - 1) / len);
		for (int l = 0; l < (int)f.size(); l += len) {
			ull buf = 1;
			for (int k = l; k < l + mid; k++) {
				ull w1 = temp[k], w2 = temp[k + mid] * buf % mod;
				temp[k] = w1 + w2; temp[k + mid] = w1 + mod - w2;
				buf = buf * cur % mod;
			}
		}
	}
	for (int i = 0; i < (int)f.size(); i++)
		f[i] = temp[i] % mod;
	if (!tp) {
		auto inv = qpow(f.size(), mod - 2);
		for (int i = 0; i < (int)f.size(); i++)
			f[i] = (ll) f[i] * inv % mod;
	}
}

int check(int w){
	int t=mod-1;
	for(int i=2;i*i<=t;i++){
		if(t%i==0){
			while(t%i==0)t/=i;
			if(qpow(w,(mod-1)/i)==1)
				return 0;
		}
	}
	if(t>1)
		if(qpow(w,(mod-1)/t)==1)
			return 0;
	return 1;
}

void getgen(){
	for(int i=2;;i++){
		if(check(i)){
			groot=i;
			return;
		}
	}
}

int binom(int n,int m){
	return (ll)fac[n]*ifac[m]%mod*ifac[n-m]%mod;
}


void solve(){
	read(n,mod);
	M=Barret(mod);
	int inv2=(mod+1)>>1;
	getgen();
	int len=1;
	while(len<=n*(n-1)/2)len<<=1;
	int cnt=0;
	while(len!=(1<<cnt))cnt++;
	for(int i=1;i<len;i++)
		rev[i]=(rev[i>>1]>>1)|((i&1)<<(cnt-1));
	for(int i=fac[0]=ifac[0]=1;i<N*N;i++)
		fac[i]=(ll)fac[i-1]*i%mod,ifac[i]=qpow(fac[i],mod-2);
	f[1][0]=1;
	vector<int>G(len),H(len);
	int tot=0;
	for(int i=1;i<=n;i++){
		memset(g,0,sizeof(g));
		for(int k=1;k<i;k++)
			for(int j=0;j<len;j++)
				g[j]=M.mod(g[j]+M.mod((ull)h[k][j]*h[i-k][j])*binom(i,k));
		G.assign(g,g+len);
		// cout<<G<<'\n';
		int tbg=clock();
		ntt_transfer(G,len,groot,0);
		tot+=clock()-tbg;
		for(int j=1;j<=i*(i-1)/2;j++)
			f[i][j]=M.mod(M.mod((ll)G[j-1]*fac[j-1])*inv2);
		for(int j=1;j<=i*(i-1)/2;j++)
			f[i][j]=M.mod(f[i][j]+(ll)f[i][j-1]*(i*(i-1)/2-j+1));
		for(int j=0;j<=i*(i-1)/2;j++)
			h[i][j]=M.mod((ll)(1+(i!=1))*f[i][j]*ifac[j]);
		H.assign(h[i],h[i]+len);
		tbg=clock();
		ntt_transfer(H,len,groot,1);
		tot+=tbg-clock();
		// cout<<H<<'\n';
		for(int j=0;j<len;j++)
			h[i][j]=H[j];
	}
	for(int i=2;i<=n;i++)
		printf("%lld\n",(ll)f[i][i*(i-1)/2]*ifac[i*(i-1)/2]%mod);
	return;
}
int main(){
	Debug("%.3lfMB\n",fabs(&memed-&membg)/1024.0/1024.0);
	int timbg=clock();
	int T=1;
	while(T--)solve();
	int timed=clock();
	Debug("%.3lfs\n",1.0*(timed-timbg)/CLOCKS_PER_SEC);
	fflush(stdout);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 19ms
memory: 12820kb

input:

10 998244353

output:

1
1
532396989
328786831
443364983
567813846
34567523
466373946
474334062

result:

ok 9 numbers

Test #2:

score: 0
Accepted
time: 3482ms
memory: 128200kb

input:

250 998244353

output:

1
1
532396989
328786831
443364983
567813846
34567523
466373946
474334062
289137877
768923227
177538883
440227465
101981224
874960215
35275208
664066979
334444870
46651494
799130693
122319095
913072242
44703442
965640306
52873544
461938281
263838691
777326453
356621754
560569747
812581766
46147702
12...

result:

ok 249 numbers

Test #3:

score: 0
Accepted
time: 3469ms
memory: 127236kb

input:

250 65537

output:

1
1
8739
5982
43573
63055
50957
48651
15842
40150
26535
53234
50550
8708
34485
48568
52730
2494
37477
52676
25640
62555
6175
28734
38834
6442
35198
41267
12029
47992
59673
56920
23395
6921
24280
30992
26117
42844
58258
60841
45860
45174
7890
61836
33308
31989
46003
26412
65049
3275
27651
24854
19324...

result:

ok 249 numbers

Test #4:

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

input:

53 388104193

output:

1
1
336356968
214073345
125029948
256194443
324728373
252271025
41071339
255261125
303673551
386500798
380098087
334030544
21146841
35595828
109748708
374150041
115452835
68503904
361203571
189209075
25841914
91084846
120202951
243592953
282123514
59664335
115899465
124480611
382303006
274389010
381...

result:

ok 52 numbers

Test #5:

score: 0
Accepted
time: 3493ms
memory: 123716kb

input:

250 501350401

output:

1
1
133693441
419781487
415643913
328974781
174858745
210645512
392448973
236450194
118550383
400344056
74410712
346956257
131095249
83722471
304777563
251228003
319421862
269449862
49566095
1225995
273902805
390571821
479094611
183490176
175647696
403152034
56263390
451565109
306841872
455344335
54...

result:

ok 249 numbers

Test #6:

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

input:

54 224133121

output:

1
1
59768833
27571932
31096014
154367654
111895187
191632057
193701105
2273872
43123886
157719904
116255397
152242140
16946309
51201778
60524037
55182110
198787777
54977617
38676210
209061614
44104978
68697538
14813004
20749250
154165177
65436415
76875635
61942182
16958006
182037202
143234221
101428...

result:

ok 53 numbers

Test #7:

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

input:

48 395968513

output:

1
1
343172712
256122491
155517304
2149468
248050087
35688125
93112331
20017580
192136123
276020173
5196812
49448078
342822757
208872152
77816522
586806
349612730
167608586
257743139
35670677
285555797
151298290
50510623
169302508
13968844
254399380
37113035
350317896
147060359
314314671
39009273
266...

result:

ok 47 numbers

Test #8:

score: 0
Accepted
time: 25ms
memory: 29428kb

input:

44 313458689

output:

1
1
229869706
13682721
1812765
101544624
288059750
193893027
22481188
9307513
55952080
67153315
273198665
191760424
228057186
262516173
277437966
287281585
257202287
141705421
72156080
125698676
160211956
301238473
49231363
192880751
222431081
302863540
159016808
157986274
282803777
303586571
489858...

result:

ok 43 numbers

Test #9:

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

input:

55 383778817

output:

1
1
179096782
175137159
82587634
141519214
250401671
195610992
318568605
266423385
83876164
118411970
343913375
143839042
222777805
98039221
321405139
196102719
339402379
95353026
251499186
361003717
21369351
53120941
375111281
123621572
252067087
85517364
335250264
356984500
128565259
223247193
371...

result:

ok 54 numbers

Test #10:

score: 0
Accepted
time: 25ms
memory: 27240kb

input:

44 89849857

output:

1
1
41929934
45281476
65232652
29063686
78717139
64682731
78928619
23717630
74030357
50198826
77249649
48006137
42729066
64978589
30719748
41310900
66264340
86659864
30080021
79469921
13197532
73023294
70164976
35278721
49128978
11168242
55607666
42443436
7922592
71107981
49627060
71632150
49472734
...

result:

ok 43 numbers

Test #11:

score: 0
Accepted
time: 3472ms
memory: 125496kb

input:

250 127664129

output:

1
1
93620362
5572641
101619740
12863095
56237969
96244149
71428409
81849675
3525174
43776029
72747326
26811270
119112621
15949349
93833838
119946954
45148517
31264525
110836452
62863894
107384189
25277551
34001472
107434268
72335496
57899944
78908516
5233106
37413917
79805770
110868778
113961892
806...

result:

ok 249 numbers

Test #12:

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

input:

56 897712129

output:

1
1
59847476
751655791
627481746
426090648
814548617
407520767
176302138
434821281
101910233
363511221
102041629
159620361
409499405
323545598
482720851
662074174
161800803
378947488
466425442
715240113
622659219
292562868
257028564
726529734
505594215
574740180
285231410
298325658
689415154
1833134...

result:

ok 55 numbers

Test #13:

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

input:

45 604962817

output:

1
1
282315982
448920821
207543410
76310096
46555224
439633162
473110824
599523148
433515750
66557799
67147037
260617160
36864342
142326781
83084425
98525996
573623365
491845660
70805677
89776095
213024999
255464844
132396483
52173558
531401900
350991158
423251064
320587449
422123839
140735143
682612...

result:

ok 44 numbers

Test #14:

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

input:

49 615055361

output:

1
1
574051671
524749614
603169343
300092019
8113397
314309152
472694895
281825707
506345966
6249675
377698236
179395380
55917138
421374915
380903703
430562538
494538026
548399547
533047765
45532746
549020717
136010653
349600485
340791363
67555236
504337434
234289378
144184855
306203613
240207332
606...

result:

ok 48 numbers

Test #15:

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

input:

52 842530817

output:

1
1
112337443
758946411
46451888
669659225
785670115
561623831
705689194
478267957
512578462
106218030
189091632
683684560
330141654
420743438
141468532
665301021
223258293
6562415
408111617
761920191
273508989
737440402
523986868
350129644
721253059
714839766
586530544
375741908
652918549
631005497...

result:

ok 51 numbers

Test #16:

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

input:

56 561774593

output:

1
1
299613117
506042987
98542834
261938655
449360053
448605707
445025733
215916000
482556467
552266338
116419410
234086407
514462897
531803278
128160134
270249402
238300089
174442999
351835580
557151382
549268042
513430529
99405738
552933810
509821244
39945049
333739941
502611089
428437143
387389053...

result:

ok 55 numbers

Test #17:

score: 0
Accepted
time: 33ms
memory: 35388kb

input:

53 283574273

output:

1
1
151239613
120406537
13103782
29521066
127428102
277239878
279845787
102531347
165306520
163646151
255332831
251254178
106810880
195601718
95345926
44791646
91258065
119791964
34831944
20492846
112235004
59312122
45333339
137542621
195491075
27443396
135816484
167554547
195269674
111679636
330955...

result:

ok 52 numbers

Test #18:

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

input:

53 32899073

output:

1
1
17546173
28068654
12661889
16070325
15195011
5443228
27838131
8442026
16365616
22142650
25013415
29375020
26150412
16224063
1006021
2146930
26689110
23998717
24011686
25787369
16360999
16809342
5667783
5736332
15610044
15183939
25013586
2831823
25276430
26075333
28104716
23272092
13495874
112773...

result:

ok 52 numbers

Test #19:

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

input:

56 944177153

output:

1
1
503561149
400900617
360556406
492562923
594103190
550800573
265119197
554761085
891525837
506298363
860211339
451321874
904778927
452510277
584812720
196816504
489876277
928325044
48480283
821777268
372559454
492136087
607339635
585797365
544955398
615809907
510438535
89686342
203754390
48944848...

result:

ok 55 numbers

Test #20:

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

input:

54 131530753

output:

1
1
113993320
53760586
78113996
24410677
114445170
97478426
72046438
2492384
127122915
419812
62909238
57296059
23585935
68171721
21886641
79315445
131083831
84909285
111632904
3711957
27355967
78222470
103843451
47552686
11487164
101566299
61533974
120115902
26679530
10359752
19517920
47083369
1239...

result:

ok 53 numbers

Test #21:

score: 0
Accepted
time: 25ms
memory: 29440kb

input:

44 188153857

output:

1
1
87805134
184420646
91178077
164503460
153476426
117920741
113771662
51828669
18947216
36754672
57139384
78296526
12126199
31221491
151880480
20028292
42570858
54821972
60927192
24690858
40804416
17946728
87877017
78733609
185323539
69410543
130359357
119271522
32380100
158656409
10600399
7259396...

result:

ok 43 numbers

Test #22:

score: 0
Accepted
time: 3465ms
memory: 125708kb

input:

250 120324097

output:

1
1
56151246
31990931
117448553
64369209
72725770
30466476
57674482
69368484
66783278
48111901
12262952
16448849
100674597
101207905
13859452
48529492
114462268
13901370
5716282
9590975
42447299
57223387
96262952
73523586
75314457
4826729
54765428
15468360
63296903
22697541
95878346
68459886
6912188...

result:

ok 249 numbers

Test #23:

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

input:

54 215744513

output:

1
1
115063741
153247095
214075361
76400941
14677804
79350840
121755431
67819276
152180997
17138609
100588920
45626212
165795444
108646784
152095935
112264443
135733469
200328227
4432298
122490609
34801412
59172881
50874182
123414489
3598532
13205751
31627190
203001833
126970795
115600818
175862834
1...

result:

ok 53 numbers

Test #24:

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

input:

46 178585601

output:

1
1
166679895
126852471
174956006
154721225
176479245
27885682
144580615
149980171
168594348
97022878
144174859
6531946
18627007
56492455
36265471
73480901
127797078
4333915
78873332
31648698
164433860
26626156
168353543
178539648
38745357
30588307
41268891
76149284
122438723
113608338
84603090
1187...

result:

ok 45 numbers

Test #25:

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

input:

48 908132353

output:

1
1
787048040
414425479
514225283
635371259
228693304
339269684
71580350
340787328
137057827
624211352
778168727
722270824
274521901
774597134
566295425
673262008
237236677
425541737
472404016
105980519
734306530
365442697
366930770
443053919
364850566
691017765
543843029
358240770
236333711
2074574...

result:

ok 47 numbers

Test #26:

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

input:

52 167772161

output:

1
1
156587351
31290840
47597832
67209163
105980369
164317049
63460307
29575615
25507715
46096804
114933202
147847477
78115455
74156478
130842265
105634201
153225981
85637747
98063612
142995271
37828233
39433073
104941667
55576244
105114666
5601342
128866635
2774096
164469277
27631183
77725257
160598...

result:

ok 51 numbers

Test #27:

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

input:

47 106037249

output:

1
1
77760650
45023753
82462823
16301413
58039008
18939197
95756388
74558145
52812197
38987544
60907336
95545949
24047798
69867318
72509282
74716846
87944192
8894521
69473100
29820794
6750080
63972977
68573959
17901336
83131569
97754464
53686371
6363895
55595384
22673872
78336687
30070355
7098160
425...

result:

ok 46 numbers

Test #28:

score: 0
Accepted
time: 15ms
memory: 27176kb

input:

41 276889601

output:

1
1
258430295
249420395
248395390
26469914
7497658
183200940
81009453
224714233
224664229
149392574
33063674
202707810
267054659
139115054
41218121
106685459
56197723
253284080
240430857
246645233
256799840
184809927
149096571
209792171
118499340
265261693
20489860
170703774
271149903
9119369
865112...

result:

ok 40 numbers

Test #29:

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

input:

44 525729793

output:

1
1
455632488
114742614
495343790
488435043
330769403
255287201
452943125
320437153
145170504
27115921
209365127
179762989
176991637
116735051
206676457
162016782
144816796
251487846
491965693
31797166
203373724
348005630
236325247
516606333
11016509
356652253
369005580
281557095
265531627
351109047...

result:

ok 43 numbers

Test #30:

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

input:

46 662568961

output:

1
1
176685057
617871849
308809059
9626247
520601180
41413935
180615306
564306317
346746776
450347427
548978488
159544361
556780557
77034479
145855941
109532483
462654344
409581637
20754295
483578014
178458388
453294462
166125122
338975718
484786138
656751367
308927726
124268193
297362520
440092532
5...

result:

ok 45 numbers

Test #31:

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

input:

57 728825857

output:

1
1
340118734
540835061
270423598
386500460
467089702
427927289
68979533
717769450
343357165
479039296
49488244
297841369
103152315
34705016
647789684
447136358
380086510
366694409
724855906
697025949
496272855
164648932
125493092
305164816
619090240
361363387
537229044
401932769
214083825
92481393
...

result:

ok 56 numbers

Test #32:

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

input:

47 916389889

output:

1
1
61092660
418193799
189513376
149638996
224430520
826076354
244546509
379755927
732835128
682331920
427033009
723484589
516661886
265859163
236665709
189266553
707550906
666659847
121218120
719280981
467467010
236676635
101823337
442043806
695580004
420670276
870934299
424570280
183110510
2993055...

result:

ok 46 numbers

Test #33:

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

input:

47 31916033

output:

1
1
17021885
7472405
17055540
1036936
14945707
2201123
31886999
30921584
22911717
21506252
3123695
18762339
5399425
12879459
15830668
15945244
19140992
26491511
21345217
20393467
2189460
12476701
25898010
15542417
13595756
3631087
28433863
23811251
2783292
970457
3038442
3773146
5339144
12685290
134...

result:

ok 46 numbers

Test #34:

score: 0
Accepted
time: 33ms
memory: 33252kb

input:

51 497614849

output:

1
1
33174324
369261813
378809235
495351926
347221144
149990525
284321606
163710952
188542962
408375212
391741746
235182787
376359779
85643703
264973517
488293752
183596068
341278810
164411660
404722408
112828705
203139481
388608516
338031727
343149977
370648259
452624046
442993290
152809365
43782888...

result:

ok 50 numbers

Test #35:

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

input:

56 711131137

output:

1
1
331861198
222933968
18052580
274840461
593592810
174755225
250706661
543895382
233674480
516608097
372495363
336869574
530439729
546225547
18477936
74969571
340528927
312350430
412625762
20646445
399921928
497825725
678508203
570236954
90859697
701717225
361019356
7348057
361468204
217830533
528...

result:

ok 55 numbers

Test #36:

score: 0
Accepted
time: 3471ms
memory: 124960kb

input:

250 249561089

output:

1
1
183011466
165383738
206709935
36344410
108174102
85699684
39467803
219967770
66863493
96369810
236135375
185935405
102012577
79770739
42744501
164732523
144525599
170801456
77590320
133971495
216773262
233166303
185221685
195920557
130807343
33905947
48490871
104156698
12703749
177744838
2962308...

result:

ok 249 numbers

Test #37:

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

input:

41 48168961

output:

1
1
12845057
42625708
9971173
32942019
45435617
20925088
38968100
40742324
12915052
25144696
28596228
46373433
31647708
3656578
26646536
7697342
33378242
8734722
25674412
19091696
37022648
24918494
27836640
39468834
13773380
45941401
29828634
39625812
13069673
46798880
32198966
1525831
46981392
5781...

result:

ok 40 numbers

Test #38:

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

input:

60 676986881

output:

1
1
631854423
577588014
654435681
484836606
300282028
616242506
358152265
129417300
37842685
536255877
73832701
621925045
530982316
120961480
126667359
66730631
315609501
326572633
524932338
51659257
213549004
55025551
50121938
423650563
542657584
667384341
239742925
133882840
514498493
175815903
58...

result:

ok 59 numbers

Test #39:

score: 0
Accepted
time: 3477ms
memory: 125820kb

input:

250 958136321

output:

1
1
894260567
863083115
196211089
812422315
867964652
644655061
242403014
619225067
765122703
376418736
590957786
482682848
910258245
341594848
810479483
482387328
828893080
752112684
894605364
135649739
606091718
235150947
948870351
852140674
121023671
781195901
272470786
883129530
611028872
872740...

result:

ok 249 numbers

Test #40:

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

input:

48 673579009

output:

1
1
44905268
179086483
477546508
466190386
497270057
107719874
481276086
409710626
244297216
383210893
490770407
260011330
49408272
487111759
622988967
391271637
485604350
256720906
332660789
100549084
566328826
228908330
585941440
528088051
473542625
591296654
64223551
546040819
27250331
505429252
...

result:

ok 47 numbers

Test #41:

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

input:

43 298647553

output:

1
1
258827880
65181014
5711730
138462776
216954778
280431699
81111608
240457543
77238777
231128734
287861320
243376931
298226303
264134636
52842604
158688376
253572500
204607554
199670294
262664890
100314173
205316967
11923017
269102314
151384512
31028509
220235122
45108740
249256407
163073585
53500...

result:

ok 42 numbers

Test #42:

score: 0
Accepted
time: 3464ms
memory: 126700kb

input:

250 510984193

output:

1
1
442852968
257519812
67966740
172622489
277218003
260795739
36399518
140561746
27448204
169838133
22863496
118762403
510688686
132985333
167957840
43700133
268600037
369537630
45610028
508064448
62675885
425774585
495677301
125016097
24337969
451822416
250532567
403840742
476512314
24219540
16604...

result:

ok 249 numbers