QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#153052#5738. Square Sumle0nAC ✓27ms1884kbC++141.4kb2023-08-29 10:07:172023-08-29 10:07:18

Judging History

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

  • [2023-08-29 10:07:18]
  • 评测
  • 测评结果:AC
  • 用时:27ms
  • 内存:1884kb
  • [2023-08-29 10:07:17]
  • 提交

answer

#include <cstdio>

using namespace std;
typedef long long ll;

int pr[105], pw[105];
int pww[105][105];
int f2[4][8], c;
ll f(int p, int z, int k)
{
	int tmp, q = 2 * (((pr[p] + 1) / 2) & 1) - 1;
	ll ans;
	if(pr[p] == 2)
	{
		tmp = ((k > 3) ? pww[p][k - 3] : 1);
		k = ((k > 3) ? 3 : k);
		ans = (ll)tmp * f2[k][z & ((1 << k) - 1)];
	}
	else
		ans = (ll)pww[p][k - 1] * ((z % pr[p]) ? (pr[p] - q) : ((pr[p] - 1) * (q + 1)));
	return ans;
}
ll g(int p, int z, int k)
{
	if(!k)
		return 1;
	ll res = 0;
	if(k > 1 && !(z % pww[p][2]))
		res = (ll)pww[p][2] * g(p, z / pww[p][2], k - 2);
	if(k == 1 && !(z % pr[p]))
		res = 1;
	return res + f(p, z, k);
}
void work(int m)
{
	int i;
	c = 0;
	for(i = 2; (ll)i * i <= m; i++)
		if(!(m % i))
		{
			pr[++c] = i;
			pww[c][pw[c] = 0] = 1;
			while(!(m % i))
			{
				pww[c][pw[c] + 1] = pww[c][pw[c]] * i;
				++pw[c];
				m /= i;
			}
		}
	if(m > 1)
	{
		pr[++c] = m;
		pw[c] = 1;
		pww[c][0] = 1;
		pww[c][1] = m;
	}
}

