QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#121150#3278. 算术zhouhuanyi100 ✓590ms3676kbC++111.3kb2023-07-07 17:13:062023-07-07 17:13:08

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-07 17:13:08]
  • 评测
  • 测评结果:100
  • 用时:590ms
  • 内存:3676kb
  • [2023-07-07 17:13:06]
  • 提交

answer

#include<iostream>
#include<cstdio>
#define N 30
using namespace std;
long long read()
{
    char c=0;
    long long sum=0;
    while (c<'0'||c>'9') c=getchar();
    while ('0'<=c&&c<='9') sum=sum*10+c-'0',c=getchar();
    return sum;
}
int T,length;
long long tong[N+1],b,p,phip;
long long fast_pow(long long a,long long b)
{
    long long res=1,mul=a;
    while (b)
    {
	if (b&1) res=(__int128)(res)*mul%p;
	mul=(__int128)(mul)*mul%p,b>>=1;
    }
    return res;
}
long long gcd(long long a,long long b)
{
    if (!b) return a;
    return gcd(b,a%b);
}
int main()
{
    long long x;
    T=read(),x=p=phip=read();
    for (long long i=2;i*i<=p;++i)
	if (x%i==0)
	{
	    phip=phip/i*(i-1);
	    while (x%i==0) x/=i;
	}
    if (x!=1) phip=phip/x*(x-1);
    x=phip;
    for (long long i=2;i*i<=phip;++i)
	if (x%i==0)
	{
	    tong[++length]=i;
	    while (x%i==0) x/=i;
	}
    if (x!=1) tong[++length]=x;
    while (T--)
    {
	b=read();
	if (gcd(p,b)!=1)
	{
	    puts("-1");
	    continue;
	}
	if (p==2)
	{
	    puts("1");
	    continue;
	}
	x=phip;
	for (int i=1;i<=length;++i)
	    while (x%tong[i]==0&&fast_pow(b,x/tong[i])==1)
		x/=tong[i];
	if ((x&1)||fast_pow(b,x>>1)!=p-1) puts("-1");
	else
	{
	    if (x!=2) printf("%lld\n",(x-2)>>1);
	    else puts("2");
	}
    }
    return 0;
}

詳細信息

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 1ms
memory: 3436kb

input:

10 3
10
7
13
4
17
28
29
13
4
30

output:

-1
-1
-1
-1
2
-1
2
-1
-1
-1

result:

ok 10 numbers

Test #2:

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

input:

10 3
17
21
29
8
25
21
8
14
26
7

output:

2
-1
2
2
-1
-1
2
2
2
-1

result:

ok 10 numbers

Test #3:

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

input:

10 2
14
12
20
12
7
4
6
12
16
13

output:

-1
-1
-1
-1
1
-1
-1
-1
-1
1

result:

ok 10 numbers

Subtask #2:

score: 5
Accepted

Dependency #1:

100%
Accepted

Test #4:

score: 5
Accepted
time: 1ms
memory: 3372kb

input:

10 4
10
10
39
26
20
30
23
13
17
27

output:

-1
-1
2
-1
-1
-1
2
-1
-1
2

result:

ok 10 numbers

Test #5:

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

input:

10 5
13
45
45
36
46
30
47
6
15
16

output:

1
-1
-1
-1
-1
-1
1
-1
-1
-1

result:

ok 10 numbers

Test #6:

score: 0
Accepted
time: 0ms
memory: 3376kb

input:

10 6
8
31
37
22
29
7
44
12
29
32

output:

-1
-1
-1
-1
2
-1
-1
-1
2
-1

result:

ok 10 numbers

Test #7:

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

input:

10 7
27
34
12
18
36
57
21
61
27
25

output:

2
2
2
-1
-1
-1
-1
2
2
-1

result:

ok 10 numbers

Test #8:

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

input:

10 8
36
58
52
78
43
42
51
40
18
27

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 10 numbers

Test #9:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

10 9
53
26
68
54
24
81
29
13
71
71

output:

2
2
2
-1
-1
-1
2
-1
2
2

result:

ok 10 numbers

Test #10:

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

input:

10 10
67
43
20
39
55
51
47
62
87
100

output:

1
1
-1
2
-1
-1
1
-1
1
-1

result:

ok 10 numbers

Subtask #3:

score: 5
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #11:

score: 5
Accepted
time: 1ms
memory: 3572kb

input:

100 97
180
581
305
712
315
861
922
484
175
519
943
365
547
142
770
114
182
452
746
290
158
583
185
600
609
412
523
397
227
839
604
387
116
621
914
640
324
678
221
938
709
677
876
678
213
653
581
903
299
287
860
765
672
180
399
907
814
969
934
956
820
864
235
848
815
367
241
737
674
417
856
404
291
4...

output:

47
2
47
3
11
7
23
2
15
15
7
47
2
15
5
47
7
3
15
2
-1
-1
11
7
7
11
47
11
3
15
1
2
15
47
47
47
3
2
7
23
15
23
23
2
15
47
2
15
7
11
47
23
47
47
23
15
47
2
-1
47
23
11
47
23
47
47
3
47
47
47
47
5
-1
47
3
15
47
47
15
2
15
23
47
2
11
5
1
47
47
2
15
2
47
47
47
3
47
2
23
15

result:

ok 100 numbers

Test #12:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

100 91
851
144
363
247
607
696
363
691
883
394
118
371
360
787
879
868
168
103
842
706
414
746
540
702
217
817
497
573
822
395
108
384
551
620
436
374
340
907
855
181
849
661
580
707
726
513
749
636
812
454
874
227
472
315
791
806
752
909
188
690
664
547
657
153
138
171
587
419
430
731
349
512
904
7...

output:

-1
-1
2
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
2
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
2
-1
2
-1
-1
2
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
2
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1

result:

ok 100 numbers

Test #13:

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

input:

100 81
85
543
544
188
666
539
270
161
666
323
221
522
512
207
622
762
284
740
143
397
265
774
419
370
344
163
214
214
501
262
436
328
647
754
453
161
416
809
723
229
496
735
357
478
242
161
227
389
188
325
382
134
463
736
325
329
231
102
623
553
728
445
460
636
416
646
637
221
219
436
695
298
161
87...

output:

-1
-1
-1
2
-1
2
-1
2
-1
2
26
-1
2
-1
-1
-1
26
26
8
-1
-1
-1
26
-1
26
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
2
26
2
-1
-1
-1
-1
-1
-1
2
2
26
26
2
-1
-1
2
-1
-1
-1
26
-1
-1
26
-1
2
-1
-1
-1
26
-1
-1
26
-1
-1
26
-1
2
-1
8
2
-1
-1
2
-1
-1
-1
-1
-1
26
-1
2
-1
-1
26
-1
-1
26
-1
26
26
-1
2
-1
-1

result:

ok 100 numbers

Test #14:

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

input:

100 100
738
253
417
420
523
537
778
736
670
839
957
849
419
768
796
772
493
269
631
615
606
484
445
701
324
586
601
690
439
249
221
372
648
999
682
202
889
231
386
179
399
414
487
480
349
436
470
749
549
149
779
707
440
737
467
449
483
803
900
459
549
972
979
949
604
244
553
509
269
784
721
387
427
...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
4
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
4
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
4
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
4
-1
-1
-1
-1
-1
-1

result:

ok 100 numbers

Test #15:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

