Bunty and Dolly are playing a game, described as follows.
Game Description: -
There are two boxes having A and B number of chocolates respectively. Both can eat L (L ≥ 1) chocolates from any one box or L chocolates from both the boxes in one move. They play the game alternatively and the last one to eat the chocolate will be the winner.
As Bunty wants to impress Dolly, he wants to make Dolly the winner. You have to help Bunty in deciding who should play first. Assume that both the players play optimally.
Example 1:
Input:
A = 1 and B = 2
Output: Bunty
Explanation:
If Bunty starts first, all the next possible state
(0,2), (1,1), (1,0) are wining state for Dolly
Example 2:
Input:
A = 1 and B = 3
Output: Dolly
Your Task:  
You don't need to read input or print anything. Your task is to complete the function game() which takes the integer A and B as input parameters and returns false if Bunty should play first else returns true.
Expected Time Complexity: O(1)
Expected Auxiliary Space: O(1)
Constraints:
0 ≤ a, b ≤ 10^{6}

Source: geeksforgeeks | Difficulty: MEDIUM
Tags: Game theory

Starter code: #User function Template for python3





class Solution:

    def game (self, A, B):

        # code here

        pass



Solutions:
class Solution:

	def game(self, A, B):
		p = 1 / 2
		diff = abs(B - A)
		goldenratio = (1 + 5 ** p) / 2
		temp = diff * goldenratio
		return min(A, B) != int(temp)


class Solution:

	def game(self, a, b):
		phi = 1.618033988749895
		if a > b:
			s = a
			a = b
			b = s
		x = phi * (b - a)
		y = int(x) + (b - a)
		return a != int(x) or b != y


import math

class Solution:

	def game(self, A, B):
		s = min(A, B)
		t = max(A, B)
		n = math.ceil(s / 1.618033989)
		a = int(1.618033989 * n)
		if s == a and a + n == t:
			return False
		return True


import math

class Solution:

	def game(self, a, b):
		if a > b:
			(a, b) = (b, a)
		k = b - a
		d = 1 + math.sqrt(5)
		d /= 2
		d *= k
		temp = int(d)
		if temp == a:
			return False
		return True


import math

class Solution:

	def game(self, A, B):
		phi = (1 + math.sqrt(5)) / 2
		diffK = abs(A - B)
		return min(A, B) != int(phi * diffK)


class Solution:

	def game(self, A, B):
		if A > B:
			(A, B) = (B, A)
		k = B - A
		d = 1 + 2.23606
		d = d / 2
		d = d * k
		c = int(d)
		if A == c:
			return False
		return True


import math

class Solution:

	def game(self, A, B):
		if A > B:
			(A, B) = (B, A)
		k = B - A
		d = 1 + math.sqrt(5)
		d = d / 2
		d = d * k
		temp = int(d)
		if temp == A:
			return False
		else:
			return True


class Solution:

	def game(self, a, b):
		if a > b:
			(a, b) = (b, a)
		k = b - a
		d = (1 + 5 ** 0.5) / 2
		d *= k
		temp = int(d)
		if temp == a:
			return False
		return True


import math

class Solution:

	def game(self, A, B):
		goldenRatio = (1 + math.sqrt(5)) / 2
		num = abs(B - A) * goldenRatio
		return min(A, B) != int(num)


class Solution:

	def game(self, A, B):
		if A > B:
			(A, B) = (B, A)
		k = B - A
		d = 1 + 2.23606
		d /= 2
		d *= k
		c = int(d)
		if A == c:
			return 0
		return 1


class Solution:

	def game(self, A, B):
		golden_ratio = (1 + 5 ** 0.5) / 2
		k = abs(A - B)
		return max(A, B) != int(k * golden_ratio * golden_ratio)


import math

class Solution:

	def game(self, a, b):
		if a > b:
			t = a
			a = b
			b = t
		k = b - a
		d = 1 + math.sqrt(5)
		d = d / 2
		d = d * k
		c = int(d)
		return False if a == c else True


from math import sqrt, floor

class Solution:

	def game(self, a, b):
		if a == 0 and b == 0:
			return False
		n = min(a, b)
		m = max(a, b)
		k = m - n
		return not (n == int(floor(k * 1.618)) and m == int(floor(k * 1.618 * 1.618)))


