Problem:


Score : 100 points

Problem Statement

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 1

3 8 7 1

Sample Output 1

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.

Sample Input 2

3 4 5 2

Sample Output 2

Balanced

The total weight of the masses on the left pan is 7, and the total weight of the masses on the right pan is 7. Since 7=7, we should print Balanced.

Sample Input 3

1 7 6 4

Sample Output 3

Right

The total weight of the masses on the left pan is 8, and the total weight of the masses on the right pan is 10. Since 8<10, we should print Right.



Sample input:
3 8 7 1


Sample output:
Left

Submission status: Runtime Error

Solution code:
X,Y=map(int,input().split())
dev = int(Y/X)
work = 1
for i in range(108):
  tmp = pow(2,i)
  if tmp <= dev and dev < tmp*2:
    work +=i
    break
print(work)

Submission status: Runtime Error

Solution code:
a=map(input().split(), int)
r = next(a)
r += next(a)
r -= next(a)
r -= next(a)
print('Left' if r > 0 else 'Balanced' if r == 0 else 'Right')

Submission status: Runtime Error

Solution code:
A, B, C, D= [int(input() )for _ in range(4)]
D = A+B
E = C+D
if D>E:
    print("Left")
elif D<E:
    print("Right")
else:
    print("Balanced")

Submission status: Runtime Error

Solution code:
A, B, C, D= [int(input() )for _ in range(4)]
if (A+B )> (C+D):
    print("Left")
elif (A+B )< (C+D):
    print("Right")
else:
    print("Balanced")

Submission status: Runtime Error

Solution code:
a = int(input())
b = int(input())
c = int(input())
d = int(input())

ab_count = a + b
cd_count = c + d

if ab_count > cd_count:
	print('left')
else if ab_count == cd_count:
	print('balanced')
elif:
	print('light')

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# get a integer
a = int(raw_input())

list = a.split()

left = int(list[0])+int(list[1])
right = int(list[2])+int(list[3])

if left < right:
  print("Right")
elif left > right:
  print("Left")
else:
  print("Balanced")

Submission status: Runtime Error

Solution code:
a,b,c,d=map(int,input().split())
if a+b > c+d:
print("Left")
elif a+b == c+d:
print("Balanced")
elif a+b < c+d:
print("Right")

Submission status: Runtime Error

Solution code:
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")

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())
 
num = 0
while x < y:
    num += 1
    x *= 2
    
print(num)

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())

num = 1
while x < y:
    x *= 2
    num += 1

print(num)

Submission status: Runtime Error

Solution code:
n, a, b = map(int, input().split())
tot = 0
for num in range(1, n+1):
     sum_dgt = sum(map(int, str(num)))
     if sum_dgt >= a and sum_dgt <= b:
         tot += num
print(tot)

Submission status: Runtime Error

Solution code:

import math
X, Y = list(map(int, input().split()))
"""
print(math.ceil(math.log(Y/X+1, 2)))
"""
count = 0
while X <= Y:
    X *= 2
    count += 1
print(count)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
a,b,c,d = map[int,input().split()]
right = a + b
left = c + d

if right > left:
  print('Right')
elif left > right:
  print('Left')
else:
  print('Balanced')

Submission status: Runtime Error

Solution code:
n,a,b=map(int,input().split())

ans=0
for i in range(n+1):
    l=[int(x) for x in list(str(i))]
    if a<=sum(l)<=b:
        ans=ans+i
print(ans)

Submission status: Runtime Error

Solution code:
#a = 314159265
#b = 358979323846264338
a, b = map(int, input().split())
count = 1
x = a
#print(x)
while x * 2 <= b:
    x = x * 2
    #print(x)
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
#a = 314159265
#b = 358979323846264338
a, b = map(int, input().split())
count = 1
x = a
print(x)
while x * 2 <= b:
    x = x * 2
    #print(x)
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
a, b = map(int, input().split())
count = 1
x = a
print(x)
while x * 2 <= b:
    x = x * 2
    print(x)
    count += 1
print(count)

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int, input().split())
l = a + b
r = c + d
if l == r:
    print(Balanced)
elif l < r:
    print(Right)
else:
    print(Left)

Submission status: Runtime Error

Solution code:
A,B,C,D = input().split( )
 
L=A+B
R=C+D
if L>R :
    print("Left")
elif L==R :
    print("Balanced")
else :
    print("Right")

Submission status: Runtime Error

Solution code:
A,B,C,D = int,input().split( )
 
L=A+B
R=C+D
if L>R :
    print("Left")
elif L==R :
    print("Balanced")
else :
    print("Right")

