Algorithm


A. Bus Game
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

After Fox Ciel won an onsite round of a programming contest, she took a bus to return to her castle. The fee of the bus was 220 yen. She met Rabbit Hanako in the bus. They decided to play the following game because they got bored in the bus.

  • Initially, there is a pile that contains x 100-yen coins and y 10-yen coins.
  • They take turns alternatively. Ciel takes the first turn.
  • In each turn, they must take exactly 220 yen from the pile. In Ciel's turn, if there are multiple ways to take 220 yen, she will choose the way that contains the maximal number of 100-yen coins. In Hanako's turn, if there are multiple ways to take 220 yen, she will choose the way that contains the maximal number of 10-yen coins.
  • If Ciel or Hanako can't take exactly 220 yen from the pile, she loses.

 

Determine the winner of the game.

Input

The first line contains two integers x (0 ≤ x ≤ 106) and y (0 ≤ y ≤ 106), separated by a single space.

Output

If Ciel wins, print "Ciel". Otherwise, print "Hanako".

Examples
input
Copy
2 2
output
Copy
Ciel
input
Copy
3 22
output
Copy
Hanako
Note

In the first turn (Ciel's turn), she will choose 2 100-yen coins and 2 10-yen coins. In the second turn (Hanako's turn), she will choose 1 100-yen coin and 12 10-yen coins. In the third turn (Ciel's turn), she can't pay exactly 220 yen, so Ciel will lose.

 

Code Examples

#1 Code Example with C++ Programming

Code - C++ Programming

#include <cstdio>

int main(){

    long hundreds(0), tens(0); scanf("%ld %ld", &hundreds, &tens);
    bool loser(0);

    while(true){

        //Ciel
        if(hundreds >= 2 && tens >= 2){hundreds -= 2; tens -= 2;}
        else if(hundreds >= 1 && tens >= 12){hundreds -= 1; tens -= 12;}
        else if(tens >= 22){tens -= 22;}
        else{loser = 1; break;}

        //Hanako
        if(tens >= 22){tens -= 22;}
        else if(tens >= 12 && hundreds >= 1){hundreds -= 1; tens -= 12;}
        else if(tens >= 2 && hundreds >= 2){hundreds -= 2; tens -= 2;}
        else{loser = 0; break;}
    }

    loser ? puts("Hanako") : puts("Ciel");

    return 0;
}
Copy The Code & Try With Live Editor

Input

x
+
cmd
2 2

Output

x
+
cmd
Ciel
Advertisements

Demonstration


Codeforces Solution-A. Bus Game-Solution in C, C++, Java, Python

Previous
Codeforces solution 1080-B-B. Margarite and the best present codeforces solution
Next
CodeChef solution DETSCORE - Determine the Score CodeChef solution C,C+