O–O loves to read books everyday.
He has $$$n$$$ days and $$$m$$$ books. In the $$$i$$$-th day, O–O reads $$$a_i$$$ pages. The array $$$b$$$ represents the number of pages in books.
In the $$$i$$$-th day, he wants to know the maximum number of books he already finished.
The first line contains a single integer $$$t$$$ $$$(1 \le t \le 10^5)$$$ — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers $$$n$$$ and $$$m$$$ $$$(1 \le n , m \le 2 ⋅ 10^5)$$$ — the length of the array $$$a$$$ and $$$b$$$.
The second line of each test case contains $$$n$$$ integers $$$a_1,a_2 \dots a_n$$$ $$$(1 \le a_i \le 10^9)$$$.
The third line of each test case contains $$$m$$$ integers $$$b_1,b_2 \dots b_m$$$ $$$(1 \le b_i \le 10^9)$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 ⋅ 10^5$$$.
It is guaranteed that the sum of $$$m$$$ over all test cases does not exceed $$$2 ⋅ 10^5$$$.
For each test case, output $$$n$$$ integers.
2 4 3 7 5 2 1 6 8 9 5 6 7 12 23 15 29 10 9 6 8 13 1
1 1 2 2 2 3 5 6 6
You are given an non-negative integer $$$n$$$.
Your task is to find the the count of $$$x$$$ $$$(0 \le x \le n)$$$ that can be showed that $$$x = a^2 + b^2$$$ ($$$a$$$ and $$$b$$$ are integers).
The input consists of multiple test cases. The first line contains a single integer $$$t$$$ $$$(1 \le t \le 10^5)$$$ — the number of test cases.
The each test case contains a single integer $$$n$$$ $$$(0 \le n \le 10^7)$$$.
For each test case, output a single integer.
4 1 6 576 10000000
2 5 200 1985460
In the second test case, it can be proven that $$$3$$$ and $$$6$$$ can not be showed that $$$a^2 + b^2$$$.
We know that O–O read books everyday. He learned about lucky numbers.
If their decimal representation doesn't contain digits other than $$$4$$$ and $$$7$$$. For example, numbers $$$47, 744, 4$$$ are lucky and $$$5, 17, 467$$$ are not.
Now, he has the large number $$$n$$$, his task is to find the number of lucky numbers not greater than $$$n$$$.
Print it modulo 998244353.
The number doesn't have leading zeroes.
The first line contains a single integer $$$t$$$ $$$(1 \le t \le 10^4)$$$ — the number of test cases. The description of the test cases follows.
The each test case contains a single integer $$$n$$$ $$$(1 \le n \le 10^{100})$$$.
For each test case, output a single integer.
3 47 748 774411
4 12 110
$$$S$$$ is the set of certain integers. If the difference between any two integers in the set is not greater than $$$k$$$, $$$S$$$ is considered good.
You are given an array $$$a$$$ of length $$$n$$$.
Your task is to find the number of non-empty good subarrays and non-empty good subsequences.
Print them modulo 998244353.
The first line contains a single integer $$$t$$$ $$$(1 \le t \le 10^5)$$$ — the number of test cases. The description of the test cases follows.
The first line of each test case contains two integers $$$n$$$ $$$(1 \le n \le 2 ⋅ 10^5)$$$ and $$$k$$$ $$$(0 \le k \le 10^{18})$$$.
The second line of each test case contains $$$n$$$ integers $$$a_1,a_2 \dots a_n$$$ $$$(-10^{18} \le a_i \le 10^{18})$$$.
It is guaranteed that the sum of $$$n$$$ over all test cases does not exceed $$$2 ⋅ 10^5$$$.
For each test case, output two integers — good subarrays and good subsequences.
2 4 2 4 5 8 3 7 21 32 19 -2 -5 0 -11 9
5 8 19 41
$$$n!$$$ is factorial of $$$n$$$.
$$$f_n$$$ is $$$n$$$-th fibonacci number.
$$$f_0$$$ $$$=$$$ $$$0$$$
$$$f_1$$$ $$$=$$$ $$$1$$$
$$$f_n$$$ $$$=$$$ $$$f_{n - 1}$$$ + $$$f_{n - 2}$$$
You are given an integer $$$n$$$.
$$$S = f_0^{0!} + f_1^{1!} + f_2^{2!} + f_3^{3!} + \dots + f_n^{n!}$$$
In other words, sum of $$$f_i$$$ power of $$$i!$$$
Your task is to find the last digit of $$$S$$$.
The first line contains a single integer $$$t$$$ ($$$1 \le t \le 10^5$$$) — the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer $$$n$$$ ($$$0 \le n \le 10^{18}$$$).
For each test case, output a single integer.
3 4 87 4619
7 8 4
You are given an integer $$$n$$$.
Your task is to find the number of pairs $$$a$$$ and $$$b$$$ that:
| means Bitwise OR Operation.
The first line contains a single integer $$$t$$$ $$$(1 \le t \le 10^5)$$$ — the number of test cases. The description of the test cases follows.
The each test case contains a single integer $$$n$$$ $$$(0 \le n \le 10^{9})$$$.
For each test case, output a single integer — the number of pairs.
5 0 1 6 7 8
1 3 22 36 38