Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
from collections import deque

H, W = map(int, input().split())
for _ in range(H):
    temp = list(map(int, input().split()))
    a = [t % 2 for t in temp]
    A.append(a)

operations = []

for i in range(H):
    y = i + 1
    if i % 2 == 0:
        for j in range(W):
            x = j + 1
            if A[i][j] == 1:
                if x != W:
                    operations.append((y, x, y, x+1))
                    A[i][j+1] = (A[i][j+1] + 1) % 2
                elif y != H:
                    operations.append((y, x, y+1, x))
                    A[i+1][j] = (A[i+1][j] + 1) % 2
    else:
        for j in reversed(range(W)):
            x = j + 1
            if A[i][j] == 1:
                if x != 1:
                    operations.append((y, x, y, x-1))
                    A[i][j-1] = (A[i][j-1] + 1) % 2
                elif y != H:
                    operations.append((y, x, y+1, x))
                    A[i+1][j] = (A[i+1][j] + 1) % 2

N = len(operations)
print(N)
if N != 0:
    for op in operations:
        print(*op, sep=' ')
    

Fixed submission:
from collections import deque

H, W = map(int, input().split())
A = []
for _ in range(H):
    temp = list(map(int, input().split()))
    a = [t % 2 for t in temp]
    A.append(a)

operations = []

for i in range(H):
    y = i + 1
    if i % 2 == 0:
        for j in range(W):
            x = j + 1
            if A[i][j] == 1:
                if x != W:
                    operations.append((y, x, y, x+1))
                    A[i][j+1] = (A[i][j+1] + 1) % 2
                elif y != H:
                    operations.append((y, x, y+1, x))
                    A[i+1][j] = (A[i+1][j] + 1) % 2
    else:
        for j in reversed(range(W)):
            x = j + 1
            if A[i][j] == 1:
                if x != 1:
                    operations.append((y, x, y, x-1))
                    A[i][j-1] = (A[i][j-1] + 1) % 2
                elif y != H:
                    operations.append((y, x, y+1, x))
                    A[i+1][j] = (A[i+1][j] + 1) % 2

N = len(operations)
print(N)
if N != 0:
    for op in operations:
        print(*op, sep=' ')
Buggy python submission (verdict: Runtime Error):
import collections

S = input()
K = int(input())

tmp = []
cum_p = [0.0]

for s in S:
    tmp.append(int(s))
total = sum(tmp)

for p in tmp:
    cum_p.append(cum_p[-1] + (p / total))

prob = K / (5*10e16)

for i in range(1, len(S) + 1):
    if prob < cum_p[i]:
        if S[i-1] == '1':
            print(S[i])
        else:
            print(S[i-1])
        break


Fixed submission:
S = input()
K = int(input())

for i, s in enumerate(S):
    if s != '1' and K-1 < i:
        ans = '1'
        break
    elif s != '1' and K-1 >= i:
        ans = s
        break
else:
    ans = '1'
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M, Q = map(int, input().split())
table = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    l, r = map(int, input().split())
    table[l][r] += 1
cum_sum2 = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i, j in product(range(1, N+1), repeat=2):
    cum_sum2[i][j] += table[i][j] + cum_sum2[i-1][j] + cum_sum2[i][j-1] - cum_sum2[i-1][j-1]
for _ in range(Q):
    p, q = map(int, input().split())
    ans = cum_sum2[q][q] - cum_sum2[p-1][q] - cum_sum2[q][p-1] + cum_sum2[p-1][p-1]
    print(ans)

Fixed submission:
from itertools import product

N, M, Q = map(int, input().split())
table = [[0 for _ in range(N+1)] for _ in range(N+1)]
for _ in range(M):
    l, r = map(int, input().split())
    table[l][r] += 1
cum_sum2 = [[0 for _ in range(N+1)] for _ in range(N+1)]
for i, j in product(range(1, N+1), repeat=2):
    cum_sum2[i][j] += table[i][j] + cum_sum2[i-1][j] + cum_sum2[i][j-1] - cum_sum2[i-1][j-1]
