Read problems statements in [Mandarin Chinese], [Russian], [Vietnamese] and [Bengali] as well. 

You have three shoes of the same size lying around. Each shoe is either a left shoe (represented using 0) or a right shoe (represented using 1). Given A, B, C, representing the information for each shoe, find out whether you can go out now, wearing one left shoe and one right shoe.

------ Input Format ------ 

- The first line contains an integer T, the number of test cases. Then the test cases follow.
- Each test case contains a single line of input, three integers A, B, C.

------ Output Format ------ 

For each test case, output in a single line the answer: 1 if it's possible to go out with a pair of shoes and 0 if not.

------ Constraints ------ 

$1 ≤ T ≤ 8$
$0 ≤ A, B, C ≤ 1$

----- Sample Input 1 ------ 
3
0 0 0
0 1 1
1 0 1
----- Sample Output 1 ------ 
0
1
1
----- explanation 1 ------ 
Test Case $1$: Since there's no right shoe, it's not possible to go out with a pair of shoes.

Test Case $2$: It's possible to go out with a pair of shoes wearing the first and last shoes.

Test Case $3$: It's possible to go out with a pair of shoes wearing the first and second shoes.

Source: codechef | Difficulty: EASY
Tags: Complete search

Ad-hoc


Solutions:
t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	if (a == 0 or b == 0 or c == 0) and (a == 1 or b == 1 or c == 1):
		print(1)
	else:
		print(0)


t = int(input())
for i in range(t):
	(m, n, o) = map(int, input().split())
	if m == n and n == o and (o == m):
		print('0')
	else:
		print('1')


t = int(input())
for i in range(t):
	x = list(map(int, input().split()))
	if 0 in x and 1 in x:
		print(1)
	else:
		print(0)


n = int(input())
for _ in range(n):
	(A, B, C) = list(map(int, input().split()))
	if A == B and B == C and (C == A):
		print(0)
	else:
		print(1)


T = int(input())
for _ in range(T):
	(A, B, C) = map(int, input().split())
	if A == B == C:
		print(0)
	elif A != B or B != C or A != C:
		print(1)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a == b and b == c:
		print('0')
	else:
		print('1')


T = int(input())
for _ in range(T):
	lst = [int(i) for i in input().split()][0:3]
	countZero = lst.count(0)
	countOne = lst.count(1)
	if countZero >= 1 and countOne >= 1:
		print(1)
	else:
		print(0)


for y in range(int(input())):
	(x, y, z) = map(int, input().split())
	if x == y and y == z:
		print('0')
	else:
		print('1')


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	if a == b == c:
		print(0)
	else:
		print(1)


T = int(input())
for i in range(T):
	shoes = list(map(int, input().split()))
	if 1 in shoes and 0 in shoes:
		print(1)
	else:
		print(0)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	lst = [a, b, c]
	x = lst.count(0)
	y = lst.count(1)
	if x >= 1 and y >= 1:
		print(1)
	else:
		print(0)


n = int(input())
for i in range(n):
	m = list(map(int, input().split()))
	if m.count(0) >= 1 and m.count(1) >= 1:
		print('1')
	else:
		print('0')


T = int(input())
for _ in range(T):
	(A, B, C) = map(int, input().split())
	if A == B == C:
		print(0)
	else:
		print(1)


for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	l = [a, b, c]
	r = l.count(1)
	c = l.count(0)
	if r >= 1 and c >= 1:
		print('1')
	else:
		print('0')


for i in range(int(input())):
	k = list(map(int, input().split()))
	print(1) if len(set(k)) == 2 else print(0)


t = int(input())
for i in range(t):
	l = list(map(int, input().split()))
	c0 = l.count(0)
	c1 = l.count(1)
	if c0 != 0 and c1 != 0:
		print(1)
	else:
		print(0)


T = int(input())
for i in range(T):
	n1 = list(map(int, input().split()))
	n3 = 0
	n2 = 0
	for i in n1:
		if i == 0:
			n3 += 1
		else:
			n2 += 1
	if n3 >= 1 and n2 >= 1:
		print(1)
	else:
		print(0)


