Happy New Year!
Source: codechef
Difficulty: 125

Happy New Year!
Currently, it is$X:00$hours on December$31^{st}$and you are wondering how many hours are left till midnight.
For the purposes of this problem, we use a$24$hour system. So,$X$can range from$0$to$23$, and you need to tell the number of hours left till$00:00$of the next day.
Input Format
The first and only line of input contains a single integer$X$.
Output Format
For each test case, output on a new line the number of hours left till midnight
Constraints$0 \le X \le 23$Sample 1:
Explanation:
Right now, its$\text{00:00}$or$12$AM on$31^{st}$December. That means a whole day, i.e.$24$hours is left till the new year.
Sample 2:
Input
Output
23
1
Explanation:
It is$\text{23:00}$or$11$PM. Only$1$hour is left!

Sample Input:
0

Sample Output:
24

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

int main() {
    // your code goes here
    int v;
    cin>>v;
    int p=24-v;
    cout<<p<<endl;

}

Go solution:
package main
import "fmt"

func main(){
    var i int;
    fmt.Scanf("%d",&i);
    fmt.Printf("%d",24-i);
}

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);
        int n=sc.nextInt();
            System.out.print(24-n);
        

    }
}

JavaScript solution:
// your code goes here
let stdInput = "";
process.stdin.on("data", input => stdInput += input);

process.stdin.on("end", () =>{
    const x = Number(stdInput.trim());
    console.log(24 - x);
});

Python solution:
# cook your dish here
X=int(input())
print(24-X)

Ruby solution:
# Read input as integer
x = gets.to_i

# Calculate hours until midnight (24 - x)
# Problem guarantees 0 <= x <= 23, so no need for additional validation
puts 24 - x