"I have only one rule, never submit partially correct code" -Barney Stinson

The religious act which Barney and his friends hold most sacred, XORING the natural numbers in the given range. This time Barney is a bit busy with picking up some girls, so he asked you to help him. He gave you two numbers $L$ and $R$, you have to find if XOR of all the numbers in range L to R (L,R both inclusive) is odd or even.

Warning!! Large Input-Output. Please use Fast IO.

------ Input: ------

The first line will contain $T$, number of testcases. 
Each testcase contains a single line of input, two integers $L, R$. 

------ Output: ------
For each testcase, in the new line print "Odd" if the XOR in the range is odd, else print "Even".

------ Constraints  ------
$1 ≤ T ≤ 10^{6}$
$1 ≤ L ≤  R ≤ 10$^{$18$}

----- Sample Input 1 ------ 
4
1 4
2 6
3 3
2 3
----- Sample Output 1 ------ 
Even
Even
Odd
Odd
----- explanation 1 ------ 
Test case -1 -> XOR (1,2,3,4) =4

Test case -2 -> XOR (2,3,4,5,6) =6

Test case -3 -> XOR (3) =3

Test case -4 -> XOR (2,3) =1

Difficulty: EASY
Tags: Bit manipulation

Mathematics
Skill types: Bit manipulation

Starter code:

Solutions:
T = int(input())
for _ in range(0, T):
	(l, r) = map(int, input().split())
	if not l & 1 and (not r & 1):
		n = (r - l) // 2
	else:
		n = (r - l) // 2 + 1
	if n & 1:
		print('Odd')
	else:
		print('Even')


def fun(r):
	if r % 2 == 0:
		return 'Even'
	else:
		return 'Odd'
for _ in range(int(input())):
	(l, r) = map(int, input().split())
	if l == r or (r - l) % 4 == 0:
		print(fun(r))
	elif (r - l) % 4 == 3:
		print('Even')
	elif (r - l) % 4 == 2:
		string = fun(r)
		if string == 'Even':
			print('Odd')
		else:
			print('Even')
	else:
		print('Odd')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	a = a // 2
	b = (b + 1) // 2
	if (a - b) % 2:
		print('Odd')
	else:
		print('Even')


for i in range(int(input())):
	(l, r) = map(int, input().split())
	n = r - l + 1
	if l & 1:
		e = n // 2
		o = n - e
	else:
		o = n // 2
		e = n - o
	even = 1
	if o == e:
		if n // 2 & 1:
			even = 0
	elif n // 2 & 1:
		if l % 2 == 0:
			even = 0
	elif l & 1:
		even = 0
	if even:
		print('Even')
	else:
		print('Odd')


t = int(input())
for t in range(t):
	(l, r) = [int(i) for i in input().split()]
	nums = r - l + 1
	odd = nums // 2
	if nums % 2 == 1 and l % 2 == 1:
		odd += 1
	if odd % 2 == 1:
		print('Odd')
	else:
		print('Even')


import math
for _ in range(int(input())):
	(l, r) = map(int, input().split(' '))
	n = r - l + 1
	if n % 2 == 0:
		if n % 4 == 0:
			print('Even')
		else:
			print('Odd')
	elif l & 1:
		if (n - 1) % 4 == 0:
			print('Odd')
		else:
			print('Even')
	elif (n - 1) % 4 == 0:
		print('Even')
	else:
		print('Odd')


