Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02801 (python)

Fixed submission:
l = input()

print(chr(ord(l)+1))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())

P = list()
for m in range(M):
    n, rst = input().split()
    n = int(n)
    P.append( (n, rst) )


ck = [False for _ in range(N+1)]

ret_cor, ret_pen = 0, 0

for n, rst in P:
    if rst == 'AC':
        if not ck[n]:
            ck[n] = True
            ret_cor += 1

    else: # rst == 'WA'
        if not ck[n]:
            ret_pen += 1

print(ret_cor, ret_pen)
Problem p02812 (python)

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

ret = 0

for i in range(0, N-2):
    if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C':
        ret += 1

print(ret)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = input()

ret = 0

for i in range(N):
    if S[i] == 'A' and S[i+1] == 'B' and S[i+2] == 'C':
        ret += 1

print(ret)
Problem p03076 (python)

Fixed submission:
# TODO B - Five Dishes
# https://atcoder.jp/contests/abc123/tasks/abc123_b

NUM_DISHES = 5
intervals = list()

total_time = 0
for i in range(NUM_DISHES):
    serve_time = int(input())
    total_time += serve_time

    if serve_time % 10 == 0:
        intervals.append(0)
    else:
        intervals.append(10 - serve_time % 10)

intervals.sort()

for interval in range(len(intervals) - 1):
    total_time += intervals[interval]

print "{:d}".format(total_time)

Buggy submission (verdict: Runtime Error):
# Five Dishes
# https://atcoder.jp/contests/abc123/tasks/abc123_b

NUM_DISHES = 5
tt = 0
itvs = list()

for i in range(NUM_DISHES):
    st = int(input())
    tt += st
    if st % 10 == 0:
        itvs.append(0)
    else:
        itvs.append(10 - serve_time % 10)

itvs.sort()

for interval in range(len(itvs) - 1):
    tt += itvs[interval]

print "{}".format(tt)

Buggy submission (verdict: Runtime Error):
# Five Dishes
# https://atcoder.jp/contests/abc123/tasks/abc123_b

NUM_DISHES = 5
tt = 0
itvs = list()

for i in range(NUM_DISHES):
    st = int(input())
    tt += st
    if st % 10 == 0:
        itvs.append(0)
    else:
        itvs.append(10 - serve_time % 10)

itvs.sort()

for interval in range(len(itvs) - 1):
    tt += itvs[interval]

print "{}".format(tt)
Problem p03078 (python)

Fixed submission:
#abc123d
 
x,y,z,k=map(int,raw_input().split())
a=sorted(map(int,raw_input().split()),reverse=True)
b=sorted(map(int,raw_input().split()),reverse=True)
c=sorted(map(int,raw_input().split()),reverse=True)
 
ab=sorted([i+j for i in a for j in b],reverse=True)
res=sorted([ij+l for ij in ab[:k] for l in c],reverse=True)
for i in res[:k]:
	print i

Buggy submission (verdict: Runtime Error):
# TODO D - Cake 123
# https://atcoder.jp/contests/abc123/tasks/abc123_d

X, Y, Z, K = map(int, raw_input().split())

A = sorted(int(x) for x in raw_input().split(), reverse=True)
B = sorted(int(y) for y in raw_input().split(), reverse=True)
C = sorted(int(z) for z in raw_input().split(), reverse=True)

AB = sorted([a+b for a in A for b in B], reverse=True)
ABC = sorted([ab + c for ab in AB[:K] for c in C], reverse=True)

for i in ABC[:K]:
    print '{}'.format(i)

Buggy submission (verdict: Runtime Error):
#abc123d
 
x,y,z,k=map(int,raw_input().split())
a=sorted(map(int,raw_input().split()),reverse=True)
b=sorted(map(int,raw_input().split()),reverse=True)
c=sorted(map(int,raw_input().split()),reverse=True)
 
ab=sorted([i+j for i in a for j in b],reverse=True)
res=sorted([ij+l for ij in ab[:k] for l in c],reverse=True)
for i in res[:k]:
	print i

Buggy submission (verdict: Runtime Error):
#abc123d
 
