#K73877. Taco Guessing Game

    ID: 34073 Type: Default 1000ms 256MiB

Taco Guessing Game

Taco Guessing Game

In this problem, you are asked to implement a number guessing game between two players. The game works as follows:

  • The first line of input contains a secret integer \(T\) (with \(1 \leq T \leq 100\)) chosen by Player A.
  • Each subsequent line contains a guess made by Player B.

For each guess, output a message according to the following rules:

  • If the input is not a valid integer, print: Invalid input. Please enter an integer.
  • If the integer is not in the range [1, 100], print: Your guess is out of the valid range. Please guess a number between 1 and 100.
  • If the guess is lower than \(T\), print: Too low!
  • If the guess is higher than \(T\), print: Too high!
  • If the guess is equal to \(T\), print: Correct! You guessed the number in X attempts. where X is the number of valid guesses (i.e. those that are integers in the range [1, 100]) made so far. The game then ends immediately.

Note: Only valid guesses are counted toward the attempt count.

inputFormat

The input is given via standard input (stdin). The first line contains the secret number \(T\). Each subsequent line contains a guess made by Player B.

outputFormat

Output the appropriate messages to standard output (stdout) as described in the problem statement. Each message should be printed on its own line.

## sample
50
50
Correct! You guessed the number in 1 attempts.

</p>