Time Machine
Source: codechef
Difficulty: 181

Time Machine
Chef is currently in the year$X$in Chefland. He has a time machine that allows him to travel at most$25$years into the future, but he can use it only once.
Determine whether Chef can reach the year$2050$with a single use of the time machine.
Input Format
A single integer$X$, representing current year in Chefland.
Output Format
Print
YES
if Chef can reach the year 2050 , otherwise print
NO
.
You may print each character of the string in uppercase or lowercase (for example, the strings
YES
,
yEs
,
yes
, and
yeS
will all be treated as identical).
Constraints$2000 \leq X \leq 2050$Sample 1:
Explanation:
Chef is already in the year$2050$, so there's no need to use the time machine.
Sample 2:
Input
Output
2000
No
Explanation:
Chef can use the time machine to travel up to$25$years into the future, but that won't take him beyond the year$2025$.
Sample 3:
Input
Output
2030
Yes
Explanation:
By using the time machine, Chef can travel$20$years into the future, reaching the year$2050$.
Sample 4:
Input
Output
2025
Yes
Explanation:
By using the time machine, Chef can travel$25$years into the future, reaching the year$2050$.

Sample Input:
2050

Sample Output:
Yes

C++ solution:
#include <bits/stdc++.h>
using namespace std;

int main() {
    // your code goes here
    int a;
    cin>>a;
    int b=a+25;
    
    if(b>=2050)
    {
        cout<<"Yes";
    }
    else{
        cout<<"NO";
    }
}

Go solution:
package main

import "fmt"

func x1yZ9abC(qw3rty12 int) {
    if qw3rty12+25 >= 2050 {
        fmt.Println("YES")
    } else {
        fmt.Println("NO")
    }
}

func main() {
    var h7gF21x int
    fmt.Scan(&h7gF21x)
    x1yZ9abC(h7gF21x)
}

Java solution:
import java.util.*;
import java.lang.*;
import java.io.*;

class Codechef
{
    public static void main(String[] args) throws java.lang.Exception
    {
        // your code goes here
        Scanner s = new Scanner(System.in);
        int n = s.nextInt();
        int count = 0;
        for (int i = 0; i < 26; i++)
        {
            if (n + i == 2050)
            {
                count = 1;
            }
        }
        if (count == 1)
        {
            System.out.println("yes");
        }
        else
        {
            System.out.println("no");
        }
    }
}

JavaScript solution:
process.stdin.resume();
process.stdin.setEncoding('utf8');

let inputData = '';

process.stdin.on('data', function (input) {
    inputData += input;
});

process.stdin.on('end', function () {
    const X = parseInt(inputData.trim());
    if (2050 - X <= 25) {
        console.log('YES');
    } else {
        console.log('NO');
    }
});

Python solution:
# cook your dish here
X = int(input())
if 2050 - X <= 25:
    print("YES")
else:
    print("NO")

Ruby solution:
x = gets.to_i

if x >= 2050 - 25 || x == 2050
  puts "YES"
else
  puts "NO"
end