for _ in range(Q):
    p, q = map(int, input().split())
    ans = cum_sum2[q][q] - cum_sum2[p-1][q] - cum_sum2[q][p-1] + cum_sum2[p-1][p-1]
    print(ans)
Buggy python submission (verdict: Runtime Error):
from collections import defaultdict

N, M = map(int, input().split())
A = list(map(int, input().split()))
cumS = [0]
for a in A:
    cumS.append(a + cumS[-1])
cumS_rem = defaultdict(int)
for c in cumS:
    r = c % M
    cumS_rem[r] += 1
ans = 0
for r, n_r in cumS_rem.items()
    if n_r > 1:
        ans += n_r*(n_r-1)//2
print(ans)

Fixed submission:
from collections import defaultdict

N, M = map(int, input().split())
A = list(map(int, input().split()))
cumS = [0]
for a in A:
    cumS.append(a + cumS[-1])
cumS_rem = defaultdict(int)
for c in cumS:
    r = c % M
    cumS_rem[r] += 1
ans = 0
for r, n_r in cumS_rem.items():
    if n_r > 1:
        ans += n_r*(n_r-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
cumS = [0]
for a in A:
    cumS.append(a + cumS[-1])
cumS_rem = {i: 0 for i in range(M)}
for c in cumS:
    r = c % M
    cumS_rem[r] += 1
ans = 0
for r in range(M):
    n_r = cumS_rem[r]
    if n_r > 1:
        ans += n_r*(n_r-1)//2
print(ans)

Fixed submission:
from collections import defaultdict

N, M = map(int, input().split())
A = list(map(int, input().split()))
cumS = [0]
for a in A:
    cumS.append(a + cumS[-1])
cumS_rem = defaultdict(int)
for c in cumS:
    r = c % M
    cumS_rem[r] += 1
ans = 0
for r, n_r in cumS_rem.items():
    if n_r > 1:
        ans += n_r*(n_r-1)//2
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))

cands = A
for length in range(2, N+1):
    for i in range(N - length + 1):
        cands.append(sum(A[i : i+length]))
cands

counter = 0

for c in cands:
    if c % M == 0:
        counter += 1

print(counter)


Fixed submission:
from collections import defaultdict

N, M = map(int, input().split())
A = list(map(int, input().split()))
cumS = [0]
for a in A:
    cumS.append(a + cumS[-1])
cumS_rem = defaultdict(int)
for c in cumS:
    r = c % M
    cumS_rem[r] += 1
ans = 0
for r, n_r in cumS_rem.items():
    if n_r > 1:
        ans += n_r*(n_r-1)//2
print(ans)
Buggy python submission (verdict: Runtime Error):
D, G = map(int, input().split())
P = []
C = []

for _ in range(D):
    p, c = map(int, input().split())
    P.append(p)
    C.append(c)

ans = 0

summary = [(100*(i+1), p) for i, p in enumerate(P)]
summary = list(reversed(sorted([((comp[0]*comp[1] + c)/comp[1], comp[0]*comp[1] + c, comp[0], comp[1], c) for comp, c in zip(summary, C)])))

for i in range(D):
    _, comp_sc, prob_sc, n_prob, cp_bonus = summary[i]
    if G > comp_sc:
        G -= comp_sc
        ans += n_prob
    else:
        score = [(s[2], s[3]) for s in summary[i:] if s[1] > G]
        remain = []
        for prob_sc, n_prob in score:
            if prob_sc * n_prob < G:
                remain.append(n_prob)
            else:
                counter = 0
                tmp = G
                while True:
                    tmp -= prob_sc
                    counter += 1
                    if tmp <= 0:
                        break
                remain.append(counter)
        ans += min(remain)
        break

print(ans)


Fixed submission:
from itertools import product

D, G = map(int, input().split())
probs = []
for _ in range(D):
    p, c = map(int, input().split())
    probs.append((p, c))