t = input()
for c in range(0, int(t)):
	(l, r) = input().split()
	l = int(l)
	r = int(r)
	total = r - l + 1
	(even, odd) = (0, 0)
	if total == 1:
		if r % 2 == 0:
			odd = 1
		else:
			odd = 0
	elif total == 2:
		(even, odd) = (1, 1)
	elif total % 2 == 0:
		(even, odd) = (total // 2, total // 2)
	elif total % 2 != 0 and l % 2 == 0 and (r % 2 == 0):
		(even, odd) = (total // 2 + 1, total // 2)
	elif total % 2 != 0 and (l % 2 != 0 or r % 2 != 0):
		(even, odd) = (total // 2, total // 2 + 1)
	if odd % 2 == 0:
		print('Even')
	else:
		print('Odd')


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	total = r - l + 1
	(even, odd) = (0, 0)
	if total == 1:
		if r % 2 == 0:
			odd = 1
		else:
			odd = 0
	elif total == 2:
		(even, odd) = (1, 1)
	elif total % 2 == 0:
		(even, odd) = (total // 2, total // 2)
	elif total % 2 != 0 and l % 2 == 0 and (r % 2 == 0):
		(even, odd) = (total // 2 + 1, total // 2)
	elif total % 2 != 0 and (l % 2 != 0 or r % 2 != 0):
		(even, odd) = (total // 2, total // 2 + 1)
	if odd % 2 == 0:
		print('Even')
	else:
		print('Odd')


t = int(input())
for _ in range(t):
	(l, r) = [int(x) for x in input().split()]
	if l % 2 == 0:
		if r % 2 == 1:
			mid = (r - l + 1) // 2
			if mid % 2 == 0:
				print('Even')
			else:
				print('Odd')
		else:
			mid = (r - l) // 2
			if mid % 2 == 0:
				print('Even')
			else:
				print('Odd')
	elif r % 2 == 1:
		mid = (r - l) // 2
		if mid % 2 == 0:
			print('Odd')
		else:
			print('Even')
	else:
		mid = (r - l + 1) // 2
		if mid % 2 == 0:
			print('Even')
		else:
			print('Odd')


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	cnt = 0
	if l % 2 == 0 and r % 2 == 0:
		cnt += (r - l) // 2
	else:
		cnt += (r - l) // 2 + 1
	if cnt % 2 == 0:
		print('Even')
	else:
		print('Odd')


T = int(input())
for i in range(0, T):
	(a, b) = input().split()
	a = int(a)
	b = int(b)
	if a % 2 == 1:
		a -= 1
	bb = (b - a) % 4
	if bb == 0 or bb == 3:
		print('Even')
	else:
		print('Odd')


t = int(input())
for _ in range(t):
	(l, r) = map(int, input().split())
	diff = r - l
	oddn = diff // 2 + 1
	if l % 2 == 0 and r % 2 == 0:
		oddn -= 1
	if oddn & 1:
		print('Odd')
	else:
		print('Even')


tests = int(input())
for i in range(tests):
	(l, r) = map(int, input().split())
	diff = r - l
	odd_nums = diff // 2 + 1
	if l % 2 == 0 and r % 2 == 0:
		odd_nums -= 1
	if odd_nums & 1:
		print('Odd')
	else:
		print('Even')


for _ in range(int(input())):
	(l, r) = map(int, input().split())
	count = r - l + 1
	if count % 2 == 1:
		if l % 2 == 0:
			if count // 2 % 2 == 0:
				print('Even')
			else:
				print('Odd')
		elif (count // 2 + 1) % 2 == 0:
			print('Even')
		else:
			print('Odd')
	elif count // 2 % 2 == 0:
		print('Even')
	else:
		print('Odd')


for i in range(int(input())):
	(a, b) = map(int, input().split())
	if a % 2 == 0 and b % 2 == 0:
		o = (b - a) // 2
	else:
		o = (b - a) // 2 + 1
	if o % 2 == 1:
		print('Odd')
	else:
		print('Even')


def xor(x):
	if x % 4 == 0:
		return x
	elif x % 4 == 1:
		return 1
	elif x % 4 == 2:
		return x + 1
	return 0
t = int(input())
for _ in range(t):
	(l, r) = map(int, input().split())
	print('Even') if (xor(r) ^ xor(l - 1)) % 2 == 0 else print('Odd')


t = int(input())
for i in range(t):
	(l, r) = [int(x) for x in input().split()]
	if ((r - l) // 2 + (l + 1) % 2 * ((r + 1) % 2)) % 2:
		print('Even')
	else:
		print('Odd')


t = int(input())
for i in range(t):
	(l, r) = [int(x) for x in input().split()]
	if l % 2 == 0 and r % 2 == 0:
		k = (r - l) // 2
		if k % 2:
			print('Odd')
		else:
			print('Even')
	if l % 2 == 0 and r % 2 == 1 or (l % 2 == 1 and r % 2 == 1) or (l % 2 == 1 and r % 2 == 0):
		k = (r - l) // 2
		if k % 2:
			print('Even')
		else:
			print('Odd')


T = int(input())
for t in range(1, T + 1):
	inp = input().split()
	L = int(inp[0])
	R = int(inp[1])
	n = R - L + 1
	num_odd = n // 2
	if L % 2 == 1 and n % 2 == 1:
		num_odd += 1
	if num_odd % 2 == 1:
		print('Odd')
	else:
		print('Even')


def xor(n):
	l1 = [n, 1, n + 1, 0]
	return l1[n % 4]
for i in range(int(input())):
	(a, b) = map(int, input().split())
	if (xor(a - 1) ^ xor(b)) % 2 == 0:
		print('Even')
	else:
		print('Odd')


t = int(input())
for _ in range(t):
	(l, r) = map(int, input().split())
	n = r - l + 1
	if n % 2 == 0:
		if n // 2 % 2 == 1:
			print('Odd')
		elif n // 2 % 2 == 0:
			print('Even')
	elif n % 2 == 1:
		if n // 2 % 2 == 1:
			if l % 2 == 0:
				print('Odd')
			elif l % 2 == 1:
				print('Even')
		elif n // 2 % 2 == 0:
			if l % 2 == 0:
				print('Even')
			elif l % 2 == 1:
				print('Odd')


for _ in range(int(input())):
	(a, b) = map(int, input().split())
	count = 0
	if a & 1 and b & 1:
		oc = (a - b) // 2
	else:
		oc = (a - b) // 2 + 1
	if oc & 1:
		print('Even')
	else:
		print('Odd')


def findxor(n):
	if n % 4 == 0:
		return n
	elif n % 4 == 1:
		return 1
	elif n % 4 == 2:
		return n + 1
	else:
		return 0
t = int(input())
while t:
	(l, r) = map(int, input().split())
	f = findxor(l - 1) ^ findxor(r)
	if f % 2 == 0:
		print('Even')
	else:
		print('Odd')
	t = t - 1


def getL():
	return [int(i) for i in input().split(' ')]

def getInt():
	return int(input())

def solve():
	(a, b) = getL()
	if a & 1 and b & 1:
		oc = (a - b) // 2
	else:
		oc = (a - b) // 2 + 1
	if oc & 1:
		print('Even')
	else:
		print('Odd')
for _ in range(getInt()):
	solve()


for i in range(int(input())):
	(l, r) = [int(x) for x in input().split()]
	o = (r - l) // 2
	if r % 2 != 0 or l % 2 != 0:
		o += 1
	if o % 2 == 0:
		print('Even')
	else:
		print('Odd')


for _ in range(int(input())):
	sum = 0
	(a, b) = map(int, input().split())
	x = (b - a) // 2
	if a % 2 == 1 or b % 2 == 1:
		x = x + 1
	if x % 2 == 0:
		print('Even')
	else:
		print('Odd')


T = int(input())
for t in range(T):
	(l, r) = map(int, input().split())
	x = (r - l) // 2
	if r % 2 == 1 or l % 2 == 1:
		x += 1
	if x % 2 == 0:
		print('Even')
	else:
		print('Odd')


def xor(n):
	return [n, 1, n + 1, 0][n % 4]
for i in range(int(input())):
	(l, r) = list(map(int, input().split()))
	x = (xor(r) ^ xor(l - 1)) & 1
	print('Even' if x == 0 else 'Odd')


def check(a, b):
	count = 0
	if a % 2 == 0 and b % 2 == 0:
		count += (b - a) // 2
	elif a % 2 != 0 and b % 2 != 0:
		count += 2 + ((b - a) // 2 - 1)
	else:
		count += (b - a) // 2 + 1
	return count
for _ in range(int(input().strip())):
	(l, r) = map(int, input().strip().split())
	if l == r:
		if l % 2 == 0:
			print('Even')
		else:
			print('Odd')
	elif check(l, r) % 2 == 0:
		print('Even')
	else:
		print('Odd')


t = int(input())
for i in range(t):
	(L, R) = map(int, input().split())
	odd = 0
	if L % 2 == 0 and R % 2 == 0:
		odd = (R - L) // 2
	else:
		odd = (R - L) // 2 + 1
	if odd & 1:
		print('Odd')
	else:
		print('Even')


for t in range(int(input())):
	(l, r) = map(int, input().split())
	if l % 2 == 0 and r % 2 == 0:
		res = (r - l) // 2
	else:
		res = (r - l) // 2 + 1
	if res % 2 == 0:
		print('Even')
	else:
		print('Odd')


case = int(input())
for r in range(case):
	(l, r) = list(map(int, input().split(' ')))
	if l == r:
		print('Odd')
		continue
	diff = l - r
	if diff & 1:
		if diff // 2 & 1:
			print('Odd')
		else:
			print('Even')
	elif l & 1 != 1:
		if diff // 2 & 1:
			print('Odd')
		else:
			print('Even')
	elif diff // 2 & 1:
		print('Even')
	else:
		print('Odd')


T = int(input())
for i in range(T):
	(l, r) = [int(X) for X in input().split()]
	n_even = (r - l + 1) // 2
	if r % 2 == 0 and l % 2 == 0:
		n_even += 1
	n_odd = r - l + 1 - n_even
	r_even = n_even % 2
	r_odd = n_odd % 2
	if r_even == 0 and r_odd == 0:
		print('Even')
	elif r_even == 1 and r_odd == 1:
		print('Odd')
	elif r_even == 0 and r_odd == 1:
		print('Odd')
	else:
		print('Even')


from math import *
import sys

def input():
	return sys.stdin.readline().replace('\n', '').strip()
sys.setrecursionlimit(10 ** 9)
for _ in range(int(input())):
	(a, b) = list(map(int, input().split()))
	if a % 2 == 0 and b % 2 == 0:
		count = (b - a) // 2
	else:
		count = (b - a) // 2 + 1
	if count % 2 == 0:
		print('Even')
	else:
		print('Odd')


for i in range(int(input())):
	(l, r) = map(int, input().split())
	if l % 2 == 0 and r % 2 == 0:
		n = (r - l) // 2
		if n % 2 == 0:
			print('Even')
		else:
			print('Odd')
	else:
		n = (r - l) // 2 + 1
		if n % 2 == 0:
			print('Even')
		else:
			print('Odd')


t = int(input())
l_1 = [[0, 1], [2, 3], [0, 3], [1, 2]]
for i in range(t):
	(l, r) = map(lambda x: int(x) % 4, input().split())
	if l in l_1[0] and r in l_1[2] or (l in l_1[1] and r in l_1[3]):
		print('Even')
	elif l in l_1[0] and r in l_1[3] or (l in l_1[1] and r in l_1[2]):
		print('Odd')


for i in range(int(input())):
	(x, y) = map(int, input().split())
	if x % 2 == 0 and y % 2 == 0:
		odd = (y - x) // 2
	else:
		odd = (y - x) // 2 + 1
	if odd % 2 == 0:
		print('Even')
	else:
		print('Odd')


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(x, y) = [int(x) for x in input().split()]
	if x % 2 != 0:
		x -= 1
	if y % 2 != 0:
		y += 1
	n = (y - x) // 2
	if n % 2 == 0:
		print('Even')
	else:
		print('Odd')


t = int(input())
for _ in range(t):
	(l, r) = map(int, input().split())
	if l % 2 == 1:
		l -= 1
	if r % 2 == 1:
		r += 1
	c = int(r - l) // 2
	if c % 2 == 1:
		print('Odd')
	else:
		print('Even')


t = int(input())
while t:
	(l, r) = map(int, input().split())
	if l % 2 == 1:
		l -= 1
	if r % 2 == 1:
		r += 1
	c = int(r - l) // 2
	if c % 2 == 1:
		print('Odd')
	else:
		print('Even')
	t -= 1


def evaluate(low, high):
	numbers = high - low
	if numbers == 0:
		if low % 2 == 0:
			return 'Even'
		else:
			return 'Odd'
	if low == 1:
		remainder = (high - 1) % 4
	else:
		remainder = (high - low) % 4
	if low % 2 == 0:
		if remainder == 0 or remainder == 3:
			return 'Even'
		else:
			return 'Odd'
	elif high % 2 == 1:
		if remainder == 0 or remainder == 3:
			return 'Odd'
		else:
			return 'Even'
	elif remainder == 0 or remainder == 3:
		return 'Even'
	else:
		return 'Odd'
test_cases = int(input())
for i in range(test_cases):
	(low, high) = map(int, input().split())
	result = evaluate(low, high)
	print(result)


t = int(input())
for i in range(t):
	(a, b) = map(int, input().split())
	c = b - a
	if a % 2 == 0:
		if (c + 1) // 2 % 2 == 1:
			print('Odd')
		else:
			print('Even')
	elif (c // 2 + 1) % 2 == 1:
		print('Odd')
	else:
		print('Even')


num = int(input())
for i in range(num):
	count = 0
	(l, r) = map(int, input().split())
	print('Odd' if (r + r % 2 - l + l % 2) // 2 % 2 else 'Even')


n = input()
n = int(n)
for i in range(n):
	(l, r) = input().split(' ')
	l = int(l)
	r = int(r)
	f1 = l % 2
	f2 = r % 2
	if not f1 and (not f2):
		res = (r - l) // 2
	else:
		res = (r - l) // 2 + 1
	if res % 2:
		print('Odd')
	else:
		print('Even')


for i in range(int(input())):
	[l, r] = [int(i) for i in input().split()]
	print('Odd' if (r + r % 2 - l + l % 2) // 2 % 2 else 'Even')


try:
	for _ in range(int(input())):
		(L, R) = map(int, input().strip().split(' '))
		numOfOddsBeforeL = L - 1 >> 1 if L & 1 else L >> 1
		numOfOddsUptoR = (R >> 1) + 1 if R & 1 else R >> 1
		if numOfOddsUptoR - numOfOddsBeforeL & 1:
			print('Odd')
		else:
			print('Even')
except EOFError:
	pass