Problem:
Score : 100 points

Problem Statement

How many hours do we have until New Year at M o'clock (24-hour notation) on 30th, December?

Constraints

1≤M≤23

M is an integer.

Input

Input is given from Standard Input in the following format:

M

Output

If we have x hours until New Year at M o'clock on 30th, December, print x.

Sample Input 1

21

Sample Output 1

27

We have 27 hours until New Year at 21 o'clock on 30th, December.

Sample Input 2

12

Sample Output 2

36

Solution in Kotlin (1.0.0) (judge verdict: Runtime Error)

fun main(args: Array<String>) {
    val c= readLine()!!.toInt()
    val array= mutableListOf<List<Int>>()
    for(i in 0 until c){
        val array2= readLine()!!.split(" ").map { it.toInt() }
        array.add(array2)
    }
    for(i in array){
        val k=likeCount(Array((i[1]-i[0])/2+1,{i[0]+it*2}),i[1]+1,i[0])
        println(k)
    }
}

fun likeCount(a:Array<Int>,l1:Int,l2:Int):Int{
    val c=Array(l1,{true})
    c[0]=false
    c[1]=false
    for(i in 2 until l1){
        for(j in 2 until l1){
            for(k in 2 until isqrt(l1)+1){
                if(j == i*k){
                    c[j]=false
                }
            }
        }
    }
    for(i in Array(l1-2,{it+2}).reversedArray()){
        if(!c[(i+1)/2])c[i]=false
    }
    for(i in 2 until l2){
        c[i]=false
    }
    return c.count({ it })
}

fun isqrt(n:Int):Int{
    if(n<=0)return 0
    if(n<4)return 1
    var x=0
    var y=n
    while(x!=y&&x+1!=y){x=y;y=(n/y+y)/2}
    return x
}