In order to establish dominance amongst his friends, Chef has decided that he will only walk in large steps of length exactly $K$ feet. However, this has presented many problems in Chef’s life because there are certain distances that he cannot traverse. Eg. If his step length is $5$ feet, he cannot travel a distance of $12$ feet. Chef has a strict travel plan that he follows on most days, but now he is worried that some of those distances may become impossible to travel. Given $N$ distances, tell Chef which ones he cannot travel.

-----Input:-----
- The first line will contain a single integer $T$, the number of test cases.
- The first line of each test case will contain two space separated integers - $N$, the number of distances, and $K$, Chef’s step length.
- The second line of each test case will contain $N$ space separated integers, the $i^{th}$ of which represents $D_i$, the distance of the $i^{th}$ path.

-----Output:-----
For each testcase, output a string consisting of $N$ characters. The $i^{th}$ character should be $1$ if the distance is traversable, and $0$ if not. 

-----Constraints-----
- $1 \leq T \leq 1000$
- $1 \leq N \leq 1000$
- $1 \leq K \leq 10^9$
- $1 \leq D_i \leq 10^9$

-----Subtasks-----
- 100 points : No additional constraints.

-----Sample Input:-----
1
5 3
12 13 18 20 27216

-----Sample Output:-----
10101

-----Explanation:-----
The first distance can be traversed in $4$ steps.

The second distance cannot be traversed.

The third distance can be traversed in $6$ steps.

The fourth distance cannot be traversed.

The fifth distance can be traversed in $9072$ steps.

Source: codechef | Difficulty: EASY
Tags: Mathematics


Solutions:
for i in range(int(input())):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = ''
	for i in a:
		if i % k == 0:
			s = s + '1'
		else:
			s = s + '0'
	print(s)


for i in range(int(input())):
	(n, k) = map(int, input().split())
	x = list(map(int, input().split()))
	s = ''
	for i in x:
		s += str(int(i % k == 0))
	print(s)


kk = int(input())
for i in range(kk):
	(n, kt) = map(int, input().split())
	cv = list(map(int, input().split()))
	sq = ''
	for i in cv:
		if i % kt != 0:
			sq = sq + '0'
		else:
			sq = sq + '1'
	print(sq)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = [int(x) for x in input().split()]
	for i in l:
		if i % k == 0:
			print('1', end='')
		else:
			print('0', end='')
	print()


for _ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	res = ''
	for i in range(n):
		if arr[i] % k == 0:
			res = res + '1'
		else:
			res += '0'
	print(res)


t = int(input())
for cases in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	s = ''
	for i in range(len(arr)):
		if arr[i] % k == 0:
			s = s + '1'
		else:
			s = s + '0'
	print(s, end=' ')
	print()


for i in range(int(input())):
	(n, k) = map(int, input().split())
	L = list(map(int, input().split()))
	o = ''
	for j in L:
		if j % k == 0:
			o += '1'
		else:
			o += '0'
	print(o)


t = int(input())
for i in range(t):
	(n, r) = list(map(int, input().split()))
	s = list(map(int, input().split()))
	x = ''
	for num in s:
		if num % r == 0:
			x = x + '1'
		else:
			x = x + '0'
	print(x)


for _ in range(int(input())):
	(N, k) = map(int, input().split())
	A = list(map(int, input().split()))
	B = ''
	for i in range(N):
		if A[i] % k == 0:
			B += '1'
		else:
			B += '0'
	print(B)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = list(map(int, input().split()))
	d = []
	for i in range(a):
		if c[i] % b == 0:
			d.append('1')
		else:
			d.append('0')
	e = ''.join(d)
	print(e)


T = int(input())
while T > 0:
	(N, K) = map(int, input().split())
	D = list(map(int, input().split()))
	my_list = []
	for i in D:
		if i % K == 0:
			my_list.append('1')
		else:
			my_list.append('0')
	print(''.join(my_list))
	T -= 1


for __ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	d = list(map(int, input().split()))
	st1 = ''
	for i in d:
		st1 += '1' if i % k == 0 else '0'
	print(st1)


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	D = list(map(int, input().split()))
	s = ''
	for i in D:
		s = s + str(int(bool(not i % K)))
	print(s)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	d = list(map(int, input().split()))
	for j in d:
		if j % k == 0:
			print('1', end='')
		else:
			print('0', end='')
	print()


for i in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	c = ''
	for i in l:
		if i % k == 0:
			c += '1'
		else:
			c += '0'
	print(c)


T = int(input())
for _ in range(T):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	ans = []
	for d in l:
		if d % k == 0:
			ans.append('1')
		else:
			ans.append('0')
	print(''.join(ans))


for _ in range(int(input())):
	(m, n) = map(int, input().split())
	l = list(map(int, input().split()))
	res = ''
	for i in range(m):
		if l[i] % n == 0:
			res += '1'
		else:
			res += '0'
	print(res)


