Problem:
﻿Score: 100 points

Problem Statement

In 2020, AtCoder Inc. with an annual sales of more than one billion yen (the currency of Japan) has started a business in programming education.

One day, there was an exam where a one-year-old child must write a program that prints Hello World, and a two-year-old child must write a program that receives integers A, B and prints A+B.

Takahashi, who is taking this exam, suddenly forgets his age.

He decides to write a program that first receives his age N (1 or 2) as input, then prints Hello World if N=1, and additionally receives integers A, B and prints A+B if N=2.

Write this program for him.

Constraints

N is 1 or 2.

A is an integer between 1 and 9 (inclusive).

B is an integer between 1 and 9 (inclusive).

Input

Input is given from Standard Input in one of the following formats:

1

2
A
B

Output

If N=1, print Hello World; if N=2, print A+B.

Sample Input 1

1

Sample Output 1

Hello World

As N=1, Takahashi is one year old. Thus, we should print Hello World.

Sample Input 2

2
3
5

Sample Output 2

8

As N=2, Takahashi is two years old. Thus, we should print A+B, which is 8 since A=3 and B=5.

Solution in Rust (1.15.1) (judge verdict: Accepted)

use std::io;
use std::collections::HashSet;

fn read_line() -> String {
    let mut line = String::new();

    io::stdin().read_line(&mut line)
        .expect("Failed to read line");
    return line;
}
fn to_i(s: &str) -> i64 {
    return s.trim().parse()
        .expect("Please type a number!");
}
fn check(nums: &Vec<i64>, i: i32, count: i32, data: &HashSet<i64>) -> i32 {
    if i+2==nums.len() as i32 {
        if data.len()==2 {
            return count;
        } else {
            return 9999999;
        }
    }
    if data.len() >=3 {
        return 9999999;
    }
    let x = nums[i as usize];
    let x2 = nums[(i+2) as usize];
    //println!("{} {} {} {} {}", i, x, x2, count, data.len());
    if x==x2 {
        let mut data1 = data.clone();
        data1.insert(x);
        if data.len()==2 {
            if data.contains(&x) {
                //println!("# {} {} ", i+1+2, nums.len());
                
                return check(nums, i+1, count, &data1);
            }else{
                return check(nums, i+1, count+2, &data1);
            }
        }else{
            /*if data.include?(x) {

            }else{

            }*/
            if i+1+2==nums.len() as i32 {
                    
                    
                        return count+2;
                    
            }
            return check(nums, i+1, count, &data1);
        }
        
    }

    if data.len()==2 {
        if data.contains(&x) || data.contains(&x2) { 
            if data.contains(&x) {
                let mut data3 = data.clone();
                data3.insert(x2);
                return check(nums, i+1, count+1, &data3);
            }else{
                let mut data2 = data.clone();
                data2.insert(x);
                return check(nums, i+1, count+1, &data2);
            }
        }else{
            return check(nums, i+1, count+2, &data);
        }
    }else{
        //nums[(i+2) as usize] = x;
        let mut data2 = data.clone();
        data2.insert(x);
        let a = check(nums, i+1, count+1, &data2);
        //println!("a {} {} ",a, data2.len());
        //nums[(i+0) as usize] = x2;
        let mut data3 = data.clone();
        data3.insert(x2);
        let b = check(nums, i+1, count+1, &data3);

        //println!("b {} {}", b, data3.len());
        if a>b {
            return b;
        }else {
            return a;
        }
    }
    
}
fn main() {
    let l = read_line();
    let n = to_i(&l);
    if n == 1 {
        print!("Hello World");
        return;
    } 
    
    let l1 = read_line();
    let a = to_i(&l1);
    let l2 = read_line();
    let b = to_i(&l2);

    let result = a+b;
    print!("{}", result);


}