x,y,z,k=map(int,raw_input().split())
a=sorted(map(int,raw_input().split()),reverse=True)
b=sorted(map(int,raw_input().split()),reverse=True)
c=sorted(map(int,raw_input().split()),reverse=True)
 
ab=sorted([i+j for i in a for j in b],reverse=True)
res=sorted([ij+l for ij in ab[:k] for l in c],reverse=True)
for i in res[:k]:
 print i

Buggy submission (verdict: Runtime Error):
import itertools


X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

AB = [a + b for (a, b) in list(itertools.product(A, B))]
AB.sort(reverse=True)
ans = [ab + c for (ab, c) in list(itertools.product(AB[:min(3000, X*Y*Z)], C))]
ans.sort(reverse=True)
for i in range(K):
    print(ans[i])
Problem p03106 (python)

Fixed submission:
# B - K-th Common Divisor
# https://atcoder.jp/contests/abc120/tasks/abc120_b
# 1WA
MAX = 100

def gcd(m, n):
    return m if n == 0 else gcd(n, m % n)

A, B, K = map(int, raw_input().split())
gcdAB = gcd(A, B)

cnt = 0
for n in range(gcdAB, 0, -1):
    if gcdAB % n == 0:
        cnt += 1
        if cnt == K:
            print '{}'.format(n)
            break

Buggy submission (verdict: Runtime Error):
# B - K-th Common Divisor
# https://atcoder.jp/contests/abc120/tasks/abc120_b
# 1WA
import math

MAX = 100

def gcd(m, n):
    return m if n == 0 else gcd(n, m % n)

prime_table = [True]*MAX
prime_table[0] = prime_table[1] = False
for i in range(2, int(math.sqrt(MAX)) + 1):
    for j in range(i*2, MAX, i):
        prime_table[j] = False
primes = [i_idx for i_idx in range(len(prime_table)) if prime_table[i_idx] == True]

A, B, K = map(int, raw_input().split())
gcdAB = gcd(A, B)

factors = set()
factors.add(gcdAB)
factors.add(1)

for prime in primes:
    if prime > gcdAB:
        break
    if gcdAB % prime == 0:
        factors.add(prime)
        factors.add(gcdAB/prime)

factors = list(factors)
factors.sort(reverse=True)

print '{}'.format(factors[K - 1])

Buggy submission (verdict: Runtime Error):
# B - K-th Common Divisor
# https://atcoder.jp/contests/abc120/tasks/abc120_b
import math

MAX = 100

def gcd(A, B):
    if B > A:
        A, B = A, B

    if B == 0:
        return A

    return gcd(B, A-(A/B)*B)

prime_table = [True]*MAX
prime_table[0] = prime_table[1] = False
for i in range(2, int(math.sqrt(MAX)) + 1):
    for j in range(i*2, MAX, i):
        prime_table[j] = False
primes = [i_idx for i_idx in range(len(prime_table)) if prime_table[i_idx] == True]

A, B, K = map(int, raw_input().split())
gcdAB = gcd(A, B)
factors = set()
factors.add(gcdAB)
factors.add(1)

for prime in primes:
    if prime > gcdAB:
        break
    if gcdAB % prime == 0:
        factors.add(prime)
        factors.add(gcdAB/prime)

factors = list(factors)
factors.sort(reverse=True)

print '{}'.format(factors[K - 1])
Problem p03109 (python)

Fixed submission:
# A - Still TBD
# https://atcoder.jp/contests/abc119/tasks/abc119_a

# threshold
TY, TM, TD = 2019, 4, 30

Y, M, D = map(int, raw_input().split('/'))

if M > 4:
    print '{}'.format('TBD')
else:
    print '{}'.format('Heisei')

Buggy submission (verdict: Runtime Error):
# A - Still TBD
# https://atcoder.jp/contests/abc119/tasks/abc119_a

# threshold
TY, TM, TD = 2019, 4, 30

Y, M, D = map(int, raw_input().split('/'))

if M > 4:
    print '{}'.format('TBD')
else:
    print '{}'.foramt('Heisei')
Problem p03125 (python)

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

if B%A == 0:
    print '{}'.format(A+B)
else: # B%A != 0
    print '{}'.format(B-A)

Buggy submission (verdict: Runtime Error):
A, B = map(int, raw_input().split())

