Problem:
Score : 100 points

Problem Statement

Dolphin loves programming contests. Today, he will take part in a contest in AtCoder.

In this country, 24-hour clock is used. For example, 9:00 p.m. is referred to as "21 o'clock".

The current time is A o'clock, and a contest will begin in exactly B hours.
When will the contest begin? Answer in 24-hour time.

Constraints

0 \leq A,B \leq 23

A and B are integers.

Input

The input is given from Standard Input in the following format:

A B

Output

Print the hour of the starting time of the contest in 24-hour time.

Sample Input 1

9 12

Sample Output 1

21

In this input, the current time is 9 o'clock, and 12 hours later it will be 21 o'clock in 24-hour time.

Sample Input 2

19 0

Sample Output 2

19

The contest has just started.

Sample Input 3

23 2

Sample Output 3

1

The contest will begin at 1 o'clock the next day.

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <bits/stdc++.h>
using namespace std;
 int N,M;
 vector<int> a(60),b(60),c(60),d(60);
 int i;


int func(int id){
   int best = 2*30;
   int ans = -1;
   int dist;
  for(int j = 0; j < M; j++){
    dist = abs(a.at(id) - c.at(j)) + abs(b.at(id) - d.at(j));
     if (dist < best){
       best = dist;
       ans = j;
     }
   }
  return ans + 1;
}

int main() {
 
 cin >> N >> M;
 
 for(i = 0; i < N; i++) cin >> a.at(i) >> b.at(i);
  
 for(i = 0; i < M; i++) cin >> c.at(i) >> d.at(i);
    
 for(i = 0; i < N; i++){
   int res = func(i);
   cout << res << endl;
 }
  return 0;
}