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 (Clang 3.8.0) (judge verdict: Runtime Error)

#include <stdio.h>
#include <math.h>
#define NUM 100001  // NUM以下の素数を求める

int main(void){
    // Your code here!
int Q;
scanf("%d", &Q);
int L[Q];
int R[Q];
  unsigned prime[NUM];
for (int i = 0; i < Q; ++i) {
  scanf("%d" "%d", &L[i],&R[i]);

  unsigned i, j;
  unsigned sq_num = (int)sqrt((double)NUM);

  // 1が立っているものが素数
  // 0が立っているものが合成数（素数ではない）

  for (i = 0; i < NUM; i++)
    prime[i] = 1;  // 全ての数に1を立てる
  prime[0] = 0;    // 1は素数ではない

  for (i = 1; i < sq_num; i++) {
    if (prime[i] == 1)          // prime[i]が素数なら
      for (j = (i+1); (i+1) * j <= NUM; j++)
        prime[(i+1) * j - 1] = 0;  // 素数の倍数は素数ではない
  }

}

int nita[NUM]= {};
int i;
  for (i = 1; i < NUM; i++){
    if(prime[i-1]==1 && prime[(i)/2] ==1 && i != 2){
        nita[i] = nita[i-1] + 1;}
    else{
        nita[i] = nita[i-1];}
}
int a;
//  for (i = 0; i < 100; i++){
//    printf("%d\n",nita[i]);
//}
  for (i = 0; i < Q; i++){
    a = nita[R[i]] - nita[L[i]-1];
    printf("%d\n",a);
}
return 0;
}