if B%A == 0:
    print '{}'.format('A+B')
else: # B%A != 0
    print '{}'.format('B−A')
Problem p02705 (python)

Fixed submission:
import math

r = int(input())

print(2*math.pi*r)

Buggy submission (verdict: Runtime Error):
n = int(input())

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

for i in range(n):
    print(A.count(i+1))
Problem p02801 (python)

Fixed submission:
C = input()
print(chr(ord(C) + 1))

Buggy submission (verdict: Runtime Error):
N,K,M =  map(int,input().split())
A =  list(map(int,input().split()))

result = N*M - sum(A) 
if result > K:
    print("-1")
elif result <=0:
    print("0")
else:
    print(result)
Problem p02811 (python)

Fixed submission:
K,X = map(int,input().split())
if K*500 >= X:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
K X = map(int,input().split())
if K*500 > X:
    print(Yes)
else:
    print(No)
Problem p02813 (python)

Fixed submission:
import itertools

N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))

r = list(itertools.permutations(range(1,N+1)))

print(abs(r.index(P)-r.index(Q)))

Buggy submission (verdict: Runtime Error):
import itertools

N = int(input())
P = list(map(int,input().split()))
Q = list(map(int,input().split()))

r = list(itertools.permutations(range(1,N+1)))

print(abs(r.index(P)-r.index(Q)))
Problem p02755 (python)

Fixed submission:
a,b=map(int,input().split())
for i in  range(1,1300):
  if int(i*0.08)==a and int(i*0.1)==b:
    print(i)
    exit()
print(-1)

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())

before_A = A/0.08
before_B = B/0.1

if A > B:
    print(-1)
    break
else:
    if before_A <= before_B:
        ans = before_B
        if int(before_B * 0.08) == A:
            print(int(ans))
        else:
            print(-1)
    else:
        ans = before_A
        if int(before_A * 0.1) == B:
            print(int(ans))
        else:
            print(-1)
Problem p02639 (python)

Fixed submission:
x = list(map(int, input().split()))
print(x.index(0) + 1)

Buggy submission (verdict: Runtime Error):
import heapq

n, q = map(int, input().split())
children = []  # (-レート, 幼稚園番号)
schools = [[] for _ in range(200000)]  # [(-レート, 子供番号)]
strongests = []  # (+レート, 幼稚園番号)

for i in range(n):
    a, b = map(int, input().split())
    b -= 1
    children.append((-a, b))
    schools[b].append((-a, i))

for i, school in enumerate(schools):
    if len(school) > 0:
        heapq.heapify(school)
        strongests.append((-school[0][0], i))
heapq.heapify(strongests)

for _ in range(q):
    c, d = map(int, input().split())
    c -= 1
    d -= 1
    org_school = children[c][1]
    children[c] = (children[c][0], d)

    while True:
        if len(schools[org_school]) == 0:
            break
        if children[schools[org_school][0][1]][1] == org_school:
            break
        else:
            heapq.heappop(schools[org_school])
    if len(schools[org_school]) > 0:
        heapq.heappush(strongests, (-schools[org_school][0][0], org_school))

    heapq.heappush(schools[d], (children[c][0], c))
    heapq.heappush(strongests, (-schools[d][0][0], d))

    while True:
        if len(schools[strongests[0][1]]) == 0 or strongests[0][0] != -schools[strongests[0][1]][0][0]:
            heapq.heappop(strongests)
        else:
            print(strongests[0][0])
            break
Problem p02698 (python)

Fixed submission:
import bisect
import sys
sys.setrecursionlimit(1000000)

input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))

tree = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v = map(int, input().split())
    tree[u - 1].append(v - 1)
    tree[v - 1].append(u - 1)

ans = [0] * n
visited = [0] * n
visited[0] = 1
l = []

def dfs(i):
    s = a[i]
    pi = -1
    pv = -1
    if len(l) == 0 or s > l[-1]:
        l.append(s)
    else:
        pi = bisect.bisect_left(l, s)
        pv = l[pi]
        l[pi] = s
    ans[i] = len(l)

    for ni in tree[i]:
        if not visited[ni]:
            visited[ni] = 1
            dfs(ni)
            
    if pi == -1:
        l.pop()
    else:
        l[pi] = pv


