LCC '23 Contest 4 J4 - Help Me

View as PDF

Submit solution

Points: 7 (partial)
Time limit: 2.0s
Memory limit: 64M

Problem type

Shane is writing the CCC right now. He comes across this problem and he wants you to help him solve it (which is cheating of course).

Aaron and Baron play a game. There are A + B + C sticks in the backyard. A of them can only be picked up by Aaron and B of them can only be picked up by Baron. C of them can be picked up by either. Aaron and Baron take turns picking up sticks. In a turn, they can pick up anywhere from 1 to K sticks. Each turn they make, they must pick up a different number of sticks than the previous turn. Aaron goes first. The loser is whoever is unable to pick up a stick during their turn. Given Aaron and Baron play intelligently, who will win?

Shane needs help. He desperately needs to score 75/75 on CCC this year. Can you help?


1 \le A, B, C \le 10^9

2 \le K \le 10^9

Subtask 1 [20%]


Subtask 2 [80%]

No additional constraints.

Input Specification

The first and only line will contain integers A, B, C, K.

Output Specification

Output Aaron if Aaron wins and Baron if Baron wins.

Sample Input

4 3 2 5

Sample Output


Sample Explanation

Aaron takes two C sticks. Then Baron takes one B stick. Then Aaron takes one A stick. Baron takes two B sticks (note Baron cannot take one stick). Aaron takes three A sticks. Baron has no more moves. So Aaron wins.


There are no comments at the moment.