ans = 10**9
for choise in product([True, False], repeat=D):
    score = 0
    solved_probs = 0
    max_score_rem_id = 0
    for i, solve in enumerate(choise):
        if solve:
            score += probs[i][0]*(100*(i+1)) + probs[i][1]
            solved_probs += probs[i][0]
        else:
            max_score_rem_id = i
    if score < G:
        remain = G - score
        to_be_solved = (remain - 100) // (100*(max_score_rem_id+1)) + 1
        if to_be_solved < probs[max_score_rem_id][0]:
            solved_probs += to_be_solved
        else:
            continue
    ans = min(ans, solved_probs)
print(ans)
Buggy python submission (verdict: Runtime Error):
K = int(input())

if K < 10:
    num_list = [i for i in range(1, K+1)]
    print(*num_list, sep='\n')
else:
    num_list = [i for i in range(1, 10)]
    n = 19
    digits = 2
    while len(num_list) < K:
        num_list.append(n)
        if str(n+1)[0] > 3:
            digits += 1
        n += 10**(digits - 1)
    print(*num_list, sep='\n')

Fixed submission:
def digit_sum(number):
    ans = 0
    for n in str(number):
        ans += int(n)
    return ans

def obj_func(number):
    return number/digit_sum(number)

K = int(input())
num_list = []
d = 1
n = 1

for i in range(K):
    num_list.append(n)
    if obj_func(n + 10**(d-1)) > obj_func(n + 10**d):
        d += 1
    n += 10**(d-1)

print(*num_list, sep='\n')
Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if max(A, B) <= 8:
    print("Yay!")
else:
    print(":(")

Fixed submission:
A, B = map(int, input().split())

if max(A, B) <= 8:
    print("Yay!")
else:
    print(":(")

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if max(A, B) <= 8:
    print("Yay!")
else:
    print(":(")
    

Fixed submission:
A, B = map(int, input().split())

if max(A, B) <= 8:
    print("Yay!")
else:
    print(":(")

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())

if max(A, B) <= 8:
    print("Yay!")
else:
    print(":(")
    

Fixed submission:
A, B = map(int, input().split())

if max(A, B) <= 8:
    print("Yay!")
else:
    print(":(")
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
A = list(map(int, input().split()))

xor_cumsum = [0]
cumsum = [0]

for a in A:
    xor_cumsum.append(xor_cumsum[-1] ^ a)
    cumsum.append(cumsum[-1] + a)

counter = 0

for tpl in itertools.combinations(range(N+1), 2):
    if xor_cumsum[tpl[1]] ^ xor_cumsum[tpl[0]] == cumsum[tpl[1]] - cumsum[tpl[0]]:
        counter += 1

print(counter)


Fixed submission:
N = int(input())
A = list(map(int, input().split()))

r = 0
std_sum = 0 # standard summation
xor_sum = 0 # xor summation
count = 0

for l in range(N):
    while (r != N and std_sum + A[r] == xor_sum ^ A[r]):
        std_sum += A[r]
        xor_sum ^= A[r]
        r += 1
 
    count += r - l
    std_sum -= A[l]
    xor_sum ^= A[l]
 
print(count)
Buggy python submission (verdict: Runtime Error):
N = int(input())
A = [int(input()) for _ in range(N)]
if any(a - b > 1for a, b in zip(A, [-1]+A)): print(-1)
else:
    ans = 0
    for a, nxt in zip(A, A[1:]+[0]):
        if a >= nxt:
            ans += a
print(ans)

Fixed submission:
N = int(input())
A = [int(input()) for _ in range(N)]
if any(a - b > 1for a, b in zip(A, [-1]+A)): print(-1)
else:
    ans = 0
    for a, nxt in zip(A, A[1:]+[0]):
        if a >= nxt:
            ans += a
    print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools
import math


def get_primes(x):
    if x < 2:
        return []

    primes = [i for i in range(x)]
    primes[1] = 0

    for prime in primes:
        if prime > math.sqrt(x):
            break
        if prime == 0:
            continue
        for non_prime in range(2 * prime, x, prime):
            primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]