import sys
for _ in range(int(sys.stdin.readline())):
	(n, k) = map(int, sys.stdin.readline().split())
	d = list(map(int, sys.stdin.readline().split()))
	for i in d:
		if i % k == 0:
			sys.stdout.write('1')
		else:
			sys.stdout.write('0')
	sys.stdout.write('\n')


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	s = ''
	arr = list(map(int, input().split()))
	for z in range(n):
		if arr[z] % k == 0:
			s = s + '1'
		else:
			s = s + '0'
	print(s)


t = int(input())
for i in range(0, t):
	(n, k) = map(int, input().split())
	(a1, *a) = map(int, input().split())
	a.insert(0, a1)
	b = []
	j = 0
	while j < n:
		if a[j] % k == 0:
			b.append(1)
		else:
			b.append(0)
		j += 1
	l = 0
	while l < n:
		print(b[l], end='')
		l += 1
	print('')


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	nums = list(map(int, input().split()))
	ans = ''
	for i in nums:
		if i % x == 0:
			ans += '1'
		else:
			ans += '0'
	print(ans)


for t in range(int(input())):
	(x, y) = map(int, input().split())
	list1 = list(map(lambda z: z % y, list(map(int, input().split()))))
	list2 = []
	for i in list1:
		if i == 0:
			list2.append(1)
		else:
			list2.append(0)
	print(''.join(list(map(str, list2))))


t = int(input())
while t != 0:
	t = t - 1
	(a, b) = map(int, input().split())
	arr = [int(i) for i in input().split()]
	s = ''
	for i in range(a):
		if arr[i] % b == 0:
			s = s + '1'
		else:
			s = s + '0'
	print(s)


n = int(input())
for _ in range(n):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	s = ''
	for i in l:
		if i % b == 0:
			s = s + '1'
		else:
			s = s + '0'
	print(s)


for _ in range(int(input())):
	(x, y) = map(int, input().split())
	l = list(map(int, input().split()))
	for i in l:
		if i % y == 0:
			print('1', end='')
		else:
			print('0', end='')
	print()


t = int(input())
for tc in range(t):
	(n, k) = map(int, input().split())
	a = list(map(int, input().split()))
	s = ''
	for j in range(n):
		if a[j] % k == 0:
			s += '1'
		else:
			s += '0'
	print(s)


t = int(input())
for z in range(t):
	(n, k) = [int(x) for x in input().split()]
	a = [int(x) for x in input().split()]
	for i in a:
		if i % k == 0:
			print('1', end='')
		else:
			print('0', end='')
	print()


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	str = ''
	for i in l:
		if i % k == 0:
			str += '1'
		else:
			str += '0'
	print(str)


for i in range(int(input())):
	(N, K) = map(int, input().split())
	D = list(map(int, input().split()))
	ans = []
	for i in range(N):
		if D[i] % K == 0:
			ans.append('1')
		else:
			ans.append('0')
	ans = ''.join(ans)
	print(ans)


a = int(input())
for i in range(a):
	(b, c) = map(int, input().split())
	c1 = list(map(int, input().split()))
	s = ''
	for j in range(len(c1)):
		if c1[j] % c != 0:
			s += '0'
		else:
			s += '1'
	print(s)


q = int(input())
for i in range(q):
	(n, k) = map(int, input().split())
	d = list(map(int, input().split()))
	s = ''
	for j in d:
		if j % k == 0:
			s += '1'
		else:
			s += '0'
	print(s)


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	A = list(map(int, input().split()))
	str = ''
	for i in A:
		if i % K == 0:
			str += '1'
		else:
			str += '0'
	print(str)


for i in range(int(input())):
	(x, y) = map(int, input().split())
	n = list(map(int, input().split()))
	a = ''
	for i in n:
		if i % y == 0:
			a = a + '1'
		else:
			a = a + '0'
	print(a)


def steps():
	ans = ''
	for i in a:
		if i % k == 0:
			ans += '1'
		else:
			ans += '0'
	return ans
for _ in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	print(steps())


for _ in range(int(input())):
	res = []
	(path, steplength) = map(int, input().split())
	pathlist = list(map(int, input().split()))
	for i in pathlist:
		if i % steplength != 0:
			res.append('0')
		else:
			res.append('1')
	resstr = ''.join(res)
	print(resstr)


s = int(input())
for i in range(s):
	(a, b) = map(int, input().split(' '))
	n = list(map(int, input().split(' ')))
	ans = 0
	for j in range(a):
		if n[j] % b == 0:
			print(1, end='')
		else:
			print(0, end='')
	print()


for i in range(int(input())):
	x = input().split()
	v = input().split()
	l = []
	ll = []
	for i in x:
		i = int(i)
		l.append(i)
	for i in v:
		i = int(i)
		ll.append(i)
	c = l[1]
	for i in ll:
		if i % c == 0:
			print(1, end='')
		else:
			print(0, end='')
	print()


for t in range(int(input())):
	(n, k) = [int(x) for x in input().rstrip().split()]
	d = [int(x) for x in input().rstrip().split()]
	for i in range(0, n):
		if d[i] % k == 0:
			print('1', end='')
		else:
			print('0', end='')
	print('\r')