class Solution:

	def game(self, A, B):
		phi = 1.618033
		x = int(phi * (max(A, B) - min(A, B)))
		y = int(x + (max(A, B) - min(A, B)))
		return A != x or B != y


class Solution:

	def game(self, A, B):
		if A + B == 3 or (A + B == 8 and abs(A - B) == 2) or (A + B == 11 and abs(A - B) == 3) or (A + B == 0) or (A + B == 45 and abs(A - B) == 11):
			return False
		else:
			return True


from math import sqrt

class Solution:

	def game(self, A, B):
		if A > B:
			(A, B) = (B, A)
		c = B - A
		d = 1 + sqrt(5)
		d = d / 2
		d = d * c
		t = int(d)
		if t == A:
			return False
		else:
			return True


import math

class Solution:

	def game(self, A, B):
		phi = (1 + math.sqrt(5)) / 2
		k = math.ceil(A / phi)
		m = math.floor(k * phi ** 2)
		if B == m:
			return False
		else:
			return True


import math

class Solution:

	def game(self, A, B):
		if A > B:
			temp = A
			A = B
			B = temp
		k = B - A
		gold_ratio = (1 + math.sqrt(5)) / 2
		if A == int(gold_ratio * k):
			return 0
		else:
			return 1


class Solution:

	def game(self, A, B):
		if A > B:
			(A, B) = (B, A)
		k = B - A
		d = 1 + 5 ** 0.5
		d /= 2
		d *= k
		t = int(d)
		if t == A:
			return False
		return True


class Solution:
	GOLDEN_NUMBER = (1 + 5 ** (1 / 2)) / 2

	def game(self, A, B):
		Bunty = False
		Dolly = True
		(A, B) = (min(A, B), max(A, B))
		n = B - A
		if int(n * self.GOLDEN_NUMBER) == A and int(n * self.GOLDEN_NUMBER * self.GOLDEN_NUMBER) == B:
			return Bunty
		else:
			return Dolly
if __name__ == '__main__':
	ob = Solution()
	t = int(input())
	for _ in range(t):
		(N, K) = map(int, input().split())
		ans = ob.game(N, K)
		if ans:
			print('Dolly')
		else:
			print('Bunty')


import math

class Solution:

	def game(self, a, b):
		if a > b:
			(a, b) = (b, a)
		k = b - a
		d = 1 + math.sqrt(5)
		d /= 2
		d *= k
		temp = int(d)
		if temp == a:
			return 0
		else:
			return 1


class Solution:

	def game(self, A, B):
		if A == B:
			if A == 0:
				return False
			else:
				return True
		if A > B:
			n = A - B
		elif B > A:
			n = B - A
		gr = 1.618
		na = int(n * gr)
		nb = int(n * gr * gr)
		s = set()
		s.add(na)
		s.add(nb)
		if A in s and B in s:
			return False
		else:
			return True
if __name__ == '__main__':
	ob = Solution()
	t = int(input())
	for _ in range(t):
		(N, K) = map(int, input().split())
		ans = ob.game(N, K)
		if ans:
			print('Dolly')
		else:
			print('Bunty')


import math

class Solution:

	def game(self, A, B):
		if A == 0 and B == 0:
			return False
		elif A == 0 or B == 0 or A == B:
			return True
		else:
			(a, b, i) = (1, 2, 1)
			while a <= A:
				if a == A and b == B:
					return False
				i += 1
				a = math.floor(1.61803398875 * i)
				b = a + i
		return True


class Solution:

	def game(self, A, B):
		if A > B:
			(A, B) = (B, A)
		k = B - A
		import math
		d = 1 + math.sqrt(5)
		d = d / 2
		d = d * k
		temp = int(d)
		if temp == A:
			return False
		return True
if __name__ == '__main__':
	ob = Solution()
	t = int(input())
	for _ in range(t):
		(N, K) = map(int, input().split())
		ans = ob.game(N, K)
		if ans:
			print('Dolly')
		else:
			print('Bunty')


from math import sqrt, floor

class Solution:

	def game(self, A, B):
		if B < A:
			(A, B) = (B, A)
		d = abs(B - A)
		gr = (1 + sqrt(5)) / 2
		CB = floor(d * gr ** 2)
		if CB == B:
			return False
		else:
			return True