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 (Clang 3.8.0) (judge verdict: Wrong Answer)

#include <stdio.h>

int main(void)
{
	int n,m;
	int i;
	int p;
	int k;
	int a[50];
	int b[50];
	int c[50];
	int d[50];
	int aa[50];
	int num[50];
	int temp;
	
	scanf("%d%d",&n,&m);
	for(i=0;i<n;i++){
		scanf("%d%d",&a[i],&b[i]);
		
		
	}
	for(i=0;i<m;i++){
		
		scanf("%d%d",&c[i],&d[i]);
		
	}
	for(i=0;i<n;i++){
		for(p=0;p<m;p++){
		aa[p]=(((a[i])-(c[p]))+((b[i])-(d[p])));
		if(aa[p]<0){aa[p]*=-1;}
		num[p]=p+1;
		}
		k=i;
		
	
	for(i=0;i<m;i++){
		
		for(p=m-1;p>i;p--){
			
			if(aa[p]<aa[p-1]){
				temp=aa[p-1];
				aa[p-1]=aa[p];
				aa[p]=temp;
				temp=num[p-1];
				num[p-1]=num[p];
				num[p]=temp;
				
				
				
				
				
				
				
				
			}
			
			
			
			
			
			
			
			
			
			
			
			
		}
		
		
		
		
		
		
	}/*
printf("\n");
	for(i=0;i<m;i++){
		
		printf("%d %d\n",aa[i],num[i]);
		
	}
	printf("\n");
	*/
	i=k;
	printf("%d\n",num[0]);
	}
	
	return 0;
}