AtCoder Beginner Contest 083 - Libra

A balance scale tips to the left if L>R, where L is the total weight of the masses on the left pan and R is the total weight of the masses on the right pan. Similarly, it balances if L=R, and tips to the right if L<R.
Takahashi placed a mass of weight A and a mass of weight B on the left pan of a balance scale, and placed a mass of weight C and a mass of weight D on the right pan.
Print Left if the balance scale tips to the left; print Balanced if it balances; print Right if it tips to the right.

-----Constraints-----
 - 1\leq A,B,C,D \leq 10
 - All input values are integers.

-----Input-----
Input is given from Standard Input in the following format:
A B C D

-----Output-----
Print Left if the balance scale tips to the left; print Balanced if it balances; print Right if it tips to the right.

-----Sample Input-----
3 8 7 1

-----Sample Output-----
Left

The total weight of the masses on the left pan is 11, and the total weight of the masses on the right pan is 8. Since 11>8, we should print Left.

Difficulty: EASY

Starter code:

Solutions:
(x, y, z, w) = map(int, input().split())
print('Left' if x + y > z + w else 'Right' if x + y < z + w else 'Balanced')


(a, b, c, d) = map(int, input().split())
if a + b == c + d:
	ans = 'Balanced'
elif a + b > c + d:
	ans = 'Left'
else:
	ans = 'Right'
print(ans)


(A, B, C, D) = map(int, input().split())
if A + B > C + D:
	print('Left')
elif A + B == C + D:
	print('Balanced')
else:
	print('Right')


(a, b, c, d) = map(int, input().split())
(l, r) = (a + b, c + d)
print('Left' if l > r else 'Right' if l < r else 'Balanced')


(v, b, n, m) = map(int, input().split())
if v + b == n + m:
	print('Balanced')
elif v + b > n + m:
	print('Left')
else:
	print('Right')


(A, B, C, D) = map(int, input().split())
L = A + B
R = C + D
print('Left' if L > R else 'Balanced' if L == R else 'Right')


(a, b, c, d) = (int(i) for i in input().split())
print('Balanced' if a + b == c + d else 'Left' if a + b > c + d else 'Right')


S = input()
S_list = S.split()
L = int(S_list[0]) + int(S_list[1])
R = int(S_list[2]) + int(S_list[3])
if L - R > 0:
	print('Left')
elif L - R < 0:
	print('Right')
else:
	print('Balanced')


(a, b, c, d) = map(int, input().split())
print('Balanced') if a + b == c + d else print('RLiegfhtt'[a + b > c + d::2])


(a, b, c, d) = map(int, input().split())
print(['Balanced', 'Left', 'Right'][(a + b > c + d) - (a + b < c + d)])


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 = '3 8 7 1'
		output = 'Left'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '3 4 5 2'
		output = 'Balanced'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '1 7 6 4'
		output = 'Right'
		self.assertIO(input, output)

def resolve():
	(A, B, C, D) = list(map(int, input().split()))
	if A + B > C + D:
		print('Left')
	elif A + B < C + D:
		print('Right')
	else:
		print('Balanced')

def __starting_point():
	resolve()
__starting_point()


(a, b, c, d) = map(int, input().split())
L = a + b
R = c + d
print('Left' * (L > R) or 'Right' * (L < R) or 'Balanced')


(a, b, c, d) = map(int, input().split())
n = a + b
m = c + d
if n > m:
	print('Left')
elif m > n:
	print('Right')
else:
	print('Balanced')


(left_a, left_b, right_a, right_b) = list(map(int, input().split()))
left_weight = left_a + left_b
right_weight = right_a + right_b
if left_weight == right_weight:
	print('Balanced')
elif left_weight > right_weight:
	print('Left')
elif right_weight > left_weight:
	print('Right')


(a, b, c, d) = map(int, input().split())
e = a + b
f = c + d
if e > f:
	print('Left')
elif e < f:
	print('Right')
else:
	print('Balanced')


(a1, a2, b1, b2) = map(int, input().split())
a = a1 + a2
b = b1 + b2
print('Left' if a > b else 'Balanced' if a == b else 'Right')


(a, b, c, d) = list(map(int, input().split()))
result = 'ret'
if a + b > c + d:
	result = 'Left'
elif a + b < c + d:
	result = 'Right'