for _ in range(int(input())):
	a = list(map(int, input().split()))
	if 0 in a and 1 in a:
		print('1')
	else:
		print('0')


test_cases = int(input())
for i in range(0, test_cases):
	(A, B, C) = [int(shoe) for shoe in input().split()]
	if A + B + C == 1 or A + B + C == 2:
		print('1')
	else:
		print('0')


t = int(input())
while t:
	t -= 1
	(a, b, c) = map(int, input().split())
	if a == b and a == c and (b == a) and (b == c) and (c == a) and (c == b):
		print('0')
	else:
		print('1')


q = int(input(''))
for i in range(q):
	(a, b, c) = map(int, input().split())
	d = a + b + c
	if d >= 1 and d <= 2:
		print('1')
	else:
		print(0)


for i in range(int(input())):
	li = list(map(int, input().split()))
	if li.count(0) > 0 and li.count(1) > 0:
		print('1')
	else:
		print('0')


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	if a == b == c == 0:
		print('0')
	elif a != b or a != c or b != c:
		print('1')
	else:
		print('0')


t = int(input())
for i in range(t):
	(A, B, C) = map(int, input().split())
	l = 0
	r = 0
	if A == B and B == C:
		print(0)
	else:
		print(1)


t = int(input())
for i in range(t):
	(n, k, x) = map(int, input().split())
	if n == 0 and k == 1 or (k == 0 and n == 1) or (k == 0 and x == 1) or (k == 1 and x == 0) or (n == 1 and x == 0) or (n == 0 and x == 1):
		print(1)
	else:
		print(0)


T = int(input())
for i in range(T):
	(a, b, c) = map(int, input().split())
	if a == 0 and b == 0 and (c == 0):
		print('0')
	elif a == 1 and b == 1 and (c == 1):
		print('0')
	else:
		print('1')


T = int(input())
for _ in range(T):
	shoes = list(map(int, input().split()))
	if shoes.count(0) >= 1 and shoes.count(1) >= 1:
		print(1)
	else:
		print(0)


for _ in range(int(input())):
	l = list(map(int, input().split()))
	if l.count(1) > 0 and l.count(0) > 0:
		print(1)
	else:
		print(0)


for _ in range(int(input())):
	a = input().split()
	a = set(a)
	if len(a) == 2:
		print('1')
	else:
		print('0')


for i in range(int(input())):
	shoes = list(map(int, input().split()))
	unique = []
	unique = set(sorted(shoes))
	print(1) if len(unique) == 2 else print(0)


for i in range(int(input())):
	(A, B, C) = map(int, input().split())
	if A + B + C > 0 and A + B + C < 3:
		print('1')
	else:
		print('0')


number_of_case = int(input())
for _ in range(number_of_case):
	(x, y, z) = map(int, input().split())
	list1 = [x, y, z]
	rightshoe = 0
	leftshoe = 0
	for count in list1:
		if count == 0:
			leftshoe = leftshoe + 1
		elif count == 1:
			rightshoe = rightshoe + 1
	if leftshoe >= 1 and rightshoe >= 1:
		print('1')
	else:
		print('0')


for i in range(int(input())):
	(x, y, z) = map(int, input().split())
	if 1 <= x + y + z <= 2:
		print(1)
	else:
		print(0)


t = int(input())
for i in range(0, t):
	l = list(map(int, input().split(' ')))
	c = 0
	d = 0
	for i in l:
		if i == 0:
			c = c + 1
		else:
			d = d + 1
	if c > 0 and d > 0:
		print('1')
	else:
		print('0')


tc = int(input())
for test in range(tc):
	(a, b, c) = map(int, input().split(' '))
	output = 1
	if a == 0 and b == 0 and (c == 0):
		output = 0
	if a == 1 and b == 1 and (c == 1):
		output = 0
	print(output)


T = int(input())
for t in range(T):
	(A, B, C) = [int(x) for x in input().split()]
	if A == B == C:
		print('0')
	else:
		print('1')