100 71
261
626
313
283
308
396
681
76
354
297
425
355
649
399
166
201
368
671
671
72
227
248
372
641
239
697
567
424
78
238
403
457
129
384
246
357
346
496
581
279
177
503
682
392
338
656
98
564
674
562
364
567
521
304
145
457
669
421
677
694
241
535
354
354
109
511
446
209
285
355
496
645
449
273
3...

output:

-1
-1
-1
2
-1
6
34
-1
2
34
2
-1
-1
34
-1
34
34
-1
-1
-1
4
34
4
-1
6
-1
2
34
34
-1
-1
34
-1
-1
34
-1
34
2
34
4
34
-1
-1
-1
-1
4
-1
34
34
34
-1
2
-1
-1
-1
34
-1
4
-1
34
34
-1
2
2
-1
4
-1
34
-1
-1
2
-1
6
-1
34
-1
-1
-1
34
6
34
34
6
34
-1
6
2
-1
4
-1
6
-1
6
34
4
34
34
-1
4
2

result:

ok 100 numbers

Test #16:

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

input:

100 91
405
173
240
151
729
826
614
533
292
878
272
184
613
170
632
215
836
320
437
240
837
612
243
527
492
762
818
734
139
166
355
228
790
419
808
365
181
254
277
884
683
174
546
870
170
280
818
624
596
701
483
854
421
638
766
885
634
361
634
242
519
902
834
316
558
392
710
791
719
570
465
667
599
8...

output:

-1
2
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
2
2
-1
2
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
2
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1

result:

ok 100 numbers

Test #17:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

100 67
329
142
107
81
244
378
571
198
307
141
547
206
488
342
107
639
358
589
127
315
509
551
501
347
388
268
550
131
351
526
102
541
270
669
588
378
195
209
638
228
212
527
231
350
506
178
374
164
320
401
129
413
504
669
155
445
518
659
151
239
126
303
535
102
237
334
566
220
309
633
133
362
200
26...

output:

32
10
-1
-1
10
10
-1
-1
-1
32
32
10
-1
32
-1
-1
-1
10
-1
-1
-1
-1
32
32
10
-1
-1
-1
-1
32
-1
10
32
2
10
10
32
10
-1
10
32
10
2
-1
-1
32
-1
2
10
2
-1
32
-1
2
-1
10
-1
-1
-1
2
-1
-1
2
-1
-1
2
2
-1
32
2
2
10
2
2
32
10
2
-1
32
-1
2
2
10
32
2
10
-1
10
32
-1
-1
10
32
-1
32
2
32
10
32
-1

result:

ok 100 numbers

Test #18:

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

input:

100 50
437
346
112
103
466
381
454
423
206
353
166
74
357
58
479
480
372
303
99
325
180
490
341
56
425
169
359
450
200
99
199
299
432
324
339
328
419
72
322
86
247
51
277
455
71
239
380
438
448
158
293
246
489
58
251
460
109
399
172
350
123
425
456
118
199
246
139
199
221
425
440
475
142
450
257
349...

output:

9
-1
-1
9
-1
-1
-1
9
-1
9
-1
-1
1
-1
4
-1
-1
9
2
-1
-1
-1
-1
-1
-1
4
4
-1
-1
2
2
2
-1
-1
4
-1
4
-1
-1
-1
9
-1
9
-1
-1
4
-1
-1
-1
-1
1
-1
4
-1
-1
-1
4
2
-1
-1
9
-1
-1
-1
2
-1
4
2
-1
-1
-1
-1
-1
-1
1
2
2
4
-1
4
9
-1
2
-1
9
-1
-1
-1
9
-1
9
-1
2
4
-1
-1
9
1
-1
-1

result:

ok 100 numbers

Test #19:

score: 0
Accepted
time: 0ms
memory: 3404kb

input:

100 24
180
159
233
75
236
31
147
81
175
180
119
117
79
175
204
182
137
123
36
127
132
125
175
239
128
188
240
32
139
105
175
183
171
107
56
206
58
125
95
182
33
49
215
135
62
223
77
199
145
65
103
125
214
154
87
47
29
175
52
178
92
150
31
32
209
134
220
92
217
74
35
223
128
215
234
127
239
112
141
6...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
2
-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 100 numbers

Subtask #4:

score: 11
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Test #20:

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

input:

100 6007
47209
17765
12070
33936
9456
46389
53980
47081
33569
12604
9471
53986
30034
23277
45832
42538
42048
16651
8020
57713
18099
10847
36498
53379
48899
46111
27949
35995
19980
36681
43053
30147
13279
42048
54141
14304
22364
24027
47979
45448
8046
46884
34366
44206
42127
49959
27880
37359
17772
3...

output:

-1
1000
3002
3002
272
-1
-1
-1
3002
-1
3002
2
2
1000
-1
1000
2
3002
230
1000
2
76
3002
3002
1000
12
-1
3002
76
3002
-1
428
272
2
2
230
90
2
2
32
3002
-1
-1
3002
2
-1
-1
428
1000
2
-1
-1
-1
428
1000
3002
-1
-1
2
-1
3002
1000
-1
-1
1000
3002
1000
-1
3002
-1
-1
3002
-1
-1
3002
76
-1
2
-1
3002
1000
-1
-...

result:

ok 100 numbers

Test #21:

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

input:

100 4051
8389
31611
11594
12817
33649
7172
26030
7466
8694
10490
4761
17984
17340
10129
38474
14225
31740
30259
32111
33089
27227
28415
6946
12349
7420
9073
32082
36458
32201
18875
13076
19473
17013
37823
13577
16711
4649
23061
26207
27875
15180
21335
10917
7084
30956
16203
7707
6450
14670
7951
1721...

output:

-1
2
2024
674
14
2024
-1
44
404
134
-1
2024
674
-1
2024
-1
2024
-1
74
-1
2024
2024
2024
-1
74
404
-1
2
-1
674
-1
-1
674
74
2024
2024
2024
-1
404
2024
4
-1
2024
-1
-1
2
-1
404
2024
-1
674
-1
2024
674
-1
2
2024
2024
-1
-1
80
2
2
2024
-1
-1
2024
2
404
2024
2024
2
-1
224
2024
2024
2024
-1
-1
-1
74
2024
...

result:

ok 100 numbers

Test #22:

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

input:

100 9323
15509
64805
9567
78745
68708
83906
38816
82251
19294
18197
16917
66211
21706
24188
62893
35932
67872
23904
69166
43685
52836
82840
58824
65466
34882
72563
54038
64098
22473
15338
66018
38785
34483
59422
61403
33509
22947
47635
71422
29273
18645
25141
63196
26208
64199
46614
86896
34049
6128...

output:

-1
-1
4660
4660
-1
2
4660
4660
4660
4660
-1
4660
-1
-1
78
4660
78
-1
4660
4660
4660
4660
-1
4660
-1
4660
4660
4660
4660
4660
-1
-1
4660
-1
4660
-1
-1
-1
4660
4660
2
4660
4660
-1
4660
2
58
4660
-1
-1
4660
4660
-1
4660
4660
2
4660
78
-1
-1
4660
-1
-1
-1
-1
4660
4660
-1
-1
4660
2
4660
4660
4660
-1
4660...

result:

ok 100 numbers

Test #23:

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

input:

100 8280
71879
23524
17600
51841
13733
36730
17103
75017
31999
35727
69190
72656
28447
9974
25960
69762
62416
76743
27773
46635
56719
54711
46264
46757
31392
53859
27856
31928
52586
70471
18092
25217
25832
12140
60872
71114
23369
17479
30580
70472
72974
35126
58879
31688
16559
17801
79266
52471
4044...

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
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
32
-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 100 numbers