for _ in range(int(input())):
	(N, K) = map(int, input().split())
	lst = list(map(int, input().split()))
	res = ['1' if i % K == 0 else '0' for i in lst]
	print(''.join(res))


for t in range(int(input())):
	(n, k) = map(int, input().split())
	numberlist = list(map(int, input().split()))
	result = ''
	for x in numberlist:
		if x % k == 0:
			result = result + '1'
		else:
			result = result + '0'
	print(result)


for i in range(int(input())):
	(n, x) = map(int, input().split())
	a = [int(x) for x in input().split()]
	s = []
	for i in range(len(a)):
		if a[i] % x == 0:
			s.append('1')
		else:
			s.append('0')
	print(''.join(s))


for i in range(int(input())):
	(a, b) = map(int, input().split())
	l = list(map(int, input().split()))
	l1 = list()
	u = ' '
	for j in range(0, a):
		if l[j] % b == 0:
			u = u + '1'
		else:
			u = u + '0'
	print(u)


T = int(input())
for k in range(T):
	arr1 = []
	(a, b) = map(int, input().split())
	arr = list(map(int, input().split()))
	for item in arr:
		if item % b == 0:
			arr1.append(1)
		else:
			arr1.append(0)
	print(*arr1, sep='')


for __ in range(int(input())):
	(n, k) = list(map(int, input().split()))
	arr = list(map(int, input().split()))
	l = []
	for i in arr:
		if i % k == 0:
			l.append('1')
		else:
			l.append('0')
	print(''.join(l))


for nt in range(int(input())):
	(nk, k) = map(int, input().split())
	(lk, r) = (list(map(int, input().split())), '')
	for i in range(nk):
		if lk[i] % k == 0:
			r += '1'
		else:
			r += '0'
	print(r)


T = int(input())
for _ in range(T):
	(n, k) = list(map(int, input().split()))
	li = list(map(int, input().split()))[:n]
	s = ''
	for i in range(n):
		if li[i] % k == 0:
			s = s + '1'
		else:
			s = s + '0'
	print(s)


for t in range(int(input())):
	(n, k) = map(int, input().split())
	a = [int(x) for x in input().split()]
	ans = ''
	for i in range(n):
		if a[i] % k == 0:
			ans += '1'
		else:
			ans += '0'
	print(ans)


T = int(input())
for i in range(T):
	(N, K) = map(int, input().split())
	D = list(map(int, input().split()))
	s = ''
	for j in D:
		if j % K == 0:
			s = s + '1'
		else:
			s = s + '0'
	print(s)


for i in range(int(input())):
	(a, b) = [int(x) for x in input().split()]
	arr = [int(x) for x in input().split()]
	for j in arr:
		if j % b == 0:
			print('1', end='')
		else:
			print('0', end='')
	print()


for _ in range(int(input())):
	(n, x) = map(int, input().split())
	d = list(map(int, input().split()))
	l = ['0'] * n
	for i in range(n):
		if d[i] % x == 0:
			l[i] = '1'
	print(''.join(l))


result = []
for _ in range(int(input())):
	(N, K) = map(int, input().split())
	distances = list(map(int, input().split()))
	for i in range(N):
		remainder = distances[i] % K
		if remainder == 0:
			x = 1
			result.append(x)
		else:
			y = 0
			result.append(y)
	print(*result, sep='')
	result.clear()
	distances.clear()


t = int(input())
for _ in range(t):
	[n, k] = list(map(int, input().split()))
	l1 = list(map(int, input().split()))
	l = []
	for i in l1:
		if i % k == 0:
			l.append('1')
		else:
			l.append('0')
	print(''.join(l))


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	d = list(map(int, input().split()))
	ans = ''
	for i in d:
		ans += str(int(i % k == 0))
	print(ans)


t = int(input())
for _ in range(t):
	(n, k) = map(int, input().split())
	distance = list(map(int, input().split()))
	ans = ''
	for i in range(n):
		if distance[i] % k == 0:
			ans += '1'
		else:
			ans += '0'
	print(ans)


for i in range(int(input())):
	(n, r) = list(map(int, input().split()))
	l = list(map(int, input().split()))
	x = ''
	for j in range(len(l)):
		if l[j] % r == 0:
			x += '1'
		else:
			x += '0'
	print(x)


for _ in range(int(input())):
	(n, k) = map(int, input().split())
	l = list(map(int, input().split()))
	a = []
	for i in l:
		if i % k == 0:
			a.append(1)
		else:
			a.append(0)
	print(*a, sep='')


for i in range(int(input())):
	(x, y) = map(int, input().split())
	li = list(map(int, input().split()))
	res = ''
	for i in range(x):
		if li[i] % y == 0:
			res = res + '1'
		else:
			res = res + '0'
	print(res)


t = int(input())
for i in range(t):
	(n, k) = map(int, input().split())
	arr = list(map(int, input().split()))
	lis = ''
	for z in range(len(arr)):
		if arr[z] % k == 0:
			lis += '1'
		elif arr[z] % k != 0:
			lis += '0'
	print(lis)