#K85792. Happy Number Checker

    ID: 36720 Type: Default 1000ms 256MiB

Happy Number Checker

Happy Number Checker

Problem Statement

A number is considered happy if the following process eventually reaches 1: starting with any positive integer \( n \), replace the number by the sum of the squares of its digits in base-10. That is, perform the transformation $$ n \to \sum_{i=1}^{k} d_i^2, $$ where \( d_i \) represents the \( i \)th digit of \( n \). If this process ends in 1, then \( n \) is a happy number; otherwise, it eventually loops endlessly in a cycle that does not include 1, making \( n \) an unhappy number.

Your task is to determine whether a given integer \( n \) is happy. Note that by definition, if \( n=0 \), it is not considered a happy number.

inputFormat

The input consists of a single integer ( n ) read from standard input.

outputFormat

Output True if ( n ) is a happy number, and False otherwise. The output should be printed to standard output.## sample

19
True