Test #24:

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

input:

100 8633
60430
10480
80513
83117
67906
46501
32354
26204
49326
41990
50727
62145
81183
29273
55670
78867
75581
17937
81612
69528
83551
42551
50586
29030
61423
10770
26151
20132
55575
77777
66256
23652
69887
25681
36638
74155
26147
61308
50210
17265
46745
83050
11699
38357
80577
47044
44634
66132
705...

output:

2
-1
-1
-1
-1
-1
-1
-1
-1
-1
131
-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
131
131
-1
2
-1
-1
-1
-1
-1
-1
-1
21
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
131
-1
-1
-1
-1
-1
-1
-1
-1
-1
21
-1
-1
-1
-1
43
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
131
-1
-1
-1
-1

result:

ok 100 numbers

Test #25:

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

input:

100 1875
15679
16586
6272
11545
14154
11282
15493
7847
18568
4598
8478
11768
16436
15352
9091
14374
13265
14897
14270
1920
14276
7011
6582
10208
8432
18251
5856
11275
10003
18124
14074
6642
7945
18271
4581
5518
9117
7164
9810
17960
12619
14093
17756
11327
8702
3496
15221
8502
10143
6183
5729
11911
2...

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
124
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
124
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
124
-1
-1

result:

ok 100 numbers

Test #26:

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

input:

100 359
443
2987
2153
3063
1307
1588
795
2153
2512
2591
524
2694
1893
2730
3485
1077
2807
3038
2904
2269
1773
1341
1482
717
2477
1831
900
985
1435
1076
3304
1045
1746
1076
1176
3563
2931
899
2084
1038
444
976
3379
1435
572
3234
2750
936
801
2601
2047
716
3270
866
1360
2022
379
3196
1804
963
3230
199...

output:

178
-1
2
-1
-1
178
178
2
2
178
-1
-1
-1
-1
-1
-1
-1
178
-1
-1
178
-1
-1
2
178
-1
-1
178
2
2
-1
178
178
2
-1
178
178
-1
-1
-1
-1
178
-1
2
178
-1
-1
178
178
-1
178
178
178
-1
-1
178
-1
-1
-1
-1
2
-1
2
2
-1
-1
178
2
-1
-1
178
2
-1
178
178
178
178
178
-1
178
-1
-1
-1
178
-1
2
-1
178
178
178
2
-1
178
-1
...

result:

ok 100 numbers

Test #27:

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

input:

100 6973
50532
67580
25240
33029
50583
10822
34495
41837
40773
40179
20901
49720
41837
44264
64287
64960
44010
28573
22717
52205
47391
29408
20424
26758
67060
32920
53581
47349
22979
46108
66098
25603
8976
8686
52270
20003
16149
65989
23187
66906
60114
18119
40683
67021
11027
22187
61716
25430
66530...

output:

-1
-1
2
-1
-1
-1
-1
2
-1
548
-1
-1
2
-1
-1
-1
-1
-1
182
-1
-1
548
182
-1
-1
182
-1
-1
-1
548
-1
548
182
548
-1
548
-1
-1
-1
-1
-1
182
-1
-1
-1
548
-1
-1
-1
-1
548
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
182
-1
-1
182
182
60
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
182
-1
-1
-1
-1
-1
548
182
18...

result:

ok 100 numbers

Test #28:

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

input:

100 7489
11286
72696
34199
47402
53224
14096
64001
38566
44544
57454
74889
37269
26930
41362
41230
42424
43515
61221
68174
68262
35058
8030
20659
62087
14962
34368
62824
38218
64126
61521
25171
41679
44197
73007
18633
40348
39008
50920
37797
59911
28408
47024
23582
56987
63187
8393
70496
70084
52775...

output:

1247
143
1247
2
3743
1871
1871
233
1871
1247
2
1871
1247
3743
155
3743
3743
415
3
935
3743
3743
935
623
116
1247
3743
3
3743
103
11
3743
415
3743
3743
935
3743
467
15
2
3743
3743
-1
467
3743
935
935
1247
15
287
935
1247
51
415
3743
1247
2
1247
3743
3743
311
3743
3743
103
3743
935
1871
116
935
287
15...

result:

ok 100 numbers

Test #29:

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

input:

100 3937
10264
30561
27656
9016
17800
9056
36272
23767
32404
26071
18011
22166
24538
16184
26093
7872
30456
28053
4980
4713
13936
36679
31485
38397
10876
7132
4139
12467
33711
4044
22369
15590
11318
31818
33162
19412
19938
14040
27031
30100
8911
28719
9762
15544
19864
8586
36326
11811
12911
38335
30...

output:

-1
-1
-1
2
2
-1
-1
-1
-1
-1
-1
-1
104
-1
314
34
-1
-1
-1
-1
314
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
20
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
104
2
-1
-1
20
-1
20
104
-1
-1
314
-1
-1
-1
2
62
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
8
-1
-1
-1
-1

result:

ok 100 numbers

Subtask #5:

score: 11
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Test #30:

score: 11
Accepted
time: 1ms
memory: 3572kb

input:

100 870871
4340793
1243207
5051375
6213833
4858829
5468093
1895983
4716622
4329188
7326127
7032179
1732301
4515071
3496892
7006275
3559934
4552910
6966967
2034005
6050959
4863305
1122074
2063870
7741800
6492441
6966967
2658328
3291177
6528485
7290647
7692269
3278193
1657513
7526455
6977925
5565770
8...

output:

87086
435434
-1
435434
145144
-1
-1
-1
39584
435434
435434
435434
-1
145144
87086
-1
-1
2
-1
29028
87086
-1
29028
-1
4
2
145144
-1
87086
435434
87086
435434
-1
194
145144
435434
-1
-1
20734
87086
-1
-1
33494
435434
-1
-1
-1
7916
-1
145144
-1
6
435434
5004
-1
435434
-1
145144
-1
435434
145144
62204
-...

result:

ok 100 numbers

Test #31:

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

input:

100 496127
3431032
3472888
3945186
1493043
1496080
2441793
4340777
3969015
3564483
1909667
3969015
811931
947407
540410
1396895
4283602
2976761
3797658
1247618
3081930
580053
1373312
4608769
4696255
4062513
992253
3971185
4754046
4824823
696150
4447444
4554584
2420120
3472888
2394828
4542622
2480634...

output:

-1
2
-1
-1
-1
-1
248062
2
248062
248062
2
248062
-1
-1
248062
248062
2
248062
248062
248062
-1
248062
-1
-1
248062
2
248062
-1
248062
-1
248062
-1
248062
2
-1
-1
2
248062
-1
2
-1
248062
248062
248062
248062
248062
248062
248062
248062
-1
248062
248062
-1
-1
-1
248062
2
248062
2
248062
-1
-1
248062
2...

result:

ok 100 numbers

Test #32:

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

input:

100 425251
1736642
929887
1859381
1195224
3611852
1575702
1050696
1600241
2167711
2470461
3111388
3018847
2099864
2041919
1984318
2699726
3032971
3432337
2861462
446148
2156584
682413
3469229
765854
4183989
3192591
1264854
3623955
440986
2144858
2003321
3062898
2832430
4137778
1923175
630308
3257053...

output:

-1
212624
14174
212624
14174
-1
212624
42524
4724
42524
212624
70874
-1
70874
70874
-1
-1
2
212624
-1
2
-1
23624
30374
-1
-1
212624
4
-1
14174
3374
14174
-1
212624
3374
10124
-1
-1
4
70874
-1
-1
14174
70874
70874
-1
-1
-1
-1
224
-1
2
-1
-1
-1
-1
70874
8504
-1
30374
212624
-1
-1
-1
-1
14
374
212624
2...

result:

ok 100 numbers

Test #33:

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

input:

100 1000000
6597220
5049546
5930742
4317480
9218751
5992493
8915356
5754068
8218751
9546902
9182545
2941655
3951785
6639465
2999999
2253465
1218751
1644989
5864267
2077662
3566443
9176929
2533032
7218751
9066747
1157461
7555220
5200699
2599999
3410828
3888820
1004579
4947717
8284018
4768622
9253205
...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
-1
-1
-1
-1
2
-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
2
-1
-1
-1
-1
-1
-1
3124
-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
624
-1

result:

ok 100 numbers

Test #34:

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

input:

100 988027
1837394
3299469
1545726
9770903
3293092
1029808
2503299
4250480
5446768
1172665
6978730
5894487
9196883
9597179
8032599
1748490
9762707
6119585
7241459
4293190
7804961
3955271
8691374
4212647
9148268
4501023
5162890
2546971
9326753
6175001
9221254
3902797
8427257
8287677
2425264
9760871
2...

output:

-1
-1
-1
-1
-1
41084
-1
-1
-1
41084
41084
-1
-1
-1
-1
-1
41084
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
41084
-1
-1
-1
41084
2
2738
-1
-1
-1
41084
-1
-1
-1
-1
-1
-1
2
-1
41084
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
8216
-1
-1
2
41084
-1
8216
-1
-1
-1
-1
-1
-1
-1
41084
-1
-1
...

result:

ok 100 numbers

Test #35:

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

input:

100 768337
6170303
7683369
3030059
6891269
3261155
7072331
2789839
3073347
3399682
7532266
1947827
7428207
2800663
7642033
4063251
2136377
7273587
5442579
4682564
7528601
1347723
3741381
2064886
5105587
4205261
5035584
2650573
3097112
3867686
1583291
5647819
2011963
5723425
4467023
7372225
6990952
4...

output:

2936
2
-1
-1
-1
-1
-1
2
-1
21
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
3915
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
11747
-1
-1
-1
1067
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
3915
355
-1
88
11747
-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 100 numbers

Test #36:

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

input:

100 41127
183500
402403
312225
293309
284980
64387
314722
61050
242933
377694
174978
125779
328862
54850
53065
236129
332135
273974
155158
189016
190589
95962
109704
311075
293405
151808
352098
175493
304394
76107
239147
371109
134874
271076
95986
202326
356435
110332
338524
393994
209517
333738
197...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
3426
-1
-1
-1
-1
-1
-1
-1
3426
-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
3426
-1
-1
-1
3426
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
3426
-1
-1
-1
-1
-1
22
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
342...

result:

ok 100 numbers

Test #37:

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

input:

100 814811
4702891
8148109
7265719
2996892
1878042
5242279
6192048
1720249
3612657
921380
4074054
8138238
6387697
964450
4598391
6143799
6650496
7172748
6233339
1576510
7969074
5712340
4227149
3487165
5242654
3553929
5297156
4829431
4612306
5592093
1206536
1964012
6014474
5350872
7111504
8142765
538...

output:

-1
2
-1
-1
-1
-1
-1
-1
-1
-1
2
-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
50306
-1
-1
2
-1
-1
16768
-1
-1
-1
16768
2
-1
-1
-1
-1
-1
-1
50306
-1
-1
50306
-1
-1
-1
-1
-1
-1
16768
-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 100 numbers

Test #38:

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

input:

100 980069
5031257
1623836
5606410
3171158
9198845
1292726
1595200
5160078
6883253
2202438
9206094
7360809
7991006
2839279
7840551
8122593
7457776
8258759
3045416
3721463
6781647
9099024
6897523
997549
2281818
6347842
9538642
1444442
8496247
1430979
1715406
1673856
7527227
8771540
4000844
5451366
74...

output:

245016
-1
245016
490033
490033
-1
490033
490033
88
245016
-1
-1
-1
490033
2
245016
-1
490033
490033
-1
490033
490033
245016
490033
490033
490033
-1
-1
245016
245016
490033
88
245016
-1
245016
-1
490033
490033
490033
245016
490033
490033
245016
245016
490033
490033
490033
2752
245016
245016
245016
55...

result:

ok 100 numbers

Test #39:

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

input:

100 482854
4480398
4711451
3356670
931320
496442
2741124
3260240
4621549
2271194
2626299
2369907
4023932
1923181
1262147
4203788
3106792
4815403
2389176
3807290
3438221
3709689
2659162
3055157
1448561
779444
3374692
3598884
1831598
4686446
2410188
3837985
3110321
2814793
3116595
3619038
3493594
1538...

output:

-1
1994
-1
-1
-1
-1
-1
-1
-1
1994
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
1994
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
20
-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
29924
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
299...

result:

ok 100 numbers

Subtask #6:

score: 11
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #40:

score: 11
Accepted
time: 1ms
memory: 3632kb

input:

1000 14804791
114016904
121184339
75210853
42958826
138955816
68574265
72970819
144709979
77262866
70792973
133638083
137672425
57493003
54397275
105847169
77366725
125834385
94267625
42694999
54812532
119224592
72719688
19168765
78672961
132656140
93972732
68588344
128284760
49714725
124752071
3731...

output:

7402394
7402394
-1
7916
4
2467464
-1
1057484
1057484
-1
224314
-1
1057484
-1
569414
-1
2467464
7402394
1057484
6
1057484
-1
-1
7402394
2467464
1057484
-1
569414
51764
-1
-1
7402394
-1
12
-1
-1
-1
-1
2467464
-1
7402394
2
211496
-1
569414
-1
-1
96134
-1
-1
2467464
224314
-1
-1
-1
-1
-1
1057484
376
464...

result:

ok 1000 numbers

Test #41:

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

input:

1000 100000000
892193085
814218751
428160882
234701783
452377635
901211602
246381989
653058049
239419363
897141085
423412510
119999999
147137651
914218751
268753168
924057373
592519983
659629202
959009839
242251162
231080539
549417126
917454439
995729894
516819433
398030620
406135890
663137939
75130...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
2
-1
-1
4
-1
-1
-1
-1
24
-1
-1
-1
-1
-1
-1
-1
-1
-1
78124
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 1000 numbers

Test #42:

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

input:

1000 52671583
135715916
283593674
133006769
427747134
427747134
219513982
118469618
149797877
243509811
445095423
504275947
488655654
306866110
483185501
218788729
258723459
504539166
485874910
260763804
493868110
175970668
232783859
516686802
372909891
279995987
174904463
502693525
117611640
158589...

output:

-1
8778596
-1
2
2
-1
8778596
26335790
-1
-1
-1
-1
8778596
-1
-1
-1
8778596
-1
-1
26335790
26335790
-1
-1
-1
26335790
-1
26335790
26335790
26335790
-1
-1
-1
8778596
-1
26335790
8778596
-1
8778596
271502
8778596
290
-1
8778596
-1
-1
-1
26335790
271502
26335790
-1
-1
-1
-1
2
30166
8778596
-1
2926198
-1...

result:

ok 1000 numbers

Test #43:

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

input:

1000 43046721
53859960
251563433
344373767
291666395
228292899
101417166
353762673
190004768
62813283
53957529
86093441
401769395
334828524
286978139
358722674
164260632
70099200
279314845
129387442
261718183
120469513
82713901
278986283
115200953
100950424
85852142
148681986
373071581
85715747
2879...

output:

-1
14348906
2
14348906
-1
-1
-1
4782968
-1
-1
2
2
-1
2
2
-1
-1
-1
-1
-1
-1
-1
4782968
59048
-1
59048
-1
2
4782968
-1
2
-1
531440
14348906
-1
14348906
4782968
14348906
-1
14348906
-1
2
-1
1594322
-1
-1
-1
-1
-1
2
-1
-1
6560
4782968
59048
14348906
4782968
14348906
14348906
-1
2
-1
-1
-1
-1
14348906
14...

result:

ok 1000 numbers

Test #44:

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

input:

1000 24137569
198049843
79684818
86935614
113110119
63987607
149525189
213729145
86552479
192710440
190964054
185100960
129055074
217238120
172392303
66108682
209736929
225051508
160946092
168572871
52117103
48275137
78744583
116302707
189249653
75903812
226259321
203043461
202750388
34736161
100121...

output:

2839713
2839713
11358855
11358855
5679427
11358855
11358855
7
1
11358855
2839713
1419856
2
11358855
-1
11358855
-1
11358855
1
288
2
11358855
11358855
5679427
5679427
668167
-1
11358855
11358855
11358855
3
11358855
11358855
11358855
2839713
2839713
11358855
1419856
7
11358855
-1
2839713
5679427
11358...

result:

ok 1000 numbers

Test #45:

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

input:

1000 98189467
454566077
238753495
311746681
529821850
144396274
197442890
860177821
751378371
554142770
564679328
814966340
141993469
455013977
485998926
723909821
556944761
960466815
777900567
531245309
381897317
711954290
854351297
710705728
646762329
489715971
511526408
640912938
402443359
885879...

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
1626
-1
-1
1774
-1
2887924
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
577584
-1
354
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
2
-1
-1
-1
-1
2887924
-1
-1
-1
-1
-...

result:

ok 1000 numbers

Test #46:

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

input:

1000 99400891
120598085
167941257
530134762
637982513
960878603
182445173
737536775
418228164
524641908
373830739
958715241
671632383
928256679
671601264
193163713
599894866
281961106
484197553
331848172
313025638
155154239
979665962
533973520
684378005
579298168
985975659
818353887
631726222
223841...

output:

-1
-1
-1
-1
-1
1380290
-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
460096
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1380290
-1
4140872
-1
-1
4140872
-1
-1
4140872
-1
-1
4140872
-1
-1
-1
-1
-1
-1
-1
-1
13802...

result:

ok 1000 numbers

Test #47:

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

input:

1000 81477582
771277123
563621033
506502979
763465588
87490714
384517229
537903672
761805868
413386942
287931443
460458267
299769292
737487421
459540743
291058414
467056788
679795600
291431386
247477976
492706511
214929688
282181952
796013522
531165055
567728046
169442368
101147055
249898981
9861600...

output:

-1
3394898
-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
3394898
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-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 1000 numbers

Test #48:

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

input:

1000 84763673
421918097
477383756
335514096
243559321
431617172
768567225
172514001
167899744
293739530
504779234
384233901
576900997
360074854
241828569
246070545
625514488
687122759
742781168
155582425
814959451
582328432
560792357
833254909
694329051
789793092
609192930
591421423
389121446
845262...

output:

-1
-1
-1
375059
-1
-1
-1
-1
13
-1
-1
75011
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
125019
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1315
-1
-1
-1
-1
-1
-1
-1
12501
-1
-1
-1
-1
-1
46
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
75011
375059
-1
-1
-1
-1
-1
375059
281
-1
-1
125019
-1
-1
-1
-1
-...

result:

ok 1000 numbers

Subtask #7:

score: 11
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Test #49:

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

input:

1000 10000000000
55723322369
14671653694
15574218751
53916062087
30128313962
62949851941
17634486244
76246218751
44081325384
70279778184
55049264364
43195767289
12699640452
63574218751
96091531560
31130570751
42645835885
47999999999
33574218751
70565204223
83921845249
99999999999
40453476405
3139840...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-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
3124
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
-1
-1
-1
-1
-1
3124
-1
-1
-1
-1
-1
24
-...

result:

ok 1000 numbers

Test #50:

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

input:

1000 6915878971
65594018119
52245181032
20404249873
40788243120
40845542073
35760759754
36487748798
34325278370
58678236680
36681815590
12098813309
51464183195
23494027346
14482836695
52175983464
49104115124
34541297756
62303183215
22313239811
27136076922
47876243513
12374277733
36884023726
48065943...

output:

3457939484
22
1152646494
-1
-1
-1
1152646494
12
-1
88665114
691587896
-1
1733302
-1
3457939484
13667744
-1
18
-1
230529298
3457939484
98798270
3457939484
181996814
1152646494
-1
4666584
-1
230529298
-1
22
493991354
50
4432
493991354
3457939484
9866
691587896
150345194
1152646494
3457939484
-1
-1
691...

result:

ok 1000 numbers

Test #51:

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

input:

1000 6103515625
20076491728
47086744748
28194595598
30153532012
58495162057
53754533396
59271009019
9046828417
43372183834
27742825550
19553875148
33393409986
15732525793
8302289607
53911098431
44026971956
60909315100
19396514502
44292386913
53458277987
58338958939
11100925038
30517578124
9057184359...

output:

2441406249
2441406249
2441406249
2441406249
19531249
-1
1220703124
2441406249
1220703124
-1
2441406249
-1
488281249
488281249
-1
-1
-1
2441406249
2441406249
2441406249
1220703124
2441406249
2
1220703124
244140624
2441406249
1220703124
1220703124
1220703124
-1
1220703124
1
2441406249
-1
488281249
2
2...

result:

ok 1000 numbers

Test #52:

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

input:

1000 9996200261
77036837717
57710656417
29371441548
44557132216
73290144436
31331445242
97036641297
74581595830
33317977550
99064838136
21886515894
28564011182
42960353861
47337956771
60557374502
20227768966
31684249869
97986807833
99329025972
95162396830
68830766152
38479280281
27509466401
79698997...

output:

499800014
-1
-1
499800014
-1
-1
-1
-1
-1
-1
-1
-1
-1
166600004
-1
-1
-1
-1
-1
-1
-1
166600004
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
12815384
499800014
-1
-1
-1
-1
-1
-1
-1
-1
499800014
-1
12815384
-1
-1
-1
-1
-1
-1
-1
-1
14
45436364
-1
-1
499800014
-1
164
55533334
-1
499800014
14
-1
45436364
-1
166...

result:

ok 1000 numbers

Test #53:

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

input:

1000 3021092551
14101473741
19473999883
13775333638
10706811844
25969054182
25975542572
10978632748
17162705087
23085270882
29770405054
16663881446
25876118885
10028234215
22618311638
20915206275
7156360282
19141327381
9024282297
6821361311
12509750010
20033885133
24489468998
20473402614
10913103969...

output:

60421850
-1
-1
-1
302109254
-1
-1
-1
503515424
503515424
20
1510546274
-1
84524
2
503515424
-1
6
53612
1510546274
71930774
215792324
302109254
503515424
-1
-1
1510546274
-1
1510546274
-1
60421850
503515424
-1
-1
-1
-1
-1
-1
65675924
-1
-1
1510546274
-1
-1
-1
167838474
23976924
1510546274
167838474
3...