else:
	result = 'Balanced'
print(result)


import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

def I():
	return int(input())

def F():
	return float(input())

def SS():
	return input()

def LI():
	return [int(x) for x in input().split()]

def LI_():
	return [int(x) - 1 for x in input().split()]

def LF():
	return [float(x) for x in input().split()]

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

def resolve():
	(A, B, C, D) = LI()
	L = A + B
	R = C + D
	if L == R:
		print('Balanced')
	elif L > R:
		print('Left')
	else:
		print('Right')

def __starting_point():
	resolve()
__starting_point()


(A, B, C, D) = map(int, input().split())
l = A + B
r = C + D
print('Balanced' if l == r else 'Left' if l > r else 'Right')


(A, B, C, D) = map(int, input().split())
print('Balanced' * (A + B - C - D == 0) or 'RLiegfhtt'[A + B - C - D > 0::2])


(a, b, c, d) = map(int, input().split())
x = a + b - c - d
if x > 0:
	print('Left')
elif x == 0:
	print('Balanced')
else:
	print('Right')


(A, B, C, D) = map(int, input().split())
print(['Balanced', 'Left', 'Right'][(C + D < A + B) - (C + D > A + B)])


(A, B, C, D) = (int(T) for T in input().split())
L = A + B
R = C + D
print(['Balanced', 'Left', 'Right'][(L != R) + (L < R)])


import math
(a, b, c, d) = map(int, input().split())
print('Left' if a + b > c + d else 'Balanced' if a + b == c + d else 'Right')


(a, b, c, d) = map(int, input().split())
e = a + b - c - d
print('LBReaiflgtah nt c  e  d'[(e < 0) + (e <= 0)::3])


(a, b, c, d) = map(int, input().split())
L = a + b
R = c + d
if L > R:
	print('Left')
elif L == R:
	print('Balanced')
else:
	print('Right')


w = list(map(int, input().split()))
(l, r) = (sum(w[:2]), sum(w[2:]))
print('Left' if l > r else 'Right' if l < r else 'Balanced')


(a, b, c, d) = [int(x) for x in input().split()]
if a + b == c + d:
	print('Balanced')
elif a + b > c + d:
	print('Left')
else:
	print('Right')


(A, B, C, D) = list(map(int, input().split()))
ab = A + B
cd = C + D
result = 'Balanced'
if ab > cd:
	result = 'Left'
elif ab < cd:
	result = 'Right'
print(result)


(A, B, C, D) = list(map(int, input().split()))
if (1 <= A and A <= 10) and (1 <= B and B <= 10) and (1 <= C and C <= 10) and (1 <= D and D <= 10):
	L = A + B
	R = C + D
	if L > R:
		print('Left')
	elif L == R:
		print('Balanced')
	elif L < R:
		print('Right')


(a, b, c, d) = map(int, input().split())
ab = a + b
cd = c + d
print('Left' if ab > cd else 'Right' if ab < cd else 'Balanced')


a = input().split()
a = [int(j) for j in a]
a.append(a[:2])
a.append(a[2:4])
if sum(a[4]) > sum(a[5]):
	print('Left')
if sum(a[4]) == sum(a[5]):
	print('Balanced')
if sum(a[4]) < sum(a[5]):
	print('Right')


(A, B, C, D) = list(map(int, input().split()))
left_dish = A + B
right_dish = C + D
if left_dish > right_dish:
	print('Left')
elif left_dish < right_dish:
	print('Right')
elif left_dish == right_dish:
	print('Balanced')


(a, s, d, f) = map(int, input().split())
a += s
d += f
print('Right' if a < d else 'Left' if a > d else 'Balanced')


(a, b, c, d) = map(int, input().split())
left = a + b
right = c + d
if left > right:
	print('Left')
elif left == right:
	print('Balanced')
else:
	print('Right')


(a, b, c, d) = map(int, input().split())
x = a + b
y = c + d
if x > y:
	print('Left')
if x < y:
	print('Right')
if x == y:
	print('Balanced')


l = list(map(int, input().split()))
s = sum(l[:2]) - sum(l[2:])
print(['Left', 'Balanced', 'Right'][1 - (s > 0) + (s < 0)])


(A, B, C, D) = map(int, input().split())
n = A + B - C - D
print('Left' if n > 0 else 'Balanced' if n == 0 else 'Right')


(a, b, c, d) = list(map(int, input().split()))
print('Left' if a + b > c + d else 'Right' if a + b < c + d else 'Balanced')


(A, B, C, D) = map(int, input().split())
AB = A + B
CD = C + D
print('Left' if AB > CD else 'Right' if CD > AB else 'Balanced')


lst = input().split()
d = int(lst[0]) + int(lst[1]) - (int(lst[2]) + int(lst[3]))
if d == 0:
	print('Balanced')
elif 0 < d:
	print('Left')
else:
	print('Right')


(a, b, c, d) = map(int, input().split())
A = a + b
C = c + d
print('Left' if A > C else 'Balanced' if A == C else 'Right')


(a, b, c, d) = list(map(int, input().split()))
diff = a + b - (c + d)
if diff == 0:
	print('Balanced')
elif diff > 0:
	print('Left')
else:
	print('Right')


a = list(map(int, input().split()))
a = a[0] + a[1] - a[2] - a[3]
if a == 0:
	print('Balanced')
elif a > 0:
	print('Left')
else:
	print('Right')


(a, b, c, d) = input().split()
a = int(a)
b = int(b)
c = int(c)
d = int(d)
if a + b == c + d:
	print('Balanced')
if a + b > c + d:
	print('Left')
if a + b < c + d:
	print('Right')


import sys
sys.setrecursionlimit(10 ** 6)
(a, b, c, d) = list(map(int, input().split()))
e = a + b
f = c + d
if e > f:
	print('Left')
if e == f:
	print('Balanced')
if e < f:
	print('Right')


def mapt(fn, *args):
	return tuple(map(fn, *args))

def Input():
	return mapt(int, input().split(' '))

def main():
	(a, b, c, d) = Input()
	(x, y) = (a + b, c + d)
	if x > y:
		print('Left')
	elif x < y:
		print('Right')
	else:
		print('Balanced')
main()


import sys
mapin = lambda : map(int, sys.stdin.readline().split())
listin = lambda : list(map(int, sys.stdin.readline().split()))
inp = lambda : sys.stdin.readline()
(A, B, C, D) = mapin()
l = A + B
r = C + D
if l < r:
	print('Right')
elif l > r:
	print('Left')
else:
	print('Balanced')


(A, B, C, D) = map(int, input().split())
e = A + B - C - D
print('Balanced') if e == 0 else print(['', 'Left', 'Right'][int(e / abs(e))])


import bisect, collections, copy, heapq, itertools, math, string
import sys

def I():
	return int(sys.stdin.readline().rstrip())

def LI():
	return list(map(int, sys.stdin.readline().rstrip().split()))

def S():
	return sys.stdin.readline().rstrip()

def LS():
	return list(sys.stdin.readline().rstrip().split())
(A, B, C, D) = LI()
if A + B > C + D:
	print('Left')
elif A + B == C + D:
	print('Balanced')
else:
	print('Right')


(a, b, c, d) = map(int, input().split())
e = a + b
f = c + d
print(['RLiegfhtt'[e > f::2], 'Balanced'][e == f])


(a, b, c, d) = map(int, input().split())
e = a + b - c - d
print('Right' if e < 0 else 'Balanced' if e == 0 else 'Left')


import sys
(A, B, C, D) = list(map(int, input().split()))
if A + B > C + D:
	print('Left')
elif A + B == C + D:
	print('Balanced')
else:
	print('Right')


(A, B, C, D) = map(int, input().split())
(L, R, S) = (A + B, C + D, 'Balanced')
if L > R:
	S = 'Left'
elif L < R:
	S = 'Right'
print(S)


(a, b, c, d) = list(map(int, input().split()))
left = a + b
right = c + d
print(['Balanced', 'Left', 'Right'][left > right or -(right > left)])


import math
a = list(map(int, input().split()))
if a[0] + a[1] < a[2] + a[3]:
	print('Right')
elif a[0] + a[1] == a[2] + a[3]:
	print('Balanced')
elif a[0] + a[1] > a[2] + a[3]:
	print('Left')


(left1, left2, right1, right2) = map(int, input().split())
if right1 + right2 > left1 + left2:
	print('Right')
elif right1 + right2 < left1 + left2:
	print('Left')
else:
	print('Balanced')