dfs(0)

for i in ans:
    print(i)

Buggy submission (verdict: Runtime Error):
import bisect
import sys
input = sys.stdin.readline

n = int(input())
a = list(map(int, input().split()))

tree = [[] for _ in range(n)]
for _ in range(n - 1):
    u, v = map(int, input().split())
    tree[u - 1].append(v - 1)
    tree[v - 1].append(u - 1)

ans = [0] * n
visited = [0] * n
visited[0] = 1


def dfs(i, l):
    s = a[i]
    if len(l) == 0 or s > l[-1]:
        l.append(s)
    else:
        l[bisect.bisect_left(l, s)] = s
    ans[i] = len(l)

    for ni in tree[i]:
        if not visited[ni]:
            visited[ni] = 1
            dfs(ni, l[:])


dfs(0, [])

for i in ans:
    print(i)
Problem p02727 (python)

Fixed submission:
import sys
input = sys.stdin.readline

x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())))
q = sorted(list(map(int, input().split())))
r = sorted(list(map(int, input().split())))

n = 0
np = 0
nq = 0
ans = 0
while n < x + y:
    cs = []
    if p and np < x:
        cs.append(p[-1])
    if q and nq < y:
        cs.append(q[-1])
    if r:
        cs.append(r[-1])
    m = max(cs)
    if r and m == r[-1]:
        ans += r.pop()
    elif p and m == p[-1]:
        ans += p.pop()
        np += 1
    else:
        ans += q.pop()
        nq += 1
    n += 1

