#P15893. [TOPC 2025] Take It or Double It

[TOPC 2025] Take It or Double It

Description

You are the host of a street experiment show called TOPC (Take Or Pass Challenge). In the show, you approach people one by one and offer them some money. Each person can either:

  • Take it: Accept the money and end the game.
  • Double it: Reject the money and ask you to double the amount and offer it to the next person.

The game starts with xx dollars. You go down the street and meet a random person. You would like to predict in advance what each of them will say — either “take” or “double”.

You have a limited budget of dd dollars in your pocket. If, at any point, a person’s decision could result in an amount strictly greater than your available funds dd, you must force the person to say “take it”, regardless of what they wanted to say. Taiwanese people are very kind-hearted, so whenever they have a choice, they would always say “double it” and pass the opportunity to others — unless they are forced to take the money.

Your task is to simulate the game and determine if the person you meet will take the money or double it and give it to the next person.

Input Format

The input contains two integers xx and dd.

Output Format

Output a string “take it” or “double it”.

123 456
double it
345 678
take it
789 101112
double it

Hint

Technical Specification

  • 1xd1091 \le x \le d \le 10^9