result:

ok 1000 numbers

Test #54:

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

input:

1000 998910091
2946341267
9069450040
6756426152
5993460545
2146310674
1559257520
3092889205
4856922919
2239014431
3345271019
3403854628
5663997422
3522487000
3548458155
5042896458
8850850936
8698661594
6211997075
6061376330
3522509069
3875214064
1629498333
3132080598
4407404051
5388821745
4263384028...

output:

499455044
499455044
55495004
2
-1
499455044
-1
-1
99891008
4
499455044
899918
-1
-1
-1
-1
-1
499455044
-1
166485014
18498334
499455044
499455044
998
166485014
499455044
499455044
99891008
166485014
166485014
99891008
-1
-1
-1
2
166485014
499455044
99891008
-1
-1
-1
2
99891008
499455044
3699666
49945...

result:

ok 1000 numbers

Test #55:

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

input:

1000 798437641
6983141293
7272177332
2899899888
2401940309
870293152
3992188204
1503582000
2748892314
2338237311
6084632133
7960579434
4491757556
5067545267
7463304475
5599654842
5808244431
890622465
5407204077
4223634385
6018567511
5196109416
5747381883
5194406496
6329241765
6789235926
5690297703
3...

output:

39921881
399218819
199609409
43
399218819
2
199609409
57031259
199609409
19960940
4339334
-1
279173
57031259
99804704
99804704
199609409
9505209
10236379
510509
432054
-1
23483459
545
10236379
121379
30709139
18146309
18146309
355809
12097539
-1
399218819
66536469
23483459
23483459
399218819
-1
1901...

result:

ok 1000 numbers

Test #56:

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

input:

1000 2097656573
8121203953
18262600727
16980512837
5280787229
4433823604
14789232132
6123359615
13227355528
3615499202
18578912221
7055279206
18963724517
2150104534
9198925110
20882837903
10647554423
19515707696
15331705514
15201298216
14368433896
15300852210
11987901209
5544037264
20537142897
12464...

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
...

result:

ok 1000 numbers

Test #57:

score: 0
Accepted
time: 0ms
memory: 3568kb

input:

1000 4867649339
28448193591
42138723823
10649223320
12793738747
30765683950
27466777417
43507755809
10127110529
10832800430
46621222018
21857499037
25190879608
46879975832
10959712509
5725830187
26202787157
18992404050
47783219608
5999445070
6861691384
48590012711
25006837515
10407990402
46350363319...

output:

-1
-1
-1
173844618
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
173844618
-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
521533856
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
521533856
-1
-1
-1
173844618
521533856
-1
13372662
-1
-1
...

result:

ok 1000 numbers

Test #58:

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

input:

1000 4622396625
40269571686
15806983301
45400800681
21092925434
25774951959
25595756266
12573009157
19211848069
32499076541
12045349313
16958443516
22068175685
39541101981
11775650434
42877297397
23519281145
15033406995
45696509825
24662545944
5734951722
6138447870
27013111786
10429521721
3676860980...

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
800414
-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 1000 numbers

Subtask #8:

score: 7
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Test #59:

score: 7
Accepted
time: 4ms
memory: 3660kb

input:

1000 1000000000000
6116790098396
4695205667028
2967078108536
6335651057053
2306916280857
3921812592750
9485005646324
5196425781249
7165822684619
1668645110012
8945634586111
9717478444138
6281848295163
3996177470314
3459291168966
6180221797498
2199999999999
2731141708754
4765609196765
4572656203234
2...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
2
-1
3124
-1
-1
-1
-1
-1
-1
-1
-1
-1
48828124
-1
-1
-1
-1
-1
-1
-1
-1
48828124
-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
2
-1
-1
-1...

result:

ok 1000 numbers

Test #60:

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

input:

1000 200560490131
1835559160743
884745210759
1140505217245
1997017526761
857645675693
1303543202357
1550540978986
335491005678
1605593194392
942327204361
1903043230726
1855692532159
1322413968210
1967749740801
1768566149231
1029104136386
277090205450
1585292148575
487065615047
373328585739
284906487...

output:

-1
21477884
-1
1101980714
33426748354
33426748354
2571288334
100280245064
-1
-1
100280245064
-1
-1
4
-1
100280245064
-1
159936594
-1
8402198
1759302544
50
100280245064
-1
12
-1
-1
-1
-1
-1
-1
178752664
14325749294
181996814
6
30
-1
-1
20056049012
5898837944
-1
-1
100280245064
181996814
493991354
259...

result:

ok 1000 numbers

Test #61:

score: 0
Accepted
time: 7ms
memory: 3568kb

input:

1000 678223072849
3200082145831
711869437465
3926318486813
3776920498648
3475567498532
4982751946225
3583253725373
3258420874304
4852249888382
6211601115447
3026214329044
6736114138120
4522572754326
799395201245
5995901527674
3640384725311
6347911785339
3222517358393
2034669218546
2865750225841
4866...

output:

-1
-1
-1
290667031220
17294402
-1
-1
-1
-1
-1
-1
290667031220
-1
-1
-1
290667031220
290667031220
-1
2
96889010406
-1
290667031220
40353606
290667031220
-1
290667031220
-1
6
-1
290667031220
-1
-1
-1
2
290667031220
41523861602
-1
-1
-1
96889010406
7202
-1
-1
41523861602
-1
290667031220
-1
290667031220...

result:

ok 1000 numbers

Test #62:

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

input:

1000 999944000663
3150779158762
6795179322944
3125154653407
4269830855559
3228790423338
6500933265002
7205491283515
4743804678528
7440409470842
4306294791743
1815786552110
8059381783585
3813310172626
5569340219019
3406052132405
6417366135824
8921329404779
2094310844513
6456108430959
4374578944285
79...

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
20832125014
-1
-1
-1
-1
-1
-1
-1
4166425002
-1
-1
4
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1...

result:

ok 1000 numbers

Test #63:

score: 0
Accepted
time: 7ms
memory: 3568kb

input:

1000 338723094289
3115142079447
2140452381517
3356837605191
1486735328086
2771038986486
2576495858566
943056515607
1028736648395
460675389843
2686839175687
410692688411
1563024967821
1595166836089
726666174348
3184298862722
1253993915781
2661674194485
1627393200179
3104362752212
1211731046931
168648...

output:

56453849047
14113462261
56453849047
7363545527
613628793
2040500567
28226924523
84680773571
28226924523
56453849047
-1
56453849047
84680773571
85020856
169361547143
169361547143
6893582
56453849047
306814396
28226924523
169361547143
42340386785
84680773571
169361547143
7
56453849047
42340386785
8468...

result:

ok 1000 numbers

Test #64:

score: 0
Accepted
time: 6ms
memory: 3556kb

input:

1000 134077891489
1038653648511
1223603354851
265767597280
151088243410
900752567890
1193290798715
1029623617620
729089629139
709242307152
1233228030321
950743379859
420515909956
714172173720
1323669568815
459972511030
719032507370
273628450596
1239480668301
330970749442
1321928079896
709769742087
5...

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
67586408
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
...

result:

ok 1000 numbers

Test #65:

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

input:

1000 348565139375
2621244696396
2986386882304
2671616228040
1734153466821
1831192688307
1388505984246
1395070718560
1716628489369
2217382030449
2857753494823
1389477252186
3235564126648
2979368810968
819299268233
1529825366720
411244899061
779874535091
3328289614957
3107444500624
667430438803
194788...

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
81354
-1
-1
-1
-1
-1
-1
...