N = int(input())
primes = get_primes(55555)
ans = []

while len(ans) < N:
    p = primes[i]
    
    if p % 5 == 1:
        ans.append(p)

    i += 1

print(*ans)

Fixed submission:
import itertools
import math


def get_primes(x):
    if x < 2:
        return []

    primes = [i for i in range(x)]
    primes[1] = 0

    for prime in primes:
        if prime > math.sqrt(x):
            break
        if prime == 0:
            continue
        for non_prime in range(2 * prime, x, prime):
            primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]


N = int(input())
primes = get_primes(55555)
ans = []
i = 4

while len(ans) < N:
    p = primes[i]
    
    if p % 5 == 1:
        ans.append(p)

    i += 1

print(*ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
import math


def get_primes(x):
    if x < 2:
        return []

    primes = [i for i in range(x)]
    primes[1] = 0

    for prime in primes:
        if prime > math.sqrt(x):
            break
        if prime == 0:
            continue
        for non_prime in range(2 * prime, x, prime):
            primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]


N = int(input())
primes = get_primes(100000)
ans = primes[:5]
i = 5

while len(ans) < N:
    p = primes[i]
    cand = itertools.combinations(ans, 4)
    admissible = True
    
    for c in cand:
        if sum(c) + p in primes:
            admissible = False
            break
    
    if admissible:
        ans.append(p)

    i += 1

print(*ans)

Fixed submission:
import itertools
import math


def get_primes(x):
    if x < 2:
        return []

    primes = [i for i in range(x)]
    primes[1] = 0

    for prime in primes:
        if prime > math.sqrt(x):
            break
        if prime == 0:
            continue
        for non_prime in range(2 * prime, x, prime):
            primes[non_prime] = 0

    return [prime for prime in primes if prime != 0]


N = int(input())
primes = get_primes(55555)
ans = []
i = 4

while len(ans) < N:
    p = primes[i]
    
    if p % 5 == 1:
        ans.append(p)

    i += 1

print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools

N = int(input())
table = [input() for _ in range(N)]

count = 0

for a, b in list(itertools.product(range(N), repeat = 2)):
    symmetric = True
    new_table = []
    for i in range(N):
        string = table[(i+a)%N][b:] + table[(i+a)%N][:b]
        new_table.append(string)
    
    for i in range(N-1):
        string1 = new_table[i][i+1:]
        string2 = ''.join([s[i] for s in new_table[i+1:]])
        if string1 != string2:
            symmetric = False
            break
    
    if symmetric:
        count += 1

print(count)

Fixed submission:
import itertools

N = int(input())
table = [input() for _ in range(N)]

count = 0

for b in range(N):
    symmetric = True
    new_table = []
    for i in range(N):
        string = table[i][b:] + table[i][:b]
        new_table.append(string)
    
    for i in range(N-1):
        string1 = new_table[i][i+1:]
        string2 = ''.join([s[i] for s in new_table[i+1:]])
        if string1 != string2:
            symmetric = False
            break
    
    if symmetric:
        count += N

print(count)
Buggy python submission (verdict: Time Limit Exceeded):
import statistics
 
N = int(input())
X = list(map(int, input().split()))
 
for i in range(len(X)):
    print(statistics.median(X[:i]+X[i+1:]))

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Y = X[:]
Y = sorted(Y)

