Christmas Cake
Source: codechef
Difficulty: 217

Christmas Cake
Chef plans to celebrate Christmas by baking a cake.
Christmas falls on the$25$-th of December.
Every day before Christmas, till the$24$-th of December, Chef will bake
exactly one
practice cake.
Today is the$X$-th of December. How many practice cakes will Chef bake starting from today?
Input Format
The first and only line of input will contain a single integer$X$— today's date.
Output Format
For each test case, output a single integer: the number of practice cakes Chef will bake.
Constraints$1 \leq X \leq 24$Sample 1:
Explanation:
If today is the$18$-th of December, Chef will bake one cake on each of the dates$18, 19, 20, 21, 22, 23, 24$, which is$7$in total.
Sample 2:
Input
Output
1
24
Explanation:
Chef will bake one cake on every day from$1$to$24$, which is$24$cakes in total.

Sample Input:
18

Sample Output:
7

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

int main() {
    int x;
    cin>>x;
    int z=25-x;
    cout<<z;

}

Go solution:
package main
import "fmt"

func main(){
    // your code goes here
    var X int
//  fmt.Println("Enter the date")
    fmt.Scan(&X)
    if X>25{
        fmt.Println("Christmas already gone")
    }else{
        n:=25-X
        fmt.Println(n)
    }
}

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 sc = new Scanner(System.in);

        // Read today's date
        int X = sc.nextInt();

        // Calculate the number of practice cakes Chef will bake
        int cakesToBake = 24 - X + 1;

        // Output the result
        System.out.println(cakesToBake);

        // Close the scanner
        sc.close();

    }
}

JavaScript solution:
// your code goes here
let stdInput = '';
process.stdin.on('data' , input => stdInput += input);
process.stdin.on('end' , () =>{
    const input = stdInput.trim();
    if(1<=input && input<=24){
    console.log(25-input);
        
    }
});

Python solution:
# cook your dish here
# Read the difficulty level of the assignment
# Read today's date
X = int(input())

# Calculate number of practice cakes
practice_cakes = 24 - X + 1

# Print the result
print(practice_cakes)

Ruby solution:
# Read input safely and handle potential errors
begin
  x = Integer(gets.chomp)
rescue ArgumentError
  puts "Invalid input"
  exit
end

# Validate input range
if x < 1 || x > 24
  puts "Input must be between 1 and 24"
  exit
end

# Calculate and output the result
puts 25 - x