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 C# (Mono 4.6.2.0) (judge verdict: Runtime Error)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        public static void Main()
        {
            new Program().Solve();
        }

        void Solve()
        {
            var q = int.Parse(Console.ReadLine());
            var primes = SieveOfEratosthenes(100000);
            for (int i = 0; i < q; i++)
            {
                var tmp = Console.ReadLine().Split().Select(int.Parse).ToArray();
                int l = tmp[0];
                int r = tmp[1];
                var count = primes
                    .Where(x => x >= l && x <= r)
                    .Count(x => primes.Contains((x + 1) / 2));
                //for(int j = l; j <= r; j += 2)
                //{
                //    if (IsPrimeNumber(j))
                //    {
                //        if(IsPrimeNumber((j+1)/2))
                //        {
                //            //Console.WriteLine("j" + j);
                //            count++;
                //        }
                //    }
                //}
                Console.WriteLine(count);
            }
        }

        bool IsPrimeNumber(int n)
        {
            if (n == 1)
                return false;
            if (n == 2 )
                return true;
            if (n % 2 == 0)
                return false;

            for (int i = 3; i <= Math.Sqrt(n); i += 2)
            {
                if (n % i == 0)
                    return false;
            }
            return true;
        }


        int[] SieveOfEratosthenes(int max)
        {
            if (max == 1)
                return new int[] { };
            var nums = Enumerable.Range(0, max + 1).ToArray();

            nums[1] = 0;
            for (int i = 2; i <= Math.Sqrt(max); i++)
            {
                if (nums[i] <= 0)
                    continue;
                for (int j = i*2; j <= max; j+=i)
                {
                    nums[j] = 0;
                }
            }
            return nums.Where(x => x > 0).ToArray();

        }
    }
}