int main()
{
	int n, m, i, j, k, z;
	ll ans;
	for(i = 1; i <= 3; i++)
		for(j = 0; j < (1 << i); j++)
			for(k = 0; k < (1 << i); k++)
				if((j | k) & 1)
					f2[i][(j * j + k * k) & ((1 << i) - 1)]++;
	scanf("%d%d", &m, &n);
	work(m);
	while(n--)
	{
		scanf("%d", &z);
		ans = 1;
		for(i = 1; i <= c; i++)
			ans *= g(i, z, pw[i]);
		printf("%lld\n", ans);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 3
0 1 2

output:

1
4
4

result:

ok 3 number(s): "1 4 4"

Test #2:

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

input:

4 4
0 1 2 3

output:

4
8
4
0

result:

ok 4 number(s): "4 8 4 0"

Test #3:

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

input:

5 1
3

output:

4

result:

ok 1 number(s): "4"

Test #4:

score: 0
Accepted
time: 17ms
memory: 1764kb

input:

735134400 100000
4 4 1 2 3 4 4 4 5 4 3 4 1 1 1 1 2 0 1 4 4 5 4 1 0 0 1 3 0 4 0 5 3 0 3 0 5 4 0 0 3 2 5 3 2 4 3 4 2 1 3 3 2 2 2 3 1 0 1 2 3 4 3 5 4 4 0 1 5 2 2 3 3 2 4 3 5 5 1 3 1 1 4 3 4 3 4 5 2 4 1 3 2 0 5 0 0 5 5 1 2 0 3 4 0 4 1 0 1 4 5 5 3 1 3 0 3 5 0 4 2 0 4 0 0 0 4 0 2 2 2 4 5 3 0 2 0 4 1 4 1 2...

output:

1698693120
1698693120
1698693120
1698693120
0
1698693120
1698693120
1698693120
3397386240
1698693120
0
1698693120
1698693120
1698693120
1698693120
1698693120
1698693120
30888000
1698693120
1698693120
1698693120
3397386240
1698693120
1698693120
30888000
30888000
1698693120
0
30888000
1698693120
30888...

result:

ok 100000 numbers

Test #5:

score: 0
Accepted
time: 17ms
memory: 1884kb

input:

735134400 100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
30888000
308...

result:

ok 100000 numbers

Test #6:

score: 0
Accepted
time: 16ms
memory: 1544kb

input:

536870912 100000
1 0 2 4 3 1 3 5 5 1 0 2 1 1 1 0 4 2 4 1 3 2 1 4 3 2 1 2 4 0 4 2 2 1 5 4 1 5 3 0 2 3 4 4 3 4 2 1 2 5 2 1 5 3 1 3 3 0 0 4 3 4 0 4 2 0 5 2 0 3 1 0 0 1 5 5 5 5 5 1 5 3 1 2 4 1 3 3 2 0 2 0 5 1 0 2 1 2 5 2 5 4 4 3 0 3 3 5 4 3 3 2 0 2 1 2 0 1 4 1 1 4 2 4 1 2 4 4 4 2 3 4 5 5 5 4 3 5 5 2 1 5...

output:

1073741824
536870912
1073741824
1073741824
0
1073741824
0
1073741824
1073741824
1073741824
536870912
1073741824
1073741824
1073741824
1073741824
536870912
1073741824
1073741824
1073741824
1073741824
0
1073741824
1073741824
1073741824
0
1073741824
1073741824
1073741824
1073741824
536870912
1073741824...

result:

ok 100000 numbers

Test #7:

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

input:

536870912 100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

output:

536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
...

result:

ok 100000 numbers

Test #8:

score: 0
Accepted
time: 18ms
memory: 1556kb

input:

536870912 100000
268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268435456 268...

output:

536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
...

result:

ok 100000 numbers

Test #9:

score: 0
Accepted
time: 13ms
memory: 1748kb

input:

536870912 100000
504070704 500101584 484480320 75189632 133364432 237444928 506874208 477655312 261146688 36394912 312952944 260479168 77969872 60413040 249853392 288067360 129948656 311385424 444949024 339508400 62885472 368704208 379750624 528964784 158077280 415604832 393291776 342918080 20621644...

output:

0
1073741824
1073741824
0
1073741824
1073741824
0
1073741824
1073741824
1073741824
0
0
1073741824
0
1073741824
1073741824
0
1073741824
1073741824
0
0
1073741824
0
0
0
0
1073741824
0
1073741824
0
0
1073741824
1073741824
1073741824
0
0
0
1073741824
0
0
0
0
0
0
1073741824
1073741824
0
1073741824
0
0
0
...

result:

ok 100000 numbers

Test #10:

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

input:

536870912 100000
485294080 49414144 71499776 405143552 295436288 188612608 153288704 515768320 24248320 34471936 173539328 437387264 413663232 516947968 112263168 442826752 346488832 22151168 244514816 194510848 259260416 115015680 21757952 496828416 79429632 518979584 65011712 74317824 439812096 44...

output:

1073741824
1073741824
0
0
0
0
0
0
1073741824
0
0
1073741824
1073741824
1073741824
1073741824
1073741824
0
1073741824
0
0
1073741824
0
0
1073741824
0
0
0
0
0
1073741824
1073741824
0
0
1073741824
0
0
1073741824
1073741824
1073741824
0
1073741824
1073741824
1073741824
1073741824
0
1073741824
0
0
0
1073...

result:

ok 100000 numbers

Test #11:

score: 0
Accepted
time: 18ms
memory: 1756kb

input:

536870912 100000
0 268435456 0 0 268435456 268435456 0 0 0 0 268435456 0 268435456 0 268435456 0 0 0 0 0 268435456 268435456 268435456 268435456 0 0 268435456 268435456 268435456 0 268435456 268435456 0 268435456 0 268435456 0 0 268435456 0 0 0 268435456 268435456 0 268435456 268435456 268435456 0 2...

output:

536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
536870912
...

result:

ok 100000 numbers

Test #12:

score: 0
Accepted
time: 16ms
memory: 1608kb

input:

779796616 100000
495020978 289673094 752654486 745889165 186463032 629831042 568084109 351140037 633863589 766446110 731514155 674603390 119159255 209998056 365491910 488229083 674872263 239261773 726348242 127803836 478298775 449657268 316649799 497847195 529645573 633328344 385144015 422155171 520...

output:

1569924096
0
0
1569924096
784962048
1569924096
1569924096
1569924096
1569924096
0
0
0
0
784962048
0
0
0
1569924096
1569924096
784962048
0
784962048
0
0
1569924096
784962048
0
0
784962048
0
1569924096
0
0
1569924096
0
0
1569924096
0
1569924096
1569924096
0
0
784962048
1569924096
784962048
784962048
0...

result:

ok 100000 numbers

Test #13:

score: 0
Accepted
time: 16ms
memory: 1608kb

input:

448340770 100000
17590207 378448283 377356435 142317962 32832284 283362954 431249178 350392871 210493301 353126480 88048955 133187907 155481936 36161241 120732436 163213003 410911210 27608106 348596232 178846917 22097057 75219456 295899274 238130211 383793986 278864287 345593615 417444550 409017940 ...

output:

358988288
358988288
807723648
358988288
358988288
358988288
358988288
358988288
358988288
807723648
807723648
358988288
358988288
358988288
358988288
358988288
807723648
358988288
358988288
358988288
358988288
358988288
358988288
358988288
358988288
358988288
807723648
807723648
807723648
807723648
...

result:

ok 100000 numbers

Test #14:

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

input:

266069635 100000
146486161 131831810 57279849 256487214 256048395 50362550 260854940 241073971 32811964 107121487 261768591 182834801 159474905 43026229 19974995 164881566 246287652 239486995 67200667 74910586 221718783 237592156 221561959 202289915 19119390 113997936 191068379 75123564 133679363 16...

output:

404490240
441262080
196116480
8171520
898283520
441262080
441262080
8171520
196116480
0
196116480
196116480
441262080
196116480
441262080
196116480
0
441262080
196116480
8171520
408576000
196116480
196116480
441262080
910103040
17024000
196116480
196116480
196116480
441262080
196116480
196116480
196...

result:

ok 100000 numbers

Test #15:

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

input:

1 100000
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...

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 100000 numbers

Test #16:

score: 0
Accepted
time: 11ms
memory: 1616kb

input:

2 100000
1 0 0 1 0 0 0 1 0 1 1 1 1 0 0 1 0 0 0 1 1 1 0 0 1 0 1 0 0 0 1 1 1 0 1 0 0 0 0 1 1 0 1 1 0 1 0 0 1 0 1 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 1 1 1 0 1 0 0 0 0 1 1 0 1 0 0 0 0 0 1 1 0 1 1 0 1 0 0 0 1 0 0 1 0 0 0 1 0 1 1 1 1 1 1 1 0 1 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 1 1 0 0 1 0 1 0 1 0...

output:

2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
...

result:

ok 100000 numbers

Test #17:

score: 0
Accepted
time: 11ms
memory: 1884kb

input:

3 100000
2 0 0 0 2 1 0 2 2 0 1 2 2 0 2 1 0 2 1 0 2 1 2 0 2 0 2 1 2 2 0 0 0 0 1 2 1 1 0 0 0 0 0 2 1 1 0 2 0 2 1 1 2 1 0 0 2 1 1 1 1 2 1 0 2 0 1 0 1 0 0 1 1 0 1 0 0 1 1 1 2 0 2 0 2 2 0 0 1 2 1 0 0 0 1 0 0 0 0 1 1 0 0 2 1 2 2 1 1 2 0 1 2 1 0 2 0 2 1 2 0 0 1 2 2 0 2 2 1 1 1 0 1 2 0 1 1 1 0 1 2 2 1 1 2 0...

output:

4
1
1
1
4
4
1
4
4
1
4
4
4
1
4
4
1
4
4
1
4
4
4
1
4
1
4
4
4
4
1
1
1
1
4
4
4
4
1
1
1
1
1
4
4
4
1
4
1
4
4
4
4
4
1
1
4
4
4
4
4
4
4
1
4
1
4
1
4
1
1
4
4
1
4
1
1
4
4
4
4
1
4
1
4
4
1
1
4
4
4
1
1
1
4
1
1
1
1
4
4
1
1
4
4
4
4
4
4
4
1
4
4
4
1
4
1
4
4
4
1
1
4
4
4
1
4
4
4
4
4
1
4
4
1
4
4
4
1
4
4
4
4
4
4
1
1
1
4
4
...

result:

ok 100000 numbers

Test #18:

score: 0
Accepted
time: 11ms
memory: 1744kb

input:

4 100000
0 2 2 2 3 0 0 0 2 1 3 3 3 3 0 2 2 2 1 0 3 3 1 3 3 2 3 1 2 1 3 1 2 3 1 3 2 2 2 3 0 0 0 2 2 0 2 0 2 2 3 1 3 3 1 3 1 2 3 1 1 0 1 3 1 1 1 1 3 3 0 2 3 0 2 3 2 3 3 2 2 0 3 1 2 1 2 3 2 0 1 0 3 1 1 3 1 1 0 1 3 1 3 0 1 0 1 1 1 3 2 0 3 3 0 1 2 1 2 0 2 3 1 1 0 0 0 3 3 1 3 3 0 3 1 1 2 3 1 2 3 2 2 1 2 0...

output:

4
4
4
4
0
4
4
4
4
8
0
0
0
0
4
4
4
4
8
4
0
0
8
0
0
4
0
8
4
8
0
8
4
0
8
0
4
4
4
0
4
4
4
4
4
4
4
4
4
4
0
8
0
0
8
0
8
4
0
8
8
4
8
0
8
8
8
8
0
0
4
4
0
4
4
0
4
0
0
4
4
4
0
8
4
8
4
0
4
4
8
4
0
8
8
0
8
8
4
8
0
8
0
4
8
4
8
8
8
0
4
4
0
0
4
8
4
8
4
4
4
0
8
8
4
4
4
0
0
8
0
0
4
0
8
8
4
0
8
4
0
4
4
8
4
4
0
8
4
4
...

result:

ok 100000 numbers

Test #19:

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

input:

5 100000
4 0 0 4 1 4 2 0 4 0 4 3 3 4 2 1 3 0 0 2 4 0 4 3 0 0 3 2 0 0 2 1 3 4 2 0 4 3 4 1 0 4 0 1 3 2 1 2 0 0 1 1 2 1 3 4 3 2 1 2 2 4 1 3 1 0 0 2 0 4 3 1 4 1 2 4 3 3 1 4 3 1 3 2 4 2 4 0 3 4 4 1 0 4 1 1 1 4 1 4 2 2 1 3 4 1 0 0 0 1 4 3 0 2 2 2 4 3 1 3 0 4 3 1 4 1 2 1 4 4 3 3 0 1 0 3 2 2 1 3 4 1 4 4 2 2...

output:

4
9
9
4
4
4
4
9
4
9
4
4
4
4
4
4
4
9
9
4
4
9
4
4
9
9
4
4
9
9
4
4
4
4
4
9
4
4
4
4
9
4
9
4
4
4
4
4
9
9
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
9
9
4
9
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
9
4
4
4
4
9
4
4
4
4
4
4
4
4
4
4
4
4
4
9
9
9
4
4
4
9
4
4
4
4
4
4
4
9
4
4
4
4
4
4
4
4
4
4
4
9
4
9
4
4
4
4
4
4
4
4
4
4
4
4
9
4
4
...

result:

ok 100000 numbers

Test #20:

score: 0
Accepted
time: 12ms
memory: 1756kb

input:

6 100000
4 1 2 0 3 0 0 4 4 2 4 3 0 3 5 3 3 4 0 3 2 0 2 1 3 0 1 0 1 1 5 1 1 3 0 3 0 3 1 0 3 4 2 0 0 0 3 1 3 4 4 3 4 2 2 3 1 5 0 1 0 3 0 1 5 2 3 5 2 0 3 2 1 0 0 1 4 1 1 3 4 1 4 5 4 1 0 3 3 0 5 0 4 0 0 0 0 3 5 1 0 4 4 0 3 3 5 4 1 2 3 4 5 0 0 3 1 2 0 2 2 4 4 4 2 2 0 4 2 1 1 5 5 4 5 5 2 3 0 0 2 5 5 4 5 1...

output:

8
8
8
2
2
2
2
8
8
8
8
2
2
2
8
2
2
8
2
2
8
2
8
8
2
2
8
2
8
8
8
8
8
2
2
2
2
2
8
2
2
8
8
2
2
2
2
8
2
8
8
2
8
8
8
2
8
8
2
8
2
2
2
8
8
8
2
8
8
2
2
8
8
2
2
8
8
8
8
2
8
8
8
8
8
8
2
2
2
2
8
2
8
2
2
2
2
2
8
8
2
8
8
2
2
2
8
8
8
8
2
8
8
2
2
2
8
8
2
8
8
8
8
8
8
8
2
8
8
8
8
8
8
8
8
8
8
2
2
2
8
8
8
8
8
8
8
2
2
2
...

result:

ok 100000 numbers

Test #21:

score: 0
Accepted
time: 11ms
memory: 1760kb

input:

7 100000
1 2 5 5 5 1 3 5 1 4 2 1 1 2 3 0 6 2 5 4 3 0 2 5 6 2 2 3 6 1 0 5 1 5 3 4 4 6 6 1 4 6 3 6 1 2 4 0 6 1 5 6 0 3 1 5 5 6 5 3 0 4 2 3 2 0 0 5 2 2 6 0 2 3 5 5 1 2 0 2 0 3 1 1 1 0 1 3 1 4 0 1 5 2 1 5 1 5 1 2 2 1 6 4 4 0 4 2 5 4 5 6 3 4 6 5 1 2 6 0 5 5 5 3 6 5 0 4 4 2 3 5 6 1 1 4 6 4 5 6 1 1 3 0 6 2...

output:

8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
1
8
8
8
8
8
1
8
8
8
8
8
8
8
8
1
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
1
8
8
8
8
1
8
8
8
8
8
8
8
1
8
8
8
8
1
1
8
8
8
8
1
8
8
8
8
8
8
1
8
1
8
8
8
8
1
8
8
8
8
1
8
8
8
8
8
8
8
8
8
8
8
8
8
8
1
8
8
8
8
8
8
8
8
8
8
8
8
8
1
8
8
8
8
8
8
1
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
1
8
8
8
8
8
8
...

result:

ok 100000 numbers

Test #22:

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

input:

8 100000
4 0 2 3 4 7 7 4 4 6 2 7 4 2 0 7 2 4 7 3 3 2 4 7 6 3 6 2 7 2 2 3 5 3 7 5 7 3 1 6 0 3 5 6 0 4 1 7 3 4 7 7 6 5 4 2 4 7 6 3 7 6 0 1 3 7 1 5 4 4 2 6 2 7 3 5 2 3 5 1 2 2 2 2 0 2 2 6 2 7 3 0 2 7 2 0 5 1 0 7 1 0 0 1 7 4 2 1 3 6 4 6 7 4 3 2 4 3 3 4 3 6 3 6 4 1 3 1 4 2 0 7 3 1 3 4 7 0 1 6 3 2 1 3 2 7...

output:

8
8
16
0
8
0
0
8
8
0
16
0
8
16
8
0
16
8
0
0
0
16
8
0
0
0
0
16
0
16
16
0
16
0
0
16
0
0
16
0
8
0
16
0
8
8
16
0
0
8
0
0
0
16
8
16
8
0
0
0
0
0
8
16
0
0
16
16
8
8
16
0
16
0
0
16
16
0
16
16
16
16
16
16
8
16
16
0
16
0
0
8
16
0
16
8
16
16
8
0
16
8
8
16
0
8
16
16
0
0
8
0
0
8
0
16
8
0
0
8
0
0
0
0
8
16
0
16
8
...

result:

ok 100000 numbers

Test #23:

score: 0
Accepted
time: 12ms
memory: 1600kb

input:

9 100000
8 4 8 1 2 5 0 8 8 4 2 7 7 8 3 7 8 1 6 6 4 2 3 3 3 5 6 1 2 4 7 0 0 1 1 4 1 4 5 2 3 5 0 1 4 6 7 2 1 3 3 8 7 4 7 1 6 6 4 4 6 7 3 4 7 7 7 7 3 5 6 3 6 7 2 4 2 2 4 2 1 6 2 1 2 5 8 8 7 2 4 0 2 4 6 2 2 8 1 6 2 2 7 2 1 4 0 4 1 2 3 8 2 4 4 3 3 6 1 8 4 7 8 6 5 5 5 0 5 1 6 3 4 8 3 3 7 6 5 3 2 0 4 3 4 3...

output:

12
12
12
12
12
12
9
12
12
12
12
12
12
12
0
12
12
12
0
0
12
12
0
0
0
12
0
12
12
12
12
9
9
12
12
12
12
12
12
12
0
12
9
12
12
0
12
12
12
0
0
12
12
12
12
12
0
0
12
12
0
12
0
12
12
12
12
12
0
12
0
0
0
12
12
12
12
12
12
12
12
0
12
12
12
12
12
12
12
12
12
9
12
12
0
12
12
12
12
0
12
12
12
12
12
12
9
12
12
1...

result:

ok 100000 numbers

Test #24:

score: 0
Accepted
time: 12ms
memory: 1748kb

input:

10 100000
5 5 8 9 7 1 9 5 8 6 5 9 2 8 9 7 2 7 9 9 9 6 6 3 0 6 7 9 4 5 7 1 2 9 2 4 5 9 9 3 3 7 7 9 0 9 4 1 4 1 6 8 4 9 0 2 2 9 4 2 2 2 5 9 7 7 2 0 1 3 4 9 3 4 1 7 2 8 9 4 6 9 1 5 3 3 4 0 8 5 0 9 4 5 2 7 5 9 3 0 7 1 3 7 9 8 5 7 1 6 0 7 2 5 6 0 4 6 2 6 4 4 9 7 1 8 4 1 6 7 9 9 8 0 2 4 4 0 1 1 2 8 6 5 2 ...

output:

18
18
8
8
8
8
8
18
8
8
18
8
8
8
8
8
8
8
8
8
8
8
8
8
18
8
8
8
8
18
8
8
8
8
8
8
18
8
8
8
8
8
8
8
18
8
8
8
8
8
8
8
8
8
18
8
8
8
8
8
8
8
18
8
8
8
8
18
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
18
8
8
8
18
8
18
18
8
8
18
8
8
18
8
8
18
8
8
8
8
8
8
18
8
8
8
18
8
8
18
8
18
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
8
18
8
8
8
18
...

result:

ok 100000 numbers

Test #25:

score: 0
Accepted
time: 12ms
memory: 1628kb

input:

11 100000
9 4 6 8 9 6 3 2 9 3 5 9 8 6 8 0 6 8 10 4 7 1 4 1 10 5 5 9 10 9 2 8 4 6 1 9 7 3 10 6 5 6 2 5 8 7 6 7 9 5 3 4 8 8 1 0 2 8 7 6 4 0 8 5 10 10 2 1 6 9 5 4 4 5 2 4 6 2 0 8 2 0 1 0 5 10 6 10 4 6 9 2 0 0 0 4 4 3 10 5 7 5 3 4 1 2 5 6 3 3 10 3 2 7 3 8 0 6 0 0 2 7 6 3 1 2 5 7 10 4 2 4 1 10 5 4 5 3 9 ...

output:

12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
1
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
1
12
12
12
12
12
1
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
1
12
12
1
12
1
12
12
12
12
12
12
12
12
1
1
1
12
12
12
12
12
12
12
12
...

result:

ok 100000 numbers

Test #26:

score: 0
Accepted
time: 13ms
memory: 1724kb

input:

12 100000
2 2 3 9 3 6 9 4 9 8 3 9 6 4 2 11 6 0 0 3 6 7 7 5 5 10 10 6 2 1 1 6 6 3 5 5 9 10 3 7 2 9 3 8 3 2 2 4 10 2 9 5 9 6 1 9 3 0 11 8 1 1 2 0 6 11 1 0 5 10 6 6 11 0 4 6 3 4 0 1 9 0 7 7 8 8 1 3 0 8 8 3 3 5 8 5 10 4 1 1 9 10 0 11 11 5 11 6 9 5 0 11 10 4 0 9 9 10 3 9 1 4 11 1 4 10 1 1 10 6 11 3 1 8 8...

output:

16
16
0
8
0
4
8
16
8
16
0
8
4
16
16
0
4
4
4
0
4
0
0
32
32
16
16
4
16
32
32
4
4
0
32
32
8
16
0
0
16
8
0
16
0
16
16
16
16
16
8
32
8
4
32
8
0
4
0
16
32
32
16
4
4
0
32
4
32
16
4
4
0
4
16
4
0
16
4
32
8
4
0
0
16
16
32
0
4
16
16
0
0
32
16
32
16
16
32
32
8
16
4
0
0
32
0
4
8
32
4
0
16
16
4
8
8
16
0
8
32
16
0...

result:

ok 100000 numbers

Test #27:

score: 0
Accepted
time: 12ms
memory: 1856kb

input:

13 100000
10 6 6 2 7 6 4 3 12 7 3 3 11 1 5 3 2 0 5 0 3 10 10 4 3 1 1 4 8 9 11 10 2 9 4 2 3 0 4 6 3 12 3 12 4 9 11 4 1 7 6 8 11 7 2 7 0 0 4 6 8 11 8 8 12 9 3 10 8 8 6 1 10 6 8 11 8 2 6 12 4 5 8 11 9 4 0 3 5 0 10 12 6 2 6 5 11 1 7 4 3 4 5 6 4 10 5 9 5 6 4 10 9 9 11 4 11 7 8 11 9 5 5 12 4 10 7 8 12 10 ...

output:

12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
25
12
25
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
25
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
25
25
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
12
25
12
12
25
12
12
12
12
12
12
12
12
12
12
...

result:

ok 100000 numbers

Test #28:

score: 0
Accepted
time: 13ms
memory: 1700kb

input:

14 100000
3 11 11 9 10 5 8 3 6 6 4 5 9 2 9 6 4 4 4 12 4 11 8 3 3 10 13 10 12 0 6 12 9 1 2 5 6 0 8 13 12 10 1 9 1 0 10 11 10 4 0 11 7 4 2 9 7 4 4 11 3 12 7 4 6 8 7 12 8 12 9 2 1 4 1 5 6 13 12 11 1 9 6 13 1 13 7 12 6 1 2 11 10 1 8 8 8 7 12 5 12 12 6 0 2 4 7 8 7 11 12 8 13 0 0 0 0 10 1 10 11 8 1 6 12 1...

output:

16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
2
16
16
16
16
16
16
16
2
16
16
16
16
16
16
16
2
16
16
16
16
2
16
2
16
16
16
2
16
16
16
16
16
2
16
16
16
2
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
2
16
16
16
16
16
16
16
16
16
16
2
16
16
16
16
16
2...

result:

ok 100000 numbers

Test #29:

score: 0
Accepted
time: 10ms
memory: 1560kb

input:

15 100000
14 1 2 9 11 1 8 7 1 9 12 4 0 7 1 1 14 12 8 5 8 2 8 14 10 4 5 11 5 7 11 0 10 0 7 2 2 6 13 8 13 10 2 4 8 10 5 10 8 6 7 4 12 9 8 4 14 4 7 11 2 9 7 3 2 0 13 6 3 9 0 0 14 12 1 6 4 8 10 8 4 11 4 0 8 6 4 13 3 9 6 7 8 7 4 10 13 8 11 11 4 10 0 2 5 13 11 4 4 14 0 9 1 2 8 8 3 10 3 10 0 3 4 8 5 12 12 ...

output:

16
16
16
4
16
16
16
16
16
4
4
16
9
16
16
16
16
4
16
36
16
16
16
16
36
16
36
16
36
16
16
9
36
9
16
16
16
4
16
16
16
36
16
16
16
36
36
36
16
4
16
16
4
4
16
16
16
16
16
16
16
4
16
4
16
9
16
4
4
4
9
9
16
4
16
4
16
16
36
16
16
16
16
9
16
4
16
16
4
4
4
16
16
16
16
36
16
16
16
16
16
36
9
16
36
16
16
16
16
...

result:

ok 100000 numbers

Test #30:

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

input:

16 100000
13 12 11 5 8 11 0 3 15 10 1 10 15 1 13 6 13 4 14 10 15 3 0 14 6 0 1 6 2 8 7 15 15 13 0 9 7 13 9 3 4 7 5 2 12 8 15 10 10 11 3 9 1 6 9 12 6 15 7 1 4 0 7 2 11 5 2 10 11 3 2 3 1 0 13 5 11 2 3 11 3 0 5 3 9 7 5 9 1 8 2 14 6 1 3 14 5 3 4 4 15 12 7 3 2 4 8 0 1 14 9 9 6 10 8 2 12 3 13 4 5 9 9 14 6 ...

output:

32
0
0
32
16
0
16
0
0
32
32
32
0
32
32
0
32
32
0
32
0
0
16
0
0
16
32
0
32
16
0
0
0
32
16
32
0
32
32
0
32
0
32
32
0
16
0
32
32
0
0
32
32
0
32
0
0
0
0
32
32
16
0
32
0
32
32
32
0
0
32
0
32
16
32
32
0
32
0
0
0
16
32
0
32
0
32
32
32
16
32
0
0
32
0
0
32
0
32
32
0
0
0
0
32
32
16
16
32
0
32
32
0
32
16
32
0
...

result:

ok 100000 numbers

Test #31:

score: 0
Accepted
time: 12ms
memory: 1756kb

input:

17 100000
8 15 6 15 16 16 7 9 5 4 16 3 2 1 5 14 12 1 3 1 9 11 6 4 11 12 6 5 1 13 5 3 2 8 7 4 15 5 11 8 1 1 12 3 6 2 13 10 3 1 15 4 1 13 15 15 10 0 2 15 10 5 15 5 15 0 1 7 16 4 4 12 3 0 8 10 9 5 15 13 7 15 11 15 15 5 8 6 7 6 11 8 14 0 10 14 16 12 14 6 14 3 15 6 13 11 1 0 12 15 14 7 13 13 6 2 10 10 1 ...

output:

16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
33
16
16
16
16
16
16
16
33
16
16
16
16
16
16
16
33
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
16
33
16
16
16
16
16
16
...

result:

ok 100000 numbers

Test #32:

score: 0
Accepted
time: 13ms
memory: 1528kb

input:

18 100000
3 16 9 4 2 1 14 13 0 8 8 11 11 4 1 3 2 14 1 11 13 8 8 2 0 17 14 5 11 16 8 11 14 8 7 17 0 8 12 6 5 10 6 4 15 14 17 12 15 7 17 16 10 6 13 6 1 0 13 4 17 8 17 6 12 3 15 7 12 15 13 7 12 5 15 17 0 12 4 15 17 11 15 15 6 13 13 16 6 10 8 1 17 17 10 16 10 17 5 6 10 6 16 0 15 2 8 12 17 0 13 8 3 17 9 ...

output:

0
24
18
24
24
24
24
24
18
24
24
24
24
24
24
0
24
24
24
24
24
24
24
24
18
24
24
24
24
24
24
24
24
24
24
24
18
24
0
0
24
24
0
24
0
24
24
0
0
24
24
24
24
0
24
0
24
18
24
24
24
24
24
0
0
0
0
24
0
0
24
24
0
24
0
24
18
0
24
0
24
24
0
0
0
24
24
24
0
24
24
24
24
24
24
24
24
24
24
0
24
0
24
18
0
24
24
0
24
1...

result:

ok 100000 numbers

Test #33:

score: 0
Accepted
time: 9ms
memory: 1632kb

input:

19 100000
6 17 1 1 17 12 9 4 11 9 4 1 8 0 12 10 7 2 7 15 10 9 0 2 14 9 4 7 17 14 18 6 14 1 8 13 4 11 9 16 15 2 4 7 17 11 15 12 14 18 3 11 18 17 10 16 11 6 12 6 3 18 14 4 17 6 11 3 7 6 17 7 14 7 2 15 10 6 13 3 4 11 16 18 1 5 10 2 10 8 15 17 15 1 16 17 11 16 10 17 6 14 10 4 2 3 3 4 18 4 8 8 15 9 4 6 1...

output:

20
20
20
20
20
20
20
20
20
20
20
20
20
1
20
20
20
20
20
20
20
20
1
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20
20...

result:

ok 100000 numbers

Test #34:

score: 0
Accepted
time: 13ms
memory: 1696kb

input:

20 100000
15 19 8 14 7 12 13 6 12 12 9 1 5 15 0 1 16 11 10 5 2 2 13 19 7 5 19 13 12 2 9 3 10 1 13 12 2 2 9 11 0 17 11 8 10 8 16 3 13 7 16 16 5 4 4 17 0 2 17 4 18 11 0 5 11 1 17 7 8 16 0 19 18 6 4 4 17 1 19 17 10 4 9 11 10 6 16 2 18 9 7 1 19 14 12 2 4 18 15 8 3 10 4 5 7 0 14 13 0 13 12 14 9 13 11 12 ...

output:

0
0
16
16
0
16
32
16
16
16
32
32
72
0
36
32
16
0
36
72
16
16
32
0
0
72
0
32
16
16
32
0
36
32
32
16
16
16
32
0
36
32
0
16
36
16
16
0
32
0
16
16
72
16
16
32
36
16
32
16
16
0
36
72
0
32
32
0
16
16
36
0
16
16
16
16
32
32
0
32
36
16
32
0
36
16
16
16
16
32
0
32
0
16
16
16
16
16
0
16
0
36
16
72
0
36
16
32
...

result:

ok 100000 numbers

Test #35:

score: 0
Accepted
time: 13ms
memory: 1616kb

input:

100 100000
48 32 34 54 85 85 82 68 47 73 17 52 90 96 65 52 7 34 62 95 26 12 9 43 33 84 12 85 19 72 96 18 85 86 67 89 30 2 82 52 30 20 27 34 70 21 44 68 61 10 41 43 46 75 14 66 72 46 84 18 48 93 99 17 90 45 50 36 30 12 56 50 94 23 65 51 50 25 62 67 80 34 16 67 61 16 73 21 26 53 97 85 76 84 10 66 11 7...

output:

80
80
80
80
320
320
80
80
0
160
160
80
160
80
320
80
0
80
80
0
80
80
160
0
160
80
80
320
0
80
80
80
320
80
0
160
160
80
80
80
160
160
0
80
160
160
80
80
160
160
160
0
80
0
80
80
80
80
80
80
80
160
0
160
160
320
260
80
160
80
80
260
80
0
320
0
260
520
80
0
160
80
80
0
160
80
160
160
80
160
160
320
80...

result:

ok 100000 numbers

Test #36:

score: 0
Accepted
time: 10ms
memory: 1752kb

input:

128 100000
16 19 39 13 115 121 95 52 85 114 91 49 9 57 52 8 13 85 66 120 70 85 109 31 15 125 125 81 86 71 63 52 34 86 52 81 1 34 74 38 46 85 61 17 48 86 114 56 123 96 5 31 95 121 56 45 105 107 122 7 31 76 119 89 55 69 124 101 72 118 68 25 32 96 62 127 41 114 70 18 70 115 96 38 37 63 74 79 31 101 111...

output:

256
0
0
256
0
256
0
256
256
256
0
256
256
256
256
256
256
256
256
0
0
256
256
0
0
256
256
256
0
0
0
256
256
0
256
256
256
256
256
0
0
256
256
256
0
0
256
0
0
0
256
0
0
256
0
256
256
0
256
0
0
0
0
256
0
256
0
256
256
0
256
256
256
0
0
0
256
256
0
256
0
0
0
0
256
0
256
0
0
256
0
256
0
0
256
0
256
0
25...

result:

ok 100000 numbers

Test #37:

score: 0
Accepted
time: 10ms
memory: 1588kb

input:

1024 100000
532 343 203 182 425 460 12 972 1018 768 298 646 568 413 471 473 169 713 292 584 781 539 687 873 93 332 992 1003 831 271 104 794 1007 442 811 959 793 194 955 132 980 643 942 316 778 967 207 880 662 1023 661 174 725 621 1011 845 337 557 648 227 620 116 446 973 593 82 834 413 560 40 153 748...

output:

2048
0
0
0
2048
0
0
0
2048
0
2048
0
0
2048
0
2048
2048
2048
2048
2048
2048
0
0
2048
2048
0
0
0
0
0
2048
2048
0
2048
0
0
2048
2048
0
2048
2048
0
0
0
2048
0
0
0
0
0
2048
0
2048
2048
0
2048
2048
2048
2048
0
0
2048
0
2048
2048
2048
2048
2048
0
2048
2048
0
0
0
2048
2048
0
0
0
0
2048
2048
2048
2048
2048
2...

result:

ok 100000 numbers

Test #38:

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

input:

536870912 100000
107025491 421633051 132023139 31380718 245778528 520704567 172552428 423483031 227692942 192211998 411480632 4226101 378697969 243491892 35406045 401467807 232630591 153062333 428429010 310105922 138296860 234353498 519351056 131796946 483907490 460132043 85788428 180522266 20565242...

output:

0
0
0
0
0
0
0
0
0
0
0
1073741824
1073741824
1073741824
1073741824
0
0
1073741824
1073741824
1073741824
0
1073741824
1073741824
1073741824
1073741824
0
0
1073741824
1073741824
0
1073741824
1073741824
0
0
1073741824
1073741824
0
1073741824
1073741824
1073741824
0
0
1073741824
0
1073741824
0
1073741824...

result:

ok 100000 numbers

Test #39:

score: 0
Accepted
time: 21ms
memory: 1588kb

input:

735134400 100000
351966946 399558695 239189398 510344231 175039439 644675791 543396921 351955791 351276431 584254884 9603576 370310467 319508226 106760052 205742033 264239914 381113405 385922876 630634787 379962836 727797698 457331284 248751094 670398804 647086386 580523149 431769976 363364422 52821...

output:

3503554560
0
0
0
0
0
0
0
0
0
0
0
424673280
53084160
212336640
1698693120
3397386240
0
0
141557760
1698693120
1698693120
0
1698693120
0
1698693120
0
0
3397386240
690094080
0
1698693120
0
1698693120
5520752640
0
141557760
0
1698693120
1698693120
212336640
1698693120
1698693120
3503554560
0
0
0
8493465...

result:

ok 100000 numbers

Test #40:

score: 0
Accepted
time: 26ms
memory: 1884kb

input:

698377680 100000
174874929 115776451 542362291 296235171 640864821 543893571 555407534 647698115 68974020 217165158 362922817 487305620 153843634 396400618 656920216 427154318 436458059 584629557 346896621 39021446 444407994 497679085 190393608 73249592 397237852 28267885 461913501 239085036 6447365...

output:

0
0
0
0
0
0
0
0
3822059520
0
3503554560
3822059520
212336640
1698693120
849346560
0
0
0
424673280
0
1698693120
3822059520
0
1769472000
0
3822059520
0
0
0
0
0
656916480
1698693120
0
849346560
0
0
0
0
0
849346560
0
0
221184000
212336640
1698693120
212336640
437944320
1698693120
955514880
0
212336640
0...

result:

ok 100000 numbers

Test #41:

score: 0
Accepted
time: 14ms
memory: 1752kb

input:

551350800 100000
347255357 494342994 497739323 298000174 305664559 293832011 13717396 238652722 516900907 151895054 324024370 106006683 28877808 530427027 95992705 430133685 35615930 156796714 499871507 89966715 261159684 349743316 401057912 265563544 46555881 188236911 471232806 453542929 493061902...

output:

1274019840
0
0
0
0
0
13271040
13271040
0
0
2548039680
0
0
0
2548039680
0
318504960
1274019840
0
0
0
2654208000
637009920
637009920
0
0
0
159252480
0
1274019840
0
0
0
0
1274019840
0
0
159252480
0
0
1274019840
0
0
1274019840
1274019840
2548039680
0
0
2548039680
0
109486080
2070282240
637009920
0
0
254...

result:

ok 100000 numbers

Test #42:

score: 0
Accepted
time: 21ms
memory: 1616kb

input:

110270160 100000
52294691 47672839 11158151 61123157 39733125 11467450 75592834 32034080 61466552 86394203 15702698 50569874 4503637 58233925 28472416 74050932 35468713 43504692 68943331 70691978 40079111 8477068 17093514 12148185 55028876 90799420 20686784 82647011 24779800 22250946 32444824 270685...

output:

0
0
0
254803968
0
573308928
254803968
597196800
15925248
0
21233664
254803968
254803968
1182449664
32845824
0
31850496
0
0
31850496
0
0
0
0
0
0
127401984
0
286654464
0
127401984
0
0
0
254803968
254803968
254803968
147806208
0
0
0
0
0
254803968
0
0
0
127401984
0
0
573308928
0
0
0
254803968
31850496
1...

result:

ok 100000 numbers

Test #43:

score: 0
Accepted
time: 8ms
memory: 1536kb

input:

4324320 100000
2306857 2162405 949815 3818685 1515090 4143771 1744746 457621 1154376 2645554 2578220 910706 2340155 2668184 1365262 3214167 3953908 263148 2151717 3300462 4322030 3938027 438740 3741257 126581 2294758 3380226 909290 2263855 3970446 1664867 1215350 1446612 2576177 841055 1211179 35046...

output:

1327104
2985984
0
0
0
0
0
10616832
10616832
10616832
0
10616832
0
0
0
0
1327104
0
0
0
0
0
23887872
22118400
2764800
0
0
23887872
0
0
0
0
0
10616832
0
0
5308416
0
10616832
10616832
0
22118400
1327104
0
10616832
0
0
22118400
10616832
0
110592
0
10616832
0
0
0
2654208
0
0
5308416
10616832
0
884736
0
10...

result:

ok 100000 numbers

Test #44:

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

input:

110880 100000
95873 94423 21273 56888 75476 61735 13992 44987 71532 3907 30744 58028 32541 89549 33513 75609 79761 22264 23996 931 108447 355 56804 52996 51543 68318 67542 73557 96916 48010 30431 39388 57906 14115 42516 71688 95653 61090 79446 103697 6070 88442 20583 56180 7225 54492 85167 23722 520...

output:

294912
0
0
0
294912
0
0
0
0
0
0
0
0
294912
0
221184
0
0
0
0
0
0
24576
294912
0
0
0
18432
294912
663552
0
0
221184
0
221184
0
294912
663552
0
24576
0
294912
0
663552
663552
0
0
294912
294912
0
0
0
221184
0
24576
663552
0
0
0
294912
294912
294912
147456
0
294912
0
0
0
0
0
0
0
294912
0
0
0
36864
82944
...

result:

ok 100000 numbers

Test #45:

score: 0
Accepted
time: 18ms
memory: 1884kb

input:

27720 100000
17686 18200 5273 561 26699 7661 3554 13726 12472 13115 996 14224 23866 14991 11535 6715 26131 8873 5713 17067 21383 8611 18621 10034 14676 17672 9331 24098 17268 14070 5700 25128 17735 18555 13344 23068 26577 20359 20336 21748 26226 19098 27601 9896 18527 14284 20958 26340 25774 2276 14...

output:

0
10368
73728
0
0
73728
73728
0
36864
0
0
4608
73728
0
0
0
0
73728
73728
0
0
0
55296
73728
0
36864
0
73728
0
0
0
27648
0
0
0
36864
55296
0
36864
36864
55296
55296
9216
36864
0
36864
0
0
0
36864
82944
0
0
0
165888
73728
0
55296
0
0
82944
0
82944
0
82944
0
73728
0
0
0
0
0
0
36864
165888
6144
36864
0
0...

result:

ok 100000 numbers

Test #46:

score: 0
Accepted
time: 14ms
memory: 1620kb

input:

60 100000
27 17 11 59 13 40 43 50 20 3 29 39 34 34 12 10 8 43 46 26 33 0 41 39 41 38 53 45 10 50 27 3 30 11 57 28 10 53 9 58 4 11 37 14 58 24 34 11 13 32 15 23 18 36 42 28 48 51 56 53 51 47 36 8 15 20 41 24 8 54 23 44 31 31 27 58 37 4 44 46 34 48 53 30 36 42 44 29 10 13 34 43 57 47 7 34 6 58 45 12 1...

output:

0
128
0
0
128
144
0
144
144
0
128
0
64
64
16
144
64
0
64
64
32
36
128
0
128
64
128
72
144
144
0
0
36
0
32
64
144
128
32
64
64
0
128
64
64
16
64
0
128
64
0
0
16
16
16
64
16
0
64
128
0
0
16
64
0
144
128
16
64
16
0
64
0
0
0
64
128
64
64
64
64
16
128
36
16
16
64
128
144
128
64
0
32
0
0
64
16
64
72
16
12...

result:

ok 100000 numbers

Test #47:

score: 0
Accepted
time: 19ms
memory: 1624kb

input:

999999929 100000
333111242 985608776 551629335 660056000 312643703 869806771 159666392 500650706 270736111 911053844 892559745 998822728 729706800 197533987 939222864 646096675 307023844 887718043 640832715 173209697 22212288 617166617 970250943 418300747 28207326 311253961 579344918 468543108 48691...

output:

999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
999999928
...

result:

ok 100000 numbers

Test #48:

score: 0
Accepted
time: 12ms
memory: 1756kb

input:

499999909 100000
132779996 342144208 303066674 268713241 396878201 378514132 419831856 43973502 168070737 122206707 180885675 197155146 37364142 203980917 108102389 12641495 215009614 118878917 94238126 471603678 23712973 63466959 114964498 428754718 264073485 332860754 424890287 402799023 273603300...

output:

499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
499999908
...

result:

ok 100000 numbers

Test #49:

score: 0
Accepted
time: 19ms
memory: 1748kb

input:

500000057 100000
302187627 58923539 491390084 274851659 8040723 61402244 38090547 378539892 221891656 117093534 458632669 10997239 197566218 456143697 260017707 42802709 253916468 431793598 301588790 57973905 104960069 411050931 291771483 41383117 198733642 397308772 330010760 6998710 373001622 4548...

output:

500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
500000056
...

result:

ok 100000 numbers

Test #50:

score: 0
Accepted
time: 10ms
memory: 1752kb

input:

30113 100000
18041 6658 15555 3565 11884 17754 20610 8703 26659 7343 19909 8257 6461 11258 8565 27221 29002 18907 23948 27066 20433 6070 14740 12262 12993 27037 23689 22213 6731 18570 27647 7294 22236 26530 26808 19552 3074 22495 18201 28621 17299 16465 14440 17324 11534 4984 337 8307 24550 19146 18...

output:

30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
30112
...

result:

ok 100000 numbers

Test #51:

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

input:

30089 100000
12290 7348 2578 20273 15769 27437 21319 22731 25481 17316 8495 16128 29629 3484 9266 22061 9120 25153 9629 23890 21555 20142 22161 8927 24569 24714 25751 24478 25916 5553 2201 26681 3893 2708 21723 3044 884 15668 4748 8374 28710 21592 23821 1990 23710 13925 6610 18249 28948 15622 27272 ...

output:

30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
30088
...

result:

ok 100000 numbers

Test #52:

score: 0
Accepted
time: 14ms
memory: 1636kb

input:

906070057 100000
898027160 745433326 513459125 419497945 528565676 185413152 427268171 740679499 143867562 163395978 745670303 380505792 193699475 348250056 671063669 503640257 860381755 187244478 502133130 391353929 220896003 365885002 779069354 418070697 817843303 899491604 5521354 283966435 43570...

output:

906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
906009856
...

result:

ok 100000 numbers

Test #53:

score: 0
Accepted
time: 21ms
memory: 1884kb

input:

196118330 100000
124482435 156819203 96729595 117024650 113132330 109374124 117497791 156098635 73102796 166997774 37505875 105853924 55677098 170813788 49422717 122264054 135551049 95007155 127889186 182765760 161589992 179549236 17703851 62081241 125545656 147238848 28132631 5435897 168017605 1233...

output:

357073920
158699520
357073920
357073920
357073920
158699520
158699520
357073920
158699520
158699520
357073920
158699520
158699520
2204160
158699520
158699520
158699520
357073920
158699520
357073920
158699520
158699520
158699520
158699520
158699520
158699520
158699520
158699520
357073920
357073920
15...

result:

ok 100000 numbers

Test #54:

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

input:

240829786 100000
197550197 63431372 128056740 93567337 158503752 26565855 62633691 78428485 124457881 11744009 190105296 212234541 236299983 92599445 27635867 126713038 107203116 27008791 90480989 104508142 167761389 86407648 132348271 168926745 53657026 97818979 13330119 45425707 17255291 231866395...

output:

231487488
231487488
231487488
477442944
231487488
231487488
231487488
231487488
231487488
231487488
231487488
231487488
477442944
231487488
231487488
231487488
231487488
231487488
231487488
231487488
477442944
231487488
231487488
231487488
231487488
231487488
231487488
231487488
231487488
231487488
...

result:

ok 100000 numbers

Test #55:

score: 0
Accepted
time: 9ms
memory: 1620kb

input:

94119272 100000
64155255 48624166 49579820 45334632 93964980 47449684 39248423 28670033 26266086 19872603 43972555 47667657 27733267 56517739 61038503 81382058 57939395 58017232 9674626 78586589 58024302 73648655 13014750 93019282 35645687 65105930 9751144 54847019 22801414 52531391 65324625 2294106...

output:

0
0
84756480
84756480
84756480
84756480
0
169512960
0
0
0
169512960
0
0
0
169512960
0
176576000
353152000
169512960
0
0
0
169512960
0
169512960
176576000
0
0
0
169512960
84756480
0
0
169512960
169512960
0
0
171631872
84756480
169512960
0
0
84756480
0
84756480
343263744
353152000
169512960
84756480
0...

result:

ok 100000 numbers

Test #56:

score: 0
Accepted
time: 16ms
memory: 1700kb

input:

703061118 100000
676586127 622759674 281800553 469703287 687450752 46766612 81419946 64493452 621499214 545231808 239928651 607405569 671036764 407872747 410605627 172604106 557963007 689742845 107227571 227101774 116872766 191358381 333987626 664197780 278154315 497381109 4899382 257622245 47834213...

output:

0
0
926401536
926401536
926401536
926401536
0
926401536
926401536
694801152
694801152
0
926401536
926401536
926401536
694801152
0
926401536
926401536
926401536
926401536
0
926401536
0
694801152
0
926401536
926401536
0
694801152
926401536
0
926401536
926401536
926401536
926401536
926401536
694801152
...

result:

ok 100000 numbers

Test #57:

score: 0
Accepted
time: 11ms
memory: 1752kb

input:

902252671 100000
25514261 768380231 379563360 824371628 106255725 493972885 277421453 776926915 494583597 46301812 622688393 205928353 232144442 694416691 869018575 521717469 289022636 327323704 385090042 216280565 876696099 688053278 443153512 607991253 777450857 248353892 489897887 336778405 31887...

output:

941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
941481024
39228376
941481024
941481024
941481024
941481024
941481024
941481024
941481024
9...

result:

ok 100000 numbers

Test #58:

score: 0
Accepted
time: 10ms
memory: 1760kb

input:

443388876 100000
315798208 116767405 99690561 430304154 246756535 152386871 169830811 348404348 5644684 112935356 200457463 225531744 413720506 190311227 243677377 75196776 255603407 438075727 279096870 72201040 81182234 91076992 370847379 374536067 355796329 149231849 15077033 102347088 171728720 2...

output:

675640320
1351280640
337820160
21113760
0
0
0
675640320
675640320
675640320
0
168910080
675640320
0
1351280640
168910080
0
0
168910080
675640320
84455040
675640320
0
0
168910080
1351280640
1351280640
168910080
675640320
675640320
0
675640320
675640320
168910080
168910080
675640320
675640320
0
168910...

result:

ok 100000 numbers

Test #59:

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

input:

818717615 100000
749593495 238254215 215488425 627995269 383077494 343225869 172056698 611320848 136012552 724503968 397042512 271499016 815565349 784075543 691770797 189732515 648375364 76416324 775593182 761020461 541653704 399719301 359570328 711401590 684315145 666360246 91604287 169203870 22955...

output:

1461657600
1461657600
1461657600
649625600
649625600
649625600
649625600
649625600
649625600
649625600
649625600
649625600
649625600
649625600
649625600
1461657600
649625600
649625600
649625600
649625600
649625600
649625600
649625600
1461657600
1461657600
649625600
649625600
1461657600
649625600
146...

result:

ok 100000 numbers

Test #60:

score: 0
Accepted
time: 21ms
memory: 1620kb

input:

999999999 100000
372883403 509371741 685627632 918403283 967880227 655989058 469137908 609444036 872410920 392751207 979044998 453819263 752588876 63137602 978644053 891412839 81289120 76680594 294107287 949339730 4385149 381856017 773062755 624252731 90057355 759229358 961070102 306290213 52375311 ...

output:

1297301184
1297301184
0
1297301184
1297301184
2630638512
1297301184
1297301184
0
0
1297301184
1297301184
1297301184
1297301184
1297301184
1297301184
1297301184
972975888
1297301184
1297301184
1297301184
0
0
1297301184
1297301184
1297301184
1297301184
1297301184
1297301184
1297301184
2630638512
0
129...

result:

ok 100000 numbers

Test #61:

score: 0
Accepted
time: 13ms
memory: 1636kb

input:

1000000000 100000
396540388 975044891 884485307 545742806 663740547 291444484 337914519 365780888 605623565 536776177 916506364 11866537 915578001 506920948 258100806 369867846 247098413 999018178 617492547 158693513 420288094 410705220 270766791 716948331 761511303 352603838 601833104 816809413 516...

output:

1600000000
0
0
0
0
1600000000
0
0
3200000000
1600000000
0
1600000000
1600000000
1600000000
0
0
1600000000
1600000000
0
1600000000
0
3200000000
0
0
0
0
1600000000
1600000000
1600000000
0
0
0
0
1600000000
1600000000
0
0
3200000000
1600000000
1600000000
0
1600000000
1600000000
1600000000
0
0
1600000000...

result:

ok 100000 numbers

Test #62:

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

input:

130945815 100000
38947881 16182079 63378972 19102889 109587712 48498168 95444807 104700276 130553482 43845962 51370724 123409358 90886373 103969338 61906382 79745277 17919618 66967519 5969812 49304276 13936747 121433607 92508885 115248021 739964 41309232 70902811 93138723 8466706 55814128 73207347 2...

output:

0
328458240
159252480
331776000
684288000
0
159252480
119439360
159252480
159252480
159252480
328458240
159252480
0
159252480
0
0
159252480
159252480
19906560
663552
0
33592320
0
159252480
0
19906560
159252480
159252480
328458240
0
0
328458240
0
0
159252480
1492992
0
19906560
159252480
159252480
358...

result:

ok 100000 numbers

Test #63:

score: 0
Accepted
time: 13ms
memory: 1620kb

input:

387420489 100000
292893707 164524334 252328222 363694866 365385128 304398658 172627456 54314963 14509351 186438072 276967324 372891577 40429914 23276635 25503269 116230800 373900483 249296584 280004705 371996166 356205050 252628345 93818869 88601923 293363800 329398752 113554907 370216581 335255282 ...

output:

516560652
516560652
516560652
0
516560652
516560652
516560652
516560652
516560652
0
516560652
516560652
0
516560652
516560652
0
516560652
516560652
516560652
0
516560652
516560652
516560652
516560652
516560652
0
516560652
0
516560652
0
516560652
516560652
516560652
516560652
0
516560652
516560652
51...

result:

ok 100000 numbers