print(ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline

x, y, a, b, c = map(int, input().split())
p = sorted(list(map(int, input().split())))
q = sorted(list(map(int, input().split())))
r = sorted(list(map(int, input().split())))

n = 0
np = 0
nq = 0
ans = 0
while n < x + y:
    cs = []
    if p and np < x:
        cs.append(p[-1])
    if q and nq < y:
        cs.append(q[-1])
    if r:
        cs.append(r[-1])
    m = max(cs)
    if m == r[-1]:
        ans += r.pop()
    elif m == p[-1]:
        ans += p.pop()
        np += 1
    else:
        ans += q.pop()
        nq += 1
    n += 1

print(ans)
Problem p02734 (python)

Fixed submission:
n, s = map(int, input().split())
a = list(map(int, input().split()))
mod = 998244353

dp = [[0 for _ in range(s + 1)] for j in range(n + 1)]
dp[0][0] = 1

ans = 0
for i in range(n):
    for j in range(s + 1):
        dp[i + 1][j] += dp[i][j]
        if j >= a[i]:
            if j == a[i]:
                dp[i + 1][j] += i + 1
            else:
                dp[i + 1][j] += dp[i][j - a[i]]
    ans += dp[i + 1][s]
    ans %= mod
print(ans)

Buggy submission (verdict: Runtime Error):
n, s = map(int, input().split())
a = list(map(int, input().split()))

dp = [[0 for _ in range(s + 1)] for j in range(n + 1)]
dp[0][0] = 1

ans = 0
for i in range(n):
    for j in range(s + 1):
        dp[i + 1][j] += dp[i][j]
        if j >= a[i]:
            if j == a[i]:
                dp[i + 1][j] += i + 1
            else:
                dp[i + 1][j] += dp[i][j - a[i]]
    ans += dp[i + 1][s]
    ans %= mod
print(ans)
Problem p03438 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = 0
b = 0
for i in range(N):
    if B[i] >= A[i]:
        a += (B[i] - A[i] + 1) // 2
        b += (B[i] - A[i]) % 2
    else:
        b += A[i] - B[i]
print('Yes' if a >= b else 'No')

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a = 0
b = 0
for i in range(N):
    if B[i] >= A[i]:
        a += (B[i] - A[i] + 1) // 2
        b += (B[i] - A[i]) % 2
    else:
        b += A[i] - bytes[i]
print('Yes' if a >= b else 'No')
Problem p03480 (python)

Fixed submission:
import sys

S = input()
center = len(S) // 2

if len(S) % 2 == 1:
    b = S[center]
    for i in range(1, center + 1):
        if S[center + i] != b or S[center - i] != b:
            print(center + i)
            sys.exit()
else:
    b = S[center - 1]
    for i in range(center):
        if S[center - 1 - i] != b or S[center + i] != b:
            print(center + i)
            sys.exit()
print(len(S))

Buggy submission (verdict: Runtime Error):
import sys

S = input()
center = len(S) // 2
b = S[center]

if len(S) % 2 == 1:
    for i in range(1, center + 1):
        if S[center + i] != b or S[center - i] != b:
            print(center + i)
            sys.exit()
else:
    for i in range(center + 1):
        if S[center - i] != b or S[center + 1 + i] != b:
            print(center)
            sys.exit()
Problem p03550 (python)

Fixed submission:
N, Z, W = map(int, input().split())
a = [int(n) for n in input().split()]

if N == 1:
    ans = abs(a[-1] - W)
else:
    ans = max(abs(a[-1] - W), abs(a[-1] - a[-2]))
print(ans)

Buggy submission (verdict: Runtime Error):
N, Z, W = map(int, input().split())
a = [int(n) for n in input().split()]
b = a.pop()
max = 0
if nota == []:
    for n in a:
        if abs(n - b) > max:
            max = abs(n - b)
if abs(n - Z) > max:
    max = abs(n - Z)
if abs(n - W) > max:
    max = abs(n - W)

print(max)
Problem p03561 (python)

Fixed submission:
import math


def main(K, N):
    ans = []

    if K % 2 == 0:
        for i in range(N):
            if i == 0:
                ans.append(K // 2)
            else:
                ans.append(K)
    elif K == 1:
        n2 = math.ceil(N / 2)
        for i in range(n2):
            ans.append(1)
    else:
        K2 = math.ceil(K / 2)
        ans = [K2] * N
        n = N // 2
        for i in range(n):
            if ans[-1] == 1:
                ans.pop()
            else:
                ans[-1] -= 1
                while len(ans) < N:
                    ans.append(K)

    return ' '.join(map(str, ans))


K, N = map(int, input().split())
print(main(K, N))

Buggy submission (verdict: Runtime Error):
import math

K, N = map(int, input().split())
ans = []

if K % 2 == 0:
    for i in range(N):
        if i == 0:
            ans[i] = K // 2
        else:
            ans[i] = K
elif K == 1:
    n2 = math.ceil(N / 2)
    for i in range(n2):
        ans.append(1)
else:
    K2 = math.ceil(K / 2)
    n2 = math.floor(N / 2)
    ans = [K2] * N
    i = 0
    nx = 0
    last = True
    while n2 > 0:
        i += 1
        ans[N - i] = max(K2 - n2 % (K + 1) - nx, 0)
        if ans[N - i] == 0 and last:
            ans.pop()
        else:
            last = False
        n2 //= K + 1
        if K2 - n2 % (K + 1) - nx < 0:
            nx = 1
        else:
            nx = 0

print(' '.join(map(str, ans)))
Problem p03567 (python)

Fixed submission:
s = input()
found = False
for i in range(len(s)-1):
    if s[i] == 'A' and s[i+1] == 'C':
        print('Yes')
        found = True
        break
if not found:
    print('No')

Buggy submission (verdict: Runtime Error):
import string

ALPHABETS = string.ascii_lowercase

s = input()
N = len(s)
MAX = 2 * 10 ** 5
a = [0] * (N + 1)
for i, c in enumerate(s):
    idx = ALPHABETS.index(c)
    a[i+1] = a[i] ^ (2 ** idx)

opt = [0] * (N + 1)
dp = {}
dp[0] = 0
for i in range(1, N + 1):
    dp[a[i]] = min(dp.get(a[i], MAX), min([dp.get(a[i] ^ 2 ** j, MAX) if not j == -1 else dp.get(a[i] ^ 0, MAX) for j in range(-1, 26)]) + 1)

print(dp[a[N]] if dp[a[N]] != 0 else 1)

Buggy submission (verdict: Runtime Error):
import string

ALPHABETS = string.ascii_lowercase


def is_avairable(a):
    return bin(a).count('1') <= 1

s = input()
N = len(s)
a = [0] * (N + 1)
for i, c in enumerate(s):
    idx = ALPHABETS.index(c)
    a[i+1] = a[i] ^ (2 ** idx)

opt = [0] * (N + 1)
dp = [2 * (10 ** 5) + 1] * (2 ** 26)
dp[0] = 0
for i in range(1, N + 1):
    ns = [dp[a[i] ^ 2 ** j] if not j == -1 else dp[a[i] ^ 0] for j in range(-1, 26)]
    mn = min(ns)
    opt[i] = mn + 1
    if dp[a[i]] > opt[i]:
        dp[a[i]] = opt[i]

print(opt[N])
Problem p02789 (python)

Fixed submission:
a,b=map(int,input().split())
if a==b:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a,b=map(input().split())
if a==b:
    print("Yes")
else:
    print("No")
Problem p02957 (python)

Fixed submission:
a,b=map(int,input().split())
if (a+b)%2==0:
    print((a+b)//2)
else:
    print("IMPOSSIBLE")

Buggy submission (verdict: Runtime Error):
a,b=int(input())
if (a+b)%2==0:
    print((a+b)/2)
else:
    print("IMPOSSIBLE")
Problem p03080 (python)

Fixed submission:
a=int(input())
s=list(input())
x=s.count("R")
y=a-x
if x>y:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
s=input()
s=s.count(R)
if a-s<s:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
s=char(input())
r=s.count(R)
if a-r<r:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
s=input()
r=s.count(R)
if a-r<r:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
s=input()
x=s.count(R)
y=a-x
if x>y:
    print("Yes")
else:
    print("No")
Problem p03206 (python)

Fixed submission:
a=int(input())
a=25-a
print("Christmas ", end="")
for i in range(a):
  print("Eve ", end="")

Buggy submission (verdict: Runtime Error):
a=int(input())
a=25-a
print("Christmas ", end="")
for i in a:
  print("Eve ", end="")
Problem p03351 (python)

Fixed submission:
a,b,c,d=map(int,input().split())
if abs(b-a)<=d and abs(c-b)<=d or abs(c-a)<=d:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a = input()
b = input()
c = input()
d = input()

a = int(a)
b = int(b)
c = int(c)
d = int(d)

n = b - a
m = c - b

if (n <= d)and(m <= d):
    print("Yes")
else:
    print("No")
Problem p03433 (python)

Fixed submission:
a=int(input())
b=int(input())
c=a%500
if b>=c:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
c=a%500
if b>=c:
    print(Yes)
else:
    print(No)
Problem p03447 (python)

Fixed submission:
a=int(input())
b=int(input())
c=int(input())
print((a-b)%c)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
print((a-b)%c)
Problem p03477 (python)

Fixed submission:
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")

Buggy submission (verdict: Runtime Error):
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")
Problem p02614 (python)

Fixed submission:
import copy
h,w,k=map(int, input().split())
mat = []
for i in range(h):
  s = list(input())
  mat.append(s)
total = 0
for y in range(2**h):
  for x in range(2**w):
    mat2 = copy.deepcopy(mat)
    y_bin = bin(y)[2:].zfill(h)
    x_bin = bin(x)[2:].zfill(w)
    # print(y_bin, x_bin)
    for r in range(len(y_bin)):
      if y_bin[r] == "1":
        for c in range(w):
          mat2[r][c] = "."
    for c in range(len(x_bin)):
      if x_bin[c] == "1":
        for r in range(h):
          mat2[r][c] = "."
    count = 0
    for r in range(h):
      for c in range(w):
        if mat2[r][c] == "#":
          count += 1
          # print(r, c)
    if count == k:
      total += 1
print(total)

Buggy submission (verdict: Runtime Error):
h,w,k=map(int, input().split())
mat = []
for i in range(h):
  s = input()
  mat.append(s)
total = 0
for y in range(2**h):
  for x in range(2**w):
    mat2 = mat.copy()
    y_bin = bin(y)[2:]
    x_bin = bin(x)[2:]
    for r in y_bin:
      if r == "1":
        mat2[r] = "."*w
    for c in x_bin:
      if c == "1":
        for r in range(h):
          mat2[r][c] = "."
    count = 0
    for r in range(h):
      for c in range(w):
        if mat2[r][c] == "#":
          count += 1
    if count == k:
      total += 1
print(total)