AtCoder Beginner Contest 057 - Remaining Time

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-----
9 12

-----Sample Output-----
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.

Difficulty: EASY

Starter code:

Solutions:
(A, B) = [int(i) for i in input().split()]
print((A + B) % 24)


(a, s) = map(int, input().split())
print((a + s) % 24)


(a, b) = map(lambda x: int(x), input().split())
print((a + b) % 24)


Sum = sum(map(int, input().split()))
print(Sum if Sum < 24 else Sum - 24)


(A, B) = list(map(int, input().split()))
if A + B < 24:
	print(A + B)
elif A + B >= 24:
	print(A + B - 24)


(a, b) = map(int, input().split())
ans = a + b
if ans >= 24:
	ans = ans - 24
print(ans)


(A, B) = map(int, input().split())
print((A + B) % 24)


[a, b] = list(map(int, input().split()))
print((a + b) % 24)


import itertools
(A, B) = map(int, input().split())
print((A + B) % 24)


(b, c) = map(int, input().split())
print((b + c) % 24)


r = eval(input().replace(' ', '+'))
print([r, r - 24][r >= 24])


(h, dh) = map(int, input().split())
print((h + dh) % 24)


print(sum(list((int(i) for i in input().split()))) % 24)


L = [int(i) for i in input().split(' ')]
print((L[0] + L[1]) % 24)


(t1, t2) = list(map(int, input().strip().split()))
print((t1 + t2) % 24)


x = sum(list(map(int, input().split())))
if x >= 24:
	x -= 24
print(x)


(A, B) = [int(x) for x in input().split(' ')]
print((A + B) % 24)


a = map(int, input().split())
print(sum(a) % 24)


(a, b) = map(int, input().split())
b += a
if b > 23:
	print(b - 24)
else:
	print(b)


(A, B) = list(map(int, input().split()))
if A + B <= 23:
	print(A + B)
else:
	print(A + B - 24)


(n, m) = map(int, input().split())
print((n + m) % 24)


(a, b) = [int(x) for x in input().split()]
print((a + b) % 24)


(A, B) = list(map(int, input().split()))
answer = A + B
if answer < 24:
	print(answer)
else:
	print(answer - 24)


a = sum(map(int, input().split()))
print(a if a <= 23 else a - 24)


(a, b) = [int(i) for i in input().split()]
print((a + b) % 24)


(A, B) = list(map(int, input().split()))
x = (A + B) % 24
print(x)


b = input()
[c, d] = b.split()
print((int(c) + int(d)) % 24)


a = list(map(int, input().split()))
print((a[0] + a[1]) % 24)


(a, b) = map(int, input().split())
n = a + b
print(n % 24)


(A, B) = map(int, input().split())
D = A + B
if D > 23:
	D -= 24
print(D)


(A, B) = map(int, input().split())
time = A + B
ans = time % 24
print(ans)


(x, y) = map(int, input().split())
print((x + y) % 24)


(a, b) = [int(t) for t in input().split()]
print((a + b) % 24)


print(sum([int(n) for n in input().split()]) % 24)


su = sum(map(int, input().split()))
print(su - 24 if su > 23 else su)


import math
(a, b) = map(int, input().split())
print((a + b) % 24)


(N, K) = map(int, input().split())
print((N + K) % 24)


(a, b) = map(int, input().split())
r = (24 + a + b) % 24
print(r)


(hour_a, hour_b) = list(map(int, input().split()))
contest_start_hour = 0
contest_start_hour = hour_a + hour_b
if contest_start_hour >= 24:
	contest_start_hour -= 24
print(contest_start_hour)


print(eval(input().replace(' ', '+')) % 24)


import sys
sys.setrecursionlimit(10 ** 8)
ini = lambda : int(sys.stdin.readline())
inl = lambda : [int(x) for x in sys.stdin.readline().split()]
ins = lambda : sys.stdin.readline().rstrip()
debug = lambda *a, **kw: print('\x1b[33m', *a, '\x1b[0m', **dict(file=sys.stderr, **kw))

def solve():
	(a, b) = inl()
	return (a + b) % 24
print(solve())


(a, b) = map(int, input().split())
s = a + b
if s > 23:
	s -= 24
print(s)


print(sum((int(x) for x in input().split())) % 24)


(a, b) = input().split()
if int(a) + int(b) < 24:
	print(int(a) + int(b))
elif int(a) + int(b) >= 24:
	print(int(a) + int(b) - 24)


(A1, A2) = map(int, input().split())
B = A1 + A2
if B >= 24:
	B -= 24
print(B)


print(sum(list(map(lambda n: int(n), input().split(' ')))) % 24)


(A, B) = map(int, input().split())
print(A + B - 24 if A + B >= 24 else A + B)


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '9 12'
		output = '21'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '19 0'
		output = '19'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '23 2'
		output = '1'
		self.assertIO(input, output)

def resolve():
	(A, B) = list(map(int, input().split()))
	print((A + B) % 24)

def __starting_point():
	resolve()
__starting_point()


(N, M) = map(int, input().split())
ans = (N + M) % 24
print(ans)


(c, a) = map(int, input().split())
print((c + a) % 24)


(n, r) = map(int, input().split())
print((n + r) % 24)


(a, b) = map(int, input().split())
x = a + b
if x < 24:
	print(x)
else:
	print(x - 24)


(a, b) = [int(v) for v in input().split()]
print((a + b) % 24)