result:

ok 1000 numbers

Test #66:

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

input:

1000 739100658994
5776319874607
6711601599254
5608065255656
6007209418911
2765616474350
5785557941469
1451097651582
3441245817716
1994570339743
2116420510586
809631824129
2039219530781
7187902254315
1530740831138
3428671384049
3298094475246
6989868996013
6447627229338
2858155428048
6170567605688
665...

output:

1
-1
-1
3
-1
184775164747
-1
-1
184775164747
-1
46193791186
-1
92387582373
-1
92387582373
-1
46193791186
-1
-1
-1
-1
-1
184775164747
-1
46
6532
-1
92387582373
46193791186
46193791186
184775164747
3
-1
-1
-1
-1
184775164747
10363
184775164747
-1
-1
-1
92387582373
2590
184775164747
46
-1
-1
2
46
92387...

result:

ok 1000 numbers

Test #67:

score: 0
Accepted
time: 5ms
memory: 3632kb

input:

1000 929967799977
3024080215218
1234697221959
3079063273088
7484942802085
2234620644794
4287184819937
3995864191220
9060897058740
4543457066810
6749202738237
8842791711971
1805446677365
1513895000384
5276060717185
8877212456593
2565523788074
3911932017547
1046529401377
7948466527949
2346904418717
24...

output:

-1
-1
-1
-1
-1
-1
442661120
-1
-1
-1
442661120
-1
442661120
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
442661120
-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
442661120
-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 1000 numbers

Test #68:

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

input:

1000 60000000469
565398898447
123393019332
526655917090
144534628343
98935297302
125942404081
175880087762
368394098230
81855245839
172529826120
579561367683
308765827272
107600090283
120000000937
492005297740
349167489041
584770057043
449809043990
537466233719
79170693945
85202671007
135470817662
3...

output:

30000000233
30000000233
15000000116
30000000233
10000000077
30000000233
30000000233
-1
-1
15000000116
15000000116
30000000233
30000000233
2
30000000233
15000000116
10000000077
15000000116
15000000116
10000000077
30000000233
10000000077
15000000116
2
15000000116
30000000233
15000000116
5000000038
300...

result:

ok 1000 numbers

Subtask #9:

score: 17
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Test #69:

score: 17
Accepted
time: 67ms
memory: 3676kb

input:

10000 100000000000000
519438208156816
749058892683149
560389567710616
187969581437037
207893045214011
729938256392877
669974109403034
330248419792067
515873613484611
156452534758761
892272793603040
860381204640892
559999999999999
984335140044484
789918322106492
299999999999999
112163574218751
221875...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4
-1
-1
2
-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
2
-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
2
-1
-1
48828124
-1
-1
-...

result:

ok 10000 numbers

Test #70:

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

input:

10000 9827464016371
46286238768796
68783181622366
31156494271568
83179235196038
32203871157997
29328769152171
96737773803780
15615588602676
37642270946770
14020236523890
95171896799108
89177043870433
59238816470938
21442115663011
54926657316215
39140755058186
94128600523930
10774655938125
8902132921...

output:

38
327582133878
4913732008184
1637910669394
4913732008184
1637910669394
-1
982746401636
4913732008184
-1
701961715454
148900969944
-1
96347686434
-1
-1
156008
233987238484
-1
4913732008184
-1
32715682
4913732008184
-1
4913732008184
1637910669394
-1
-1
4913732008184
12
169439034764
1637910669394
3388...

result:

ok 10000 numbers

Test #71:

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

input:

10000 24780378726401
172033093250210
169858393548457
146550963916485
238682819001933
204330670304941
34262905180487
71251454764279
33305951944536
41321520812794
64459013184460
225760077788304
228488914789305
134177099858086
126133521417468
196154904341582
234030475987557
171016584244532
944888580028...

output:

12390189363199
774386835199
7039
12390189363199
12390189363199
1548773670399
1
12390189363199
12390189363199
3097547340799
12390189363199
10
15
1548773670399
12390189363199
219
77438683519
12390189363199
12390189363199
12390189363199
193596708799
12390189363199
12390189363199
3097547340799
193596708...

result:

ok 10000 numbers

Test #72:

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

input:

10000 99985480527067
670374405619638
781561278291000
556756616204746
847551733616180
850715463204338
896099696353757
747999538278268
936709348693815
177675442253282
191356608413833
924971648641648
979290701773770
754227801558302
963808913207777
969465210595163
335976446901938
932393943495942
1242192...

output:

-1
-1
462895650594
-1
-1
-1
-1
-1
37497284
1388686951784
-1
-1
-1
-1
-1
-1
-1
4166060855354
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
4166060855354
-1
-1
-1
6
-1
-1
-1
4166060855354
-1
-1
-1
-1
-1
-1
-1
-1
4166060855354
833212171070
-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 10000 numbers

Test #73:

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

input:

10000 34522712143931
146418284744310
101354114719938
280285977609049
80211005819889
172613560719654
191763019882979
114695888339435
301862417769609
212399894919429
116575157252402
88558477078437
191161884167769
175992285401976
337977930226649
315399097892642
276181697151447
145957279049895
256268740...

output:

15692141883604
-1
-1
3138428376720
2
15692141883604
15692141883604
-1
4
15692141883604
-1
-1
161050
-1
-1
2
-1
-1
8857804
15692141883604
-1
-1
-1
15692141883604
15692141883604
1426558353054
-1
15692141883604
-1
15692141883604
2
-1
3138428376720
-1
-1
-1
-1
4
15692141883604
15692141883604
15692141883...

result:

ok 10000 numbers

Test #74:

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

input:

10000 59128902591931
156707603495074
525684127896196
234669300757099
106568106169477
60619863839292
258275475246572
508605045019830
331493136515860
179847034810555
72449045308686
218058476751560
98037044647333
216485448901329
514924732925794
353059402701766
415591516037836
328262561383330
1503543091...

output:

-1
-1
821232068786
-1
-1
-1
-1
-1
-1
-1
-1
821232068786
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
273744022928
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
821232068786
-1
-1
-1
-1
-1
-1
2
821232068786
-1
-1
-1
821232068786
-1
-1
-1
-1
-1
-1
-1
-1
821232068786
-1
-1
8212...

result:

ok 10000 numbers

Test #75:

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

input:

10000 667253442593
5567708643994
4843727559872
4352451524309
4143176266652
3788786566709
1965006552478
5742789477955
4447290912018
3042125684887
718415648461
4076251488761
5469020114393
3480885100658
3792753561837
5083176138936
3303172130801
5986759532771
4493521155037
720752881736
5693806665620
407...

output:

166796438276
-1
-1
-1
-1
166796438276
166796438276
-1
-1
108
-1
166796438276
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
166796438276
-1
-1
-1
23828062610
-1
-1
-1
166796438276
-1
-1
-1
-1
55598812758
-1
-1
6
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
52
-1
20
-1
-1
166796438276
166796438276
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 10000 numbers

Test #76:

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

input:

10000 9142267739172
66658982832028
63688392540448
54760714391241
31740238686075
72731674115341
26741530838898
29855809142100
18395946386264
69336401292209
18455776043503
89554103766414
62782799582209
89793947720780
27715458334650
55255858069115
67201267719601
13876343889561
61137657677066
4338399096...

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
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 10000 numbers

Test #77:

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

input:

10000 23011977978667
23516394801474
99986419020199
200588579004918
80652458914140
213395304787594
150519828573784
146302708586594
113610490239862
195614888789223
117579469297139
112020025794268
220387412754894
80131580914748
57884421018540
138446289755575
70179195701877
174653156004087
1013377248609...

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
214602
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
23338720058
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
...

result:

ok 10000 numbers

Test #78:

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

input:

10000 57393217993937
234443322772421
413024921845389
524330323883414
321093641497776
409036863083329
190774226137165
454388935126798
245063500924313
355588094979983
87051441586364
427724704127194
491941868519459
524783027571823
303686411302568
320481239354646
73828019056238
64533777539766
2745341292...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
27188254274
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1599309074
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
27188254274
-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
2718...

result:

ok 10000 numbers

Test #79:

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

input:

10000 42839132557366
98682543120413
69298920040196
344556438148927
360455995583561
294251368683961
257034795344195
311898122300423
387719703475972
394944612364139
299066466195242
278489264308882
257034795344195
309095645485094
277942995056381
340660948466690
59501228819632
152637331687263
1167305279...

output:

-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
892406542876
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
14629615456
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
892406542876
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2677219628630
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 10000 numbers

Test #80:

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

input:

10000 67050804570750
239407527718232
471477468962301
450453391541999
323678350048488
642730230634738
210598883893296
375603353423407
475262283336900
572244033596824
277146320615152
540098857649678
236045096529326
279142795452926
337289307155268
515253063989271
670208024773495
387106228568747
5103497...

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
...

result:

ok 10000 numbers

Subtask #10:

score: 17
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Dependency #6:

100%
Accepted

Dependency #7:

100%
Accepted

Dependency #8:

100%
Accepted

Dependency #9:

100%
Accepted

Test #81:

score: 17
Accepted
time: 590ms
memory: 3556kb

input:

100000 386268948175111
3852790572209527
2415988904247543
1685966736471445
1335895690169320
3652471925763972
478344859934641
2620001758033228
2366893490170544
2069236028661056
1890935461311298
2657738119139841
1170652516506481
2681632601549084
763622885135986
1929485029555904
768928151474699
70226373...

output:

38626894817510
18300754
2971299601346
153438
-1
-1
193134474087554
-1
-1
-1
16415398
782390
-1
9196879718454
-1
-1
-1
38626894817510
-1
-1
17557679462504
-1
-1
52502
193134474087554
27590639155364
38626894817510
193134474087554
5852559820834
229767446
-1
49712863342
193134474087554
340430
-1
-1
-1
3...

result:

ok 100000 numbers

Test #82:

score: 0
Accepted
time: 457ms
memory: 3632kb

input:

100000 446728435715563
2075046335118653
849201404116191
2952735864668592
1639306760265996
4354007068367385
532288461698048
2973907662778600
3742772499567354
2116548158996689
3476883259511137
3777278881150189
1706023148670798
2501407013933354
3703147575793558
1752224011612938
4104056981700358
3410499...

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
9306841076570
9306841076570
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
9306841076570
-1
-1
-1
-1
-1
-1
-1
3102280358856
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
9306841076570
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
9306841076570
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 100000 numbers

Test #83:

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

input:

100000 570630428688384
1204664238342143
4818656953368575
5164103453296215
1741260478116547
2770886006586064
1610567858395104
3466021132745553
5630324967912645
1647156397285255
764069267442734
5249423662418244
4830289518443833
1592334631361258
1531836167853416
5370699662778727
5628089935024356
109486...

output:

8
8
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
8
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-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
2
-1
-1
-1
-1
-1
-1
-1
-1
177146
-1
-1
...

result:

ok 100000 numbers

Test #84:

score: 0
Accepted
time: 247ms
memory: 3628kb

input:

100000 107213535210701
653974613496461
822633358303382
707365395634426
804905539214133
658118598988436
185729729641026
833158475485830
201280934076803
584816690796965
886585118238637
816671847005603
872195294874102
407549408948900
312174516341567
626875233707295
556470621660860
831943743720676
14560...

output:

53076007530049
-1
-1
-1
-1
53076007530049
10615201506009
53076007530049
26538003765024
53076007530049
53076007530049
53076007530049
51515049
504
26538003765024
520302004
5151504
53076007530049
-1
53076007530049
26538003765024
53076007530049
10615201506009
53076007530049
1
10615201506009
530760075300...

result:

ok 100000 numbers

Test #85:

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

input:

100000 999999999999989
8089823030454483
5752658115789294
9670112050314702
9597063557813330
2927447320854880
6262346860587345
1111046163430162
8461588799671113
6924925134530205
1988130675210725
4885869809809075
5304954605945263
8445939698921798
7064934025633292
5968596191713418
5173770475552934
21558...

output:

499999999999993
499999999999993
499999999999993
499999999999993
1
2262443438913
1131221719456
249999999999996
499999999999993
499999999999993
499999999999993
-1
249999999999996
499999999999993
499999999999993
249999999999996
-1
499999999999993
-1
499999999999993
499999999999993
441
2
499999999999993...

result:

ok 100000 numbers

Test #86:

score: 0
Accepted
time: 548ms
memory: 3628kb

input:

100000 723656144211001
2743190737993824
6530662366274173
2785727998917056
4759622135143328
5192261559325411
1902440660361916
5556974470308649
2893742836511494
1282035390709610
5717680475874268
2511288848802130
4132929654229838
749877952312350
6052337477506532
7203241364662449
1934127635766929
119901...

output:

24121871473699
120609357368499
90457018026374
361828072105499
361828072105499
5482243516749
120609357368499
46731299
-1
32893461100499
662688776749
32893461100499
361828072105499
2128400424149
180914036052749
1566355290499
120609357368499
65
180914036052749
120609357368499
361828072105499
4309499
14...

result:

ok 100000 numbers

Test #87:

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

input:

100000 303101067429658
1888274625906864
873712063970075
2279141636465774
448320244885786
800301771137346
2370957706744283
2990167854313180
1269547825451953
2787886804027891
2946431931061291
896871570197095
2477085634509080
1014683098493870
1783312793830105
1438568188336930
2489504656428113
169192958...

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
629978145794
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
629978145794
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
209992715264
-1
-1
2
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-...

result:

ok 100000 numbers

Test #88:

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

input:

100000 108526224463969
1044358604082009
517576830368228
150660787488649
873997307944593
979270603858657
685300853999254
658794504266154
545113516648034
817034700172855
901602480162203
255588169468454
790920021920940
943343335725270
370469931736751
1030943071069193
167576987959544
872448838836778
850...

output:

4174085556305
-1
-1
-1
4174085556305
-1
-1
-1
8869841
-1
2087042778152
4174085556305
-1
-1
-1
-1
463787284033
-1
4174085556305
2087042778152
-1
-1
4174085556305
1391361852101
-1
-1
-1
-1
-1
-1
4174085556305
-1
4174085556305
-1
-1
-1
-1
-1
-1
4174085556305
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
2
-1
-1
-1
...

result:

ok 100000 numbers

Test #89:

score: 0
Accepted
time: 222ms
memory: 3568kb

input:

100000 67050804570750
344893923820492
494667706226849
185172512754203
132446369756557
619124777881609
602062706219459
498398596756353
566840141490107
404368166480889
554484482860600
164712153864346
417485648328607
565378856322248
565106221554615
172657282931373
154517745014110
406669215445455
279361...

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
...

result:

ok 100000 numbers