med1 = Y[N // 2 - 1]
med2 = Y[N // 2]

for x in X:
    if x < med2:
        print(med2)
    else:
        print(med1)

Buggy python submission (verdict: Time Limit Exceeded):
import statistics

N = int(input())
X = list(map(int, input().split()))
sorted(X)

for i in range(len(X)):
    print(statistics.median(X[:i]+X[i+1:]))

Fixed submission:
N = int(input())
X = list(map(int, input().split()))
Y = X[:]
Y = sorted(Y)

med1 = Y[N // 2 - 1]
med2 = Y[N // 2]

for x in X:
    if x < med2:
        print(med2)
    else:
        print(med1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [0]
A += list(map(int, input().split()))
A += [0]

cost = [abs(A[i] - A[i+1]) for i in range(N+1)]

for i in range(N):
    ans = sum(cost[:i]+cost[i+2:])
    ans += abs(A[i] - A[i+2])
    print(ans)

Fixed submission:
N = int(input())
A = [0]
A += list(map(int, input().split()))
A += [0]

cost = [abs(A[i] - A[i+1]) for i in range(N+1)]
original_cost = sum(cost)

for i in range(N):
    ans = original_cost
    ans -= cost[i]
    ans -= cost[i+1]
    ans += abs(A[i] - A[i+2])
    
    print(ans)
Buggy python submission (verdict: Runtime Error):
A, B = map(int, input().split())
print(100, 100)
grid = [['#'] * 100 for _ in range(50)] + [['.'] * 100 for _ in range(50)]
A -= 1; B -= 1
i, j = 0, 0
while A:
    grid[i][j] = '.'; A -= 1
    if i % 2 == 0:
        if j == 98: i += 1; j = 1
        else: j += 2
    else:
        if j == 99: i += 1; j = 0
        else: j += 2
i, j = 51, 0
while B:
    grid[i][j] = '#'; B -= 1
    if i % 2 == 0:
        if j == 98: i += 1; j = 1
        else: j += 2
    else:
        if j == 99: i += 1; j = 0
        else: j += 2
for r in grid:
    print(''.join(r))

Fixed submission:
A, B = map(int, input().split())
print(100, 100)
grid = [['#'] * 100 for _ in range(50)] + [['.'] * 100 for _ in range(50)]
A -= 1; B -= 1
i, j = 0, 0
while A:
    grid[i][j] = '.'; A -= 1
    if j == 98: i += 2; j = 0
    else: j += 2
i, j = 51, 0
while B:
    grid[i][j] = '#'; B -= 1
    if j == 98: i += 2; j = 0
    else: j += 2
for r in grid:
    print(''.join(r))
Buggy python submission (verdict: Runtime Error):
 A, B, C= map(int, input().split())

if (A+B) >= C:
    print("Yes")
else:
    print("No")

Fixed submission:
A, B, C= map(int, input().split())

if (A+B) >= C:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdout
import random

def query(num):
    print(num)
    stdout.flush()
    return input()

N = int(input())

ans = [None]*(N-1)
minimum = 0
maximum = N-1

q = minimum
ans[q] = query(q)
if ans[q] != "Vacant":
    while True:
        if q == 0:
            q = maximum
            ans[q] = query(q)
            if ans[q] == "Vacant":
                break
        else:
            q = (minimum + maximum) // 2
            ans[q] = query(q)
            if ans[q] == "Vacant":
                break

            if ((q - 1) - minimum)%2 == 0 and ans[q-1] != ans[minimum]:
                maximum = q - 1
            elif ((q - 1) - minimum)%2 == 1 and ans[q-1] == ans[minimum]:
                maximum = q - 1
            elif (maximum - (q + 1))%2 == 0 and ans[maximum] != ans[q + 1]:
                minimum = q + 1
            elif (maximum - (q + 1))%2 == 1 and ans[maximum] == ans[q + 1]:
                minimum = q + 1

Fixed submission:
N = int(input())
 
def query(x):
    print(x, flush=True)
    response = input()
    if response == "Vacant":
        exit()
    return response
 
lb = 0
ub = N - 1

l_query = query(lb)
u_query = query(ub)

while True:
    m = (lb + ub) // 2
    m_query = query(m)
    if (m_query == l_query) == (m % 2 == lb % 2):
        lb = m
        l_query = m_query
    else:
        ub = m

Buggy python submission (verdict: Time Limit Exceeded):
from sys import stdout
import random

def query(num):
    print(num)
    stdout.flush()
    return input()

N = int(input())
first_query = query(0)
if first_query == "Vacant":
    print(0)

else:
    candidate = [i for i in range(2, N)][0::2]
    while True:
        idx　= random.choice(range(len(candidate)))
        candidate.pop(idx)
        q = query(candidate[idx]) 
        if q == "Vacant":
            print(candidate[idx])
            break
        elif q != first_query:
            cand = (candidate[idx] - 1) % N
            if query(cand) == "Vacant":
                print(cand)
            else:
                print((candidate[idx] + 1) % N)
            break

Fixed submission:
N = int(input())
 
def query(x):
    print(x, flush=True)
    response = input()
    if response == "Vacant":
        exit()
    return response
 
lb = 0
ub = N - 1

l_query = query(lb)
u_query = query(ub)

while True:
    m = (lb + ub) // 2
    m_query = query(m)
    if (m_query == l_query) == (m % 2 == lb % 2):
        lb = m
        l_query = m_query
    else:
        ub = m
Buggy python submission (verdict: Runtime Error):
import math

a, b = input().split()
n = int(a+b)

if math.abs(math.sqrt(n)**2 - n) < 1e-6:
    print("Yes")
else:
    print("No")

Fixed submission:
import math

a, b = input().split()
n = int(a+b)

m = int(math.sqrt(n))

if abs(m**2 - n) < 1e-6:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math

N, H = map(int, input().split())
A = []
B = []

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
A = A[::-1]
a_max = A[0]

B.sort()
B = B[::-1]

attack = 0
idx = 0

while B[idx] > a_max:
    H -= B[idx]
    attack += 1
    idx += 1
    if H <= 0:
        print(attack)
        break

if H > 0:
    attack += math.ceil(H / a_max)
    print(attack)

Fixed submission:
import math

N, H = map(int, input().split())
A = []
B = []

for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

a_max = max(A)

B = sorted([x for x in B if x > a_max], reverse = True)

attack = 0

for damage in B:
    H -= damage
    attack += 1
    if H <= 0:
        break

if H > 0:
    attack += math.ceil(H / a_max)

print(attack)

Buggy python submission (verdict: Runtime Error):
N, H = map(int, input().split())
A = []
B = []

for i in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

A.sort()
A = A[::-1]
a_max = A[0]

B.sort()
B = B[::-1]

attack = 0
idx = 0

while B[idx] > a_max:
    H -= B[idx]
    attack += 1
    idx += 1
    if H <= 0:
        print(attack)
        break

if H > 0:
    attack += (H // a_max) + 1
    print(attack)

Fixed submission:
import math

N, H = map(int, input().split())
A = []
B = []

for _ in range(N):
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)

a_max = max(A)

B = sorted([x for x in B if x > a_max], reverse = True)

attack = 0

for damage in B:
    H -= damage
    attack += 1
    if H <= 0:
        break

if H > 0:
    attack += math.ceil(H / a_max)

print(attack)
Buggy python submission (verdict: Runtime Error):
# スペース区切りの整数の入力
N = int(input())
C = []
S = []
F = []

for i in range(N-1):
    c, s, f= map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

for i in range(N-1):
    time = 0
    for j in range(i, N-1):
        if time < S[j]:
            time = S[j]
        else:
            if time % F[j] != 0:
                time += F[j] - (time % F[j])
        time += C[j]
    print(t)
    
print(0)

Fixed submission:
# スペース区切りの整数の入力
N = int(input())
C = []
S = []
F = []

for i in range(N-1):
    c, s, f= map(int, input().split())
    C.append(c)
    S.append(s)
    F.append(f)

for i in range(N-1):
    time = 0
    for j in range(i, N-1):
        if time < S[j]:
            time = S[j]
        else:
            if time % F[j] != 0:
                time += F[j] - (time % F[j])
        time += C[j]
    print(time)
    
print(0)
Buggy python submission (verdict: Runtime Error):
# スペース区切りの整数の入力
x, y= map(int, input().split())

lst = []

num = x

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

print(len(lst))

Fixed submission:
# スペース区切りの整数の入力
a, b, c, d= map(int, input().split())

left = a + b
right = c + d

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