Problem:


Score : 500 points

Problem Statement

Alice and Brown loves games. Today, they will play the following game.

In this game, there are two piles initially consisting of X and Y stones, respectively.
Alice and Bob alternately perform the following operation, starting from Alice:

Take 2i stones from one of the piles. Then, throw away i of them, and put the remaining i in the other pile. Here, the integer i (1≤i) can be freely chosen as long as there is a sufficient number of stones in the pile.

The player who becomes unable to perform the operation, loses the game.

Given X and Y, determine the winner of the game, assuming that both players play optimally.

Constraints

0 ≤ X, Y ≤ 10^{18}

Input

Input is given from Standard Input in the following format:

X Y

Output

Print the winner: either Alice or Brown.

Sample Input 1

2 1

Sample Output 1

Brown

Alice can do nothing but taking two stones from the pile containing two stones. As a result, the piles consist of zero and two stones, respectively. Then, Brown will take the two stones, and the piles will consist of one and zero stones, respectively. Alice will be unable to perform the operation anymore, which means Brown's victory.

Sample Input 2

5 0

Sample Output 2

Alice

Sample Input 3

0 0

Sample Output 3

Brown

Sample Input 4

4 8

Sample Output 4

Alice



Sample input:
2 1


Sample output:
Brown

Submission status: Runtime Error

Solution code:
X, Y = map(int, input().split())

def rec(x, y) :
    flg = False
    for i in range(2, x + 1, 2) :
        flg = flg or not rec(x-i, y+i//2)
    for i in range(2, y + 1, 2) :
        flg = flg or not rec(x+i//2, y-i)
        
    return flg
    
if rec(X, Y) :
    print('Alice')
else :
    print('Brown')

Submission status: Runtime Error

Solution code:
a,b = map(int,input())
print("ABlriocwen"[not abs(a-b)>1 :: 2])

Submission status: Runtime Error

Solution code:
import sys
AB = [int(n) for n in input().split()]
# N = int(input())
# a = [int(input()) for _ in range(N)]
# S = str(input())
# L = len(S)
# T = str(input())
fin = [[0,0],[1,0],[0,1]]
Alice = True
memo = {}
def Alicewin(state,Alice):
    if(state in fin and Alice):
        return False
    elif(state in fin and not Alice):
        return True
    Ap = 2
    while(Ap<=state[0]):
        if Alicewin([state[0]-Ap,state[1]+Ap/2],not Alice):
            return True
        Ap+=2
    Bp = 2
    while(Bp<=state[1]):
        if Alicewin([state[0]+Bp/2,state[1]-Bp],not Alice):
            return True
        Bp+=2
    return False

print("Alice" if Alicewin(AB, True) else "Brown")

Submission status: Runtime Error

Solution code:
￥X,Y = map(int,input().split())

def judege(Z):
  ans = int(Z/2)
  re = Z%2
  # print(ans,re)
  if ans == 0:
    if re == 0:
      return "Brown"
    else:
      return "Alice"
  else:
    return judege(ans+re)

print(judege(X+Y))

Submission status: Runtime Error

Solution code:
x,y =map(int,input())
print("Brown" if abs(x-y)<=1 else "Alice")

Submission status: Runtime Error

Solution code:
from collections import deque
n,m = map(int,input().split())
info = [list(map(int,input().split())) for i in range(m)]

tree = [[] for i in range(n)]

for i in range(m):
  tree[info[i][0]-1].append([info[i][0]-1,info[i][1]-1,info[i][2],False])
flag= [False]
visited =[-float("inf")]*n
visited[0]=0
count = [0]


def bfs(here):
  q =deque()
  for i in tree[here]:
    q.append(i)
  while q and count[0] <=m*n:
    tmp = q.popleft()
    here =tmp[0]
    go = tmp[1]
    cost = tmp[2]
    if visited[here] + cost> visited[go]:
      visited[go] = cost +visited[here]
    for i in range(len(tree[go])):
      if not tree[go][i][3]: 
        q.appendleft(tree[go][i])
        tree[go][i][3]=True
        
      else:
        q.append(tree[go][i])
        if go == n-1:
          print("inf")
          exit()

    count[0] +=1

    
bfs(0)
print(visited[n-1])

Submission status: Runtime Error

Solution code:
import numpy

x,y = map(int, input().split())
z = np.array([x,y])
i = 1

if z[z.argmax()] == 0 or z[z.argmax()] == 1:
    i = 1
else:
    while True:
        amax, amin = z.argmax(), z.argmin()
        z[amin] += z[amax]//2
        z[amax] = 1 if z[amax]%2 else 0
        i+=1
        if (z[z.argmax()] == 0 or z[z.argmax()] == 1): 
            break

print("Brown" if i%2 else "Alice")

Submission status: Runtime Error

Solution code:
import numpy

x,y = map(int, input().split())
z = np.array([x,y])
i = 1

if z[z.argmax()] == 0 or z[z.argmax()] == 1:
    i = 1
else:
    while True:
        amax, amin = z.argmax(), z.argmin()
        z[amin] += z[amax]//2
        z[amax] = 1 if z[amax]%2 else 0
        i+=1
        if (z[z.argmax()] == 0 or z[z.argmax()] == 1): 
            break

print("Brown" if i%2 else "Alice")

Submission status: Runtime Error

Solution code:
X,Y=map(int,input())
if max(X,Y)-min(X,Y) > 1:
  print("Alice")
else:
  print("Brown")

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-

A, B  = map(int, raw_input().split())

if abs(A - B) < 2
	print("Brown")
else:
	print("Alice")

Submission status: Runtime Error

Solution code:
a,b=map(int,raw_input().split());print(abs(a-b)<2and'Brown'or'Alice')

Submission status: Runtime Error

Solution code:
a,b=map(int,input().split())

if abs(a-b)<2:
    print("Brown")
elif:
    print("Alice")