f = lambda x: (x[0] + x[1]) % 24
print(f(list(map(int, input().split()))))


n = eval(input().replace(' ', '+'))
print([n - 24, n][n < 24])


print(int(eval(input().replace(' ', '+'))) % 24)


(a, b) = list(map(int, input().split()))
if a + b >= 24:
	answer = a + b - 24
else:
	answer = a + b
print(answer)


import sys, math
from itertools import combinations as c, product as p
from collections import deque
sys.setrecursionlimit(10 ** 9)
MOD = 10 ** 9 + 7

def si():
	return input()

def ii():
	return int(input())

def fi():
	return float(input())

def lstr():
	return input().split()

def lint():
	return list(map(int, input().split()))

def lint_dec():
	return list(map(lambda x: int(x) - 1, input().split()))

def lnstr(n):
	return [input() for _ in range(n)]

def lnint(n):
	return [int(input()) for _ in range(n)]

def lint_list(n):
	return [lint() for _ in range(n)]
(A, B) = lint()
print((A + B) % 24)


print(sum([int(tok) for tok in input().split()]) % 24)


x = input().split()
ans = int(x[0]) + int(x[1])
print(int(ans % 24))


(a, b) = map(int, input().split())
c = a + b
if c >= 24:
	c += -24
print(c)


(A, B) = [int(n) for n in input().split()]
print((A + B) % 24)


import sys
(a, b) = list(map(int, input().split()))
print((a + b) % 24)


(a, b) = map(int, input().split())
c = round((a + b) % 24)
print(c)


poop = input().split()
print((int(poop[0]) + int(poop[1])) % 24)


(a, b) = map(int, input().split())
A = a + b
B = A % 24
print(B)


(A, B) = map(int, input().split())
if A + B == 24:
	w = 0
elif A + B > 24:
	w = abs(24 - (A + B))
else:
	w = A + B
print(w)


(A, B) = list(map(int, input().split()))
result = A + B
if result >= 24:
	result -= 24
print(result)


(a, b) = input().split(' ')
a = int(a)
b = int(b)
print((a + b) % 24)


(A, B) = [int(_) for _ in input().split()]
print((A + B) % 24)


(a, b) = map(int, input().split())
x = a + b
if x > 23:
	x -= 24
print(x)


(A, B) = list(map(int, input().split()))
T = (A + B) % 24
print(T)


(a, b) = tuple(map(int, input().split()))
print((a + b) % 24)


(A, B) = list(map(int, input().split()))
C = (A + B) // 24
print(A + B - C * 24)


(A, B) = [int(s) for s in input().split()]
print((A + B) % 24)


(c, d) = map(int, input().split())
print((c + d) % 24)


(a, b) = map(int, input().split())
tmp = a + b
print(tmp % 24)


A = list(map(int, input().split(' ')))
print(sum(A) % 24)


(A, B) = (int(T) for T in input().split())
print((A + B) % 24)


a = list(map(int, input().split()))
b = a[0] + a[1]
if b >= 24:
	b -= 24
print(b)


def main():
	(a, b) = map(int, input().split())
	if a + b < 24:
		print(a + b)
	else:
		print(a + b - 24)

def __starting_point():
	main()
__starting_point()


n = sum(list(map(int, input().split())))
print(n - 24 if n >= 24 else n)


(a, b) = map(int, input().split())
print((a + b + 12 - 12) % 24)


(a, b) = [int(num) for num in input().split()]
print((a + b) % 24)


def main():
	(a, b) = list(map(int, input().split()))
	ans = a + b
	if ans >= 24:
		print((24 - ans) * -1)
	else:
		print(ans)

def __starting_point():
	main()
__starting_point()


(a, b) = map(int, input().strip().split())
print((a + b) % 24)


(a, b) = [int(item) for item in input().split()]
print((a + b) % 24)


(N, X) = list(map(int, input().split()))
print((N + X) % 24)


(x, y) = [int(i) for i in input().split()]
print((x + y) % 24)


(a, b) = map(int, input().split())
time = (a + b) % 24
print(time)


(a, b) = [int(s) for s in input().split()]
print((a + b) % 24)


(x, y) = map(int, input().split())
print(x + y if x + y < 24 else x + y - 24)


def iroha():
	(a, b) = list(map(int, input().split()))
	num = a + b
	if num >= 24:
		new_num = num % 24
		print(new_num)
	else:
		print(num)

def __starting_point():
	iroha()
__starting_point()


arr = map(int, input().split())
print(sum(arr) % 24)


S_list = list(map(int, input().split()))
ans = S_list[0] + S_list[1]
if ans < 24:
	result = ans
else:
	result = ans - 24
print(result)


(a, b) = map(int, input().split())
t = a + b
if t >= 24:
	print(t - 24)
else:
	print(t)


(a, b) = input().split()
p = int(a)
q = int(b)
print((p + q) % 24)


p = eval(input().replace(' ', '+'))
print(p - 24 if p > 23 else p)


(N, M) = map(int, input().split())
Answer = (N + M) % 24
print(Answer)


(A, B) = [int(v) for v in input().split()]
print((A + B) % 24)


m = list(map(int, input().split()))
print(int((m[0] + m[1]) % 24))


s = list(map(int, input().split()))
print((s[0] + s[1]) % 24)


import math
(A, B) = list(map(int, input().split()))
print((A + B) % 24)


x = eval(input().replace(' ', '+'))
print(x % 24)


(a, b) = (int(_) for _ in input().split())
print((a + b) % 24)