Submission status: Runtime Error

Solution code:
A,B,C,D = map(int,input().split( ))
 
L=A+B
R=C+D
if L<R :
    print("Right")
elif L==R :
    print("Balanced")
else :
    print("Left")

Submission status: Runtime Error

Solution code:
A,B,C,D=input().split( )
L=int(A)+int(B)
R=int(C)+int(D)
If L<R:
print("right")
else if L==R:
print("Balanced")
else L>R:
print("Left")

Submission status: Runtime Error

Solution code:
A,B,C,D=input().split( )
L=A+B
R=C+D
If L<R:
print("right")
else if L==R:
print("Balanced")
else L>R:
print("Left")

Submission status: Runtime Error

Solution code:
A,B,C,D=input().split( )
L=A+B
R=C+D
If L<R:
print("right")
else if L==R:
print("Balanced")
else if L>R:
print("Left")

Submission status: Runtime Error

Solution code:
A,B,C,D=input().split( )
L=A+B
R=C+D
If L<R
print("right")
else if L==R
print("Balanced")
else if L>R
print("Left")

Submission status: Runtime Error

Solution code:
A,B,C,D=input().split( )
L=A+B
R=C+D
If(L<R)
print("right")
else if(L==R)
print("Balanced")
else if(L>R)
print("Left")

Submission status: Runtime Error

Solution code:
A,B,C,D=input().split( )
If(A+B<C+D)
print("right")
else if(A+B==C+D)
print("Balanced")
else if(A+B>C+D)
print("Left")

Submission status: Runtime Error

Solution code:
# A - Libra
# coding: utf-8
A, B, C, D = map(int, raw_input())
if A+B > C+D:
  print "Left"
elif A+B < C+D:
  print "Right"
else:
  print "Balanced"

Submission status: Runtime Error

Solution code:
import math

X, Y = map(int, input().split())
k = math.floor(math.log(Y/X, 2) + 1)
print(k)

Submission status: Runtime Error

Solution code:

def sum_dig(num):
    nsum = 0
    while(num):
        dig = num % 10
        nsum = nsum + dig
        num = num // 10
#        print (dig,sum,num)
    return nsum


lim, nmin, nmax = map(int, input().split(" "))
chk_sum = 0
for i in range(1,lim+1) :
    chk = sum_dig(i)
#    print(chk,type(chk))
    if (chk >= nmin and chk <= nmax) :
        chk_sum += i

print (chk_sum)

Submission status: Runtime Error

Solution code:

def sum_dig(num):
    sum = 0
    while(num):
        dig = num % 10
        sum = sum + dig
        num = num // 10
#        print (dig,sum,num)
    return sum


lim, min, max = map(int, input().split(" "))
chk_sum = 0
for i in range(1,lim+1) :
    chk = sum_dig(i)
#    print(chk,type(chk))
    if (chk >= min and chk <= max) :
        chk_sum += i

print (chk_sum)

Submission status: Runtime Error

Solution code:
import sys

def sum_dig(num):
    sum = 0
    while(num):
        dig = num % 10
        sum = sum + dig
        num = num // 10
#        print (dig,sum,num)
    return sum


lim, min, max = map(int, input().split(" "))
chk_sum = 0
for i in range(1,lim+1) :
    chk = sum_dig(i)
#    print(chk,type(chk))
    if (chk >= min and chk <= max) :
        chk_sum += i

print (chk_sum)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

import math
import sys

tmp = input().split(" ")
n,a,b = list(map(int, tmp))
ans = 0

for i in range(n+1):
    tmp = i % 10 + i % 100 // 10 + i % 1000 // 100 + i % 10000 // 1000 + i // 10000
    if (tmp >= a) & (tmp <= b):
        ans += i
print(ans)

Submission status: Runtime Error

Solution code:
lis = list(map(int,input().split()))
if lis[0]+lis[1]>lis[2]+lis[3]:
  print("Left")
else if lis[0]+lis[1]<lis[2]+lis[3]:
  print("Right")
else:
  print("Balanced")

Submission status: Runtime Error

Solution code:
l = list(map(int,raw_input).split())
if(l[0]+l[1]) > (l[2]+l[3]):
    print "Left"
elif (l[0] + l[1]) == (l[2] + l[3]):
    print "Balanced"
else:
    print "Right"

Submission status: Runtime Error

Solution code:
import sys

a = sys.stdin.readline()
A = a.rstrip()
b = sys.stdin.readline()
B = b.rstrip()
c = sys.stdin.readline()
C = c.rstrip()
d = sys.stdin.readline()
D = d.rstrip()

L = int(A) + int(B)
R = int(C) + int(D)

if L > R:
    print('Left')
elif L < R:
    print('Right')
elif L == R:
    print('Balanced')

Submission status: Runtime Error

Solution code:
import sys

a = sys.stdin.readline()
A = a.rstrip()
b = sys.stdin.readline()
B = b.rstrip()
c = sys.stdin.readline()
C = c.rstrip()
d = sys.stdin.readline()
D = d.rstrip()

L = int(A) + int(B)
R = int(C) + int(D)

if L > R:
    print('Left')
elif L < R:
    print('Right')
else:
    print('Balanced')

Submission status: Runtime Error

Solution code:
A, B, C, D = [int(x) for x in input().split()]

def main();
    ans = A + B - C - D
    if ans > 0:
        print('Left')
    elif ans < 0:
        print('Right')
    else:
        print('Balanced')

if __name == '__main__':
    main()

Submission status: Runtime Error

Solution code:
n,a,b=input().split()
nn=[0]*4
x=0
for i in range(1,n+1,1,):
    nn=len(i)
    y=nn[0]+nn[1]+nn[2]+nn[3]
    if (y>=a)and(y<=b):
        x=x+y
print(x)

Submission status: Runtime Error

Solution code:
n,a,b = map(int, input().split())
def f(x):
  ret = 0
  while(x > 0):
    ret += x % 10
    x //= 10
  return ret
nums = filter(lambda x: f(x) >= a and f(x) <= b, range(1, n + 1))
print(sum(nums))

Submission status: Runtime Error

Solution code:
# -*- coding:utf-8 -*-
a, b, c, d = map(int, input().split)
l = a+b
r = c+d
if l > r:
    print("Left")
elif l < r:
    print("Right")
else:
    print("Balanced")

Submission status: Runtime Error

Solution code:
s = input()

slist = s.split(" ")

left = int(slist[0]) + int(slist[1])

right = slist[2] + slist[3]

if left > right:
	print("left")
	
elif left == right:
	print("Balanced")
	
else:
	print("right")

Submission status: Runtime Error

Solution code:
a,b,c,d = map(input().split(), int())

if a+b < c+d :
    print("Left")
elif a+b > c+d:
    print("Right")
else:
    print("Balanced")

Submission status: Runtime Error

Solution code:
s = input()

slist = s.split(' ')

left = int(slist[0]) + int(slist[1])

right = int(slist[2]) + int(slist[3])

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right')

Submission status: Runtime Error

Solution code:
s = input()

slist = s.split(' ')

left = slist[0] + slist[1]

right = slist[2] + slist[3]

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right')

Submission status: Runtime Error

Solution code:
s = input()

slist = s.split(' ')

left = slist[0] + slist[1]

right = slist[2] + slist[3]

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right)

Submission status: Runtime Error

Solution code:
s = input()

slist = s.split(' ')

left = slist[0] + slist[1]

right = slist[2] + slist[3]

if left > right:
	print('left')
else if left == right:
	print('Balanced')
else:
	print('right

Submission status: Runtime Error

Solution code:
str = args[1]
print(str)

Submission status: Runtime Error

Solution code:
str = raw_inpur()
print(str)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

S = [int(x) for x in list(input())]

if len(S) == 1:
    print(1)

elif len(S) == 2:
    if S[0] == S[1]:
        print(2)
    else:
        print(1)
else:
    l = []
    c = 1
    for i in range(len(S) - 1):
        if S[i] == S[i + 1]:
            c += 1
        else:
            l.append(c)
            c = 1
    l.append(c)

    ans = max(l)
    if ans in l[1:-1]:
        print(ans + 1)
    else:
        print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-

S = [int(x) for x in list(input())]

if len(S)==1:
    print(1)

elif len(S)==2:
    if S[0] == S[1]:
        print(2)
    else:
        print(1)
else:
    l = []
    c = 1
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            c += 1
        else:
            l.append(c)
            c = 1
    l.append(c)
    ans = max(l)
    if ans in l[1:-1]:
        print(ans+1)
    else:
        print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

S = [int(x) for x in list(input())]

if len(S)==1:
    print(1)

elif len(S)==2:
    if S[0] == S[1]:
        print(2)
    else:
        print(1)
else:
    l = []
    c = 1
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            c += 1
        else:
            l.append(c)
            c = 1
    l.append(c)
    ans = max(l)
    if ans in l[1:-1]:
        print(ans+1)
    else:
        print(ans)

Submission status: Runtime Error

Solution code:
rS = list(str(input()))
import numpy
S0 = numpy.array(rS).astype(numpy.int32)
S1 = numpy.array(rS).astype(numpy.int32)
lS = len(S0)
def hanten(slist):
    ans = numpy.logical_xor(slist,numpy.ones(len(slist))).astype(int)
    return ans

for i in range(2,lS+1)[::-1]:
    for j in range(lS - i + 1):
        if(S0[j] == 0):
            S0[j:j+i] = hanten(S0[j:j+i])
        if(S1[j] == 1):
            S1[j:j+i] = hanten(S1[j:j+i])
            
    if(sum(S0[:-1]) == len(S0) - 1):
        print(i)
        break;
    if(sum(S1[:-1]) == len(S1) - 1):
        print(i)
        break;

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

S = [int(x) for x in list(input())]

if len(S)==1:
    print(1)

elif len(S)==2:
    if S[0] == S[1]:
        print(2)
    else:
        print(1)
else:
    l = []
    c = 1
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            c += 1
        else:
            l.append(c)
            c = 1
    l.append(c)
    ans = max(l)
    if ans in l[1:-1]:
        print(ans+1)
    else:
        print(ans)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import numpy as np

S = [int(x) for x in list(input())]

if len(S)==1:
    print(1)

elif len(S)==2:
    if S[0] == S[1]:
        print(2)
    else:
        print(1)
else:
    l = []
    c = 1
    for i in range(len(S)-1):
        if S[i] == S[i+1]:
            c += 1
        else:
            l.append(c)
            c = 1
    l.append(c)
    ans = max(l)
    #print(l)
    if ans in l[1:-1]:
        print(ans+1)
    else:
        print(ans)

Submission status: Runtime Error

Solution code:
# スペース区切りの整数の入力
x, y= map(int, input().split())

lst = []

num = x

while num <= y:
    lst.append(num)
    num = 2*num

print(len(lst))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import math,sys

X,Y = map(int,input().split())

print(math.ceil((math.log(Y,10)-math.log(X,10))/math.log(2,10)))

Submission status: Runtime Error

Solution code:
a, b, c, d = map(int(), input().split())
if a+b > c+d:
    print("left")
elif a+b < c+d:
    print("right")
else:
   print("balanced")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
A,B,C,D = map(int, input().split())
L = A + B
if L == R:
    print("Balanced")
elif L <= R:
    print("Right")
else :
    print("Left")

Submission status: Runtime Error

Solution code:
x, y = map(int, input().split())
c = 2
z = 1
if(x > 1):
  c = x;
while(c*2 <= y):
  c *= 2;
  z += 1;
print(z)

Submission status: Runtime Error

Solution code:
import sys
x, y = map(int,sys.stdin.readline().split())
cnt = 0
while x <= y:
    cnt += 1
    x *= 2
print(cnt)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
A = input()
B = input()
C = input()
D = input()
L = A + B
R = C + D
if L == R:
    print("Balanced")
elif L <= R:
    print("Right")
else :
    print("Left")

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
  2 
  3 A = input()
  4 B = input()
  5 C = input()
  6 D = input()
  7 L = A + B
  8 R = C + D
  9 if L == R:
 10     print("Balanced")
 11 elif L <= R:
 12     print("Right")
 13 else :
 14     print("Left")

Submission status: Runtime Error

Solution code:
A,B,C,D = input().split(' ')
A,B,C,D = [int(A),int(B),int(C),int(D)]

L= A + B
R = C + D

if L>R:
	print("Left")
elif L=R:
	print("Balanced")
else:
	print("Right")

Submission status: Runtime Error

Solution code:
libra = [int(i) for i in input().split]
left = libra[0] + libra[1]
right = libra[2] + libra[3]

if left > right:
    print('Left')
elif left < right:
    print('Right')
else:
    print('Balanced')

Submission status: Runtime Error

Solution code:
A = list(map(int, input().split(' ')))

L=A[0]+A[1]
R=A[2]+A[3]
if L<R: print("Right")
if L=R: print("Balanced")
if L>R: print("Left")

Submission status: Runtime Error

Solution code:

a, b, c, d = map(int,input().split())

lsum = a+b
rsum = c+d


if lsum<rsum:
    print('Right')
elif lsum==rsum:
    print('Balanced)
else:
    print('Left')

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    if(A + B < C + D)
        cout << "Right" << endl;
    else if(A + B == C + D)
        cout << "Balanced" << endl;
    else
        cout << "Left" << endl;
    return 0;
}

Submission status: Runtime Error

Solution code:
a,b,c,d = map(input().split())

if (a+b > c+d):
    print("Left")
elif (a + b < c + d):
    print("Right")
else:
    print(("Balanced"))