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

Fixed submission:
import math
n=int(input())
print(math.ceil(n/2)/n)

Buggy submission (verdict: Runtime Error):
a,b=[int(x) for x in input().split()]
i=1
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
g=gcd(a,b)
l=[]
while(i*i<=g):
    if g%i==0 and i*i!=g:
        l.append(i)
        l.append(g//i)
    if i*i==g:
        l.append(i)
    i=i+1
l=sorted(l)
i=1
while(i<len(l)):
    if l[i]!=0:
        j=i+1
        while(j<len(l)):
            if l[j]%l[i]==0:
                l[j] = 0
            j=j+1
    i=i+1
l=list(filter ( lambda x:x!=0,l))
print(len(l))

Buggy submission (verdict: Runtime Error):

a,b=[int(x) for x in input().split()]
i=1
def gcd(a,b):
  a,b=max(a,b),min(a,b)
  if a%b==0:
    return b
  else:
    return gcd(b,a%b)
g=gcd(a,b)
l=[]
while(i*i<=g):
    if g%i==0 and i*i!=g:
        l.append(i)
        l.append(g//i)
    if i*i==g:
        l.append(i)
    i=i+1
l=sorted(l)
i=1
while(i<len(l)):
    if l[i]!=0:
        j=i+1
        while(j<len(l)):
            if l[j]%l[i]==0:
                l[j] = 0
            j=j+1
    i=i+1
l=list(filter ( lambda x:x!=0,l))
print(len(l))
Problem p03317 (python)

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

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

min_idx = A.index(min(A))

if K >= N:
    print(1)
else:
    if ((N-1)%(K-1) == 0):
        print((N - 1)// (K - 1))
    else:
        print((N - 1) // (K - 1) + 1)

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

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

min_idx = A.index(min(A))

if K >= N:
    print(1)
else:
    if (n-1)%(k-1):
        print((N - 1) // (K - 1) + 1)
    else:
        print((N - 1)// (K - 1))
Problem p03327 (python)

Fixed submission:
# -*- coding: utf-8 -*-
def margin0(n):
    if n < 10:
        return "00{}".format(n)
    elif n < 100:
        return "0{}".format(n)
    elif n < 1000:
        return "".format(n%1000)
    else:
        return "{}".format(n%1000 - 1)
n = int(input())
# print(n)
name = ""
if n < 1000:
    name = "ABC{}".format(margin0(n))
else:
    name = "ABD{}".format(margin0(n))
print(name[:3])

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

difference = b - a
rtn = sum(range(1, difference + 1))
print(rtn - b)

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

difference_a_b = b - a
rtn = 0
for i in range(difference_a_b):
    rtn += i+1
print(rtn - b)

Buggy submission (verdict: Runtime Error):
def poll_height(n):
    rtn = 0 
    for i in range(n + 1): 
        rtn += i
    return rtn 

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

difference_a_b = b - a 
print(poll_height(difference_a_b) - b)

Buggy submission (verdict: Runtime Error):
#def poll_height(n):
#    if n:
#        return n + poll_height(n - 1)
#    else:
#        return 1 

def poll_height(n):
    rtn = 0 
    for i in range(n + 1): 
        rtn += i
    return rtn 

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

difference_a_b = b - a 
print(poll_height(difference_a_b) - b)

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10000)

def poll_height(n):
    if n:
        return n + poll_height(n - 1)
    else:
        return 1

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

difference_a_b = b - a
print(poll_height(difference_a_b) - b)

Buggy submission (verdict: Runtime Error):
# -*- coding: utf-8 -*-
def margin0(n):
    if n < 10:
        return "00{}".format(n)
    elif n < 100:
        return "0{}".fomrat(n)
    elif n < 1000:
        return "".format(n%1000)
    else:
        return "{}".format(n%1000 - 1)
n = int(input())
# print(n)
name = ""
if n < 1000:
    name = "ABC{}".format(margin0(n))
else:
    name = "ABD{}".format(margin0(n))
print(name[:3])

Buggy submission (verdict: Runtime Error):
def margin0(n):
    if n < 10:
        return "00{}".format(n)
    elif n < 100:
        return "0{}".fomrat(n)
    elif n < 1000:
        return "".format(n%1000)
    else:
        return "{}".format(n%1000 - 1)
n = int(input())
# print(n)
name = ""
if n < 1000:
    name = "ABC{}".format(margin0(n))
else:
    name = "ABD{}".format(margin0(n))
print(name)

Buggy submission (verdict: Runtime Error):
def margin0(n):
    if n < 10:
        return f"00".format(n)
    elif n < 100:
        return "0{}".fomrat(n)
    elif n < 1000:
        return "".format(n%1000)
    else:
        return "{}".format(n%1000 - 1)
n = int(input())
# print(n)
name = ""
if n < 1000:
    name = "ABC{}".format(margin0(n))
else:
    name = "ABD{}".format(margin0(n))
print(name)
Problem p02847 (python)

Fixed submission:
yobi = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
yobi.reverse()
s = input()
for i in range(7):
  if s == yobi[i]:
    print(i+1)

Buggy submission (verdict: Runtime Error):
yobi = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
yobi = yobi.reverse()
s = input()
for i in range(7):
  if s == yobi[i]:
    print(i+1)

Buggy submission (verdict: Runtime Error):
yobi = ["SUN","MON","TUE","WED","THU","FRI","SAT"]
yobi = yobi.reverse
s = input()
for i in range(7):
  if s == yobi[i]:
    print(i+1)

Buggy submission (verdict: Runtime Error):
yobi = [MON,TUE,WED,THU,FRI,SAT,SUN]
s = input()
for i in range(7):
  if s == yobi[i]:
    print(i+1)
Problem p02860 (python)

Fixed submission:
n = int(input())
s = input()
if n%2==1 or s[:n//2]!=s[n//2:] :
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
if n%2==1 or s[:n//2]==s[n//2:] :
    print("No")
else:
    print("Yes")
return 0

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
if n%2==1 or s[:n/2]==s[n/2:]:
    print("No")
else:
    print("Yes")
return 0

Buggy submission (verdict: Runtime Error):
s = input()
n = len(s)
if n%2==1 or s[:n//2]==s[n//2:]:
    print("No")
else:
    print("Yes")
return 0

Buggy submission (verdict: Runtime Error):
s = input()
if len(s)%2==1 or s[:len(s)//2]==s[len(s)//2:]:
    print("No")
else:
    print("Yes")
return 0
Problem p02881 (python)

Fixed submission:
import math
n = int(input())
m = n-1
for i in range(1,int(math.sqrt(n))+1):
  if n%i==0:
    m = min(m,i+n//i-2)
print(m)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
m = n-1
for i in range(1,1+math.isqrt(n-1)):
  if n%i==0:
    m = min(m,i+n/i-2)
print(m)
Problem p02851 (python)

Fixed submission:
import sys
import itertools
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    ls = [0] + list(map(lambda x: int(x) - 1, input().rstrip('\n').split()))
    ls = [i % k for i in list(itertools.accumulate(ls))]
    
    d = collections.defaultdict(int)
    t = 0
    for i, x in enumerate(ls):
        t += d[x]
        d[x] += 1
        if i >= k - 1:
            d[ls[i - k + 1]] -= 1
    print(t)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys
import itertools
import collections


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    ls = [0] + list(map(lambda x: int(x) - 1, input().rstrip('\n').split()))
    ls = [i % k for i in list(itertools.accumulate(ls))]
    print(ls)

    d = collections.defaultls):
        t += d[x]
        d[x] += 1
        if i >= k - 1:
            d[ls[i - k + 1]] -= 1
    print(t)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, k = list(map(int, input().rstrip('\n').split()))
    ls = list(map(lambda x: int(x) % k, input().rstrip('\n').split()))
    cnt = 0
    print(ls)
    for i in range(min(n, k)):
        t = sum(ls[:i+1])
        if t % k == i + 1:
            cnt += 1
            print(i, j)
        for j in range(i+1, n):
            t -= ls[j-i-1]
            t += ls[j]
            if t % k == i + 1:
                cnt += 1
                print(i, j)
            elif t % k > k:
                break
    print(cnt)


if __name__ == '__main__':
    solve()
Problem p02863 (python)

Fixed submission:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, t = list(map(int, readline().split()))
    ab = [list(map(int, readline().split())) for _ in range(n)]
    ab.sort()
    dp = [0] * (t + 1)
    for a, b in ab:
        dp[-1] = max(dp[-1], dp[-2] + b)
        for i in range(t - a - 1, -1, -1):
            dp[i + a] = max(dp[i + a], dp[i] + b)
    print(dp[-1])


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, t = list(map(int, readline().split()))
    ls = [0] * (200 + 1)
    ab = []
    mt = 0
    for i in range(n):
        a, b = list(map(int, readline().split()))
        mt = max(mt, a)
        ab.append([a, b])
        for j in range(t, -1, -1):
            ls[j + a] = max(ls[j + a], ls[j] + b)
    print(max(ls[:t+mt]))


if __name__ == '__main__':
    solve()
Problem p02881 (python)

Fixed submission:
import sys


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n = int(input().rstrip('\n'))
    t = n
    mt = 10 ** 20
    for i in range(1, int(n ** 0.5) + 1):
        if t % i == 0:
            mt = min(mt, (i - 1) + (t // i - 1))
    print(mt)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys
import fractions


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n = int(readline())
    m = 0
    for i in range(2, int(n ** 0.5) + 1):
        m = max(m, fractions.gcd(n, i))
    print(n // m + m - 2)


if __name__ == '__main__':
    solve()
Problem p03017 (python)

Fixed submission:
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, a, b, c, d = list(map(int, readline().split()))
    s = str(readline().rstrip().decode('utf-8'))
    if c == d:
        print("No")
    elif c < d:
        print("Yes" if s[a-1:d+1].count("##") == 0 else "No")
    elif c > d:
        print("Yes" if s[a-1:c+1].count("##") == 0 and s[b-2:d+1].count("...") != 0 else "No")


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, a, b, c, d = list(map(int, readline().split()))
    if s[c-1] == "#" or s[d-1] == "#":
        print("No")
    else:
        s = str(readline().rstrip().decode('utf-8'))
        wrc = 0
        brc = 0
        wc = 0
        bc = 0
        for i in range(n):
            if s[i] == "#":
                bc += 1
                wc = 0
            else:
                bc = 0
                wc += 1
            wrc = max(wrc, wc)
            brc = max(brc, bc)
        if c < d:
            if brc < 2:
                print("Yes")
            else:
                print("No")
        else:
            if brc >= 2 and wrc >= 3:
                print("Yes")
            else:
                print("No")


if __name__ == '__main__':
    solve()
Problem p03053 (python)

Fixed submission:
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    h, w = list(map(int, readline().split()))
    a = [[True] * w for _ in range(h)]
    ql = collections.deque()
    for i in range(h):
        s = list(str(readline().rstrip().decode('utf-8')))
        for j in range(w):
            if s[j] == "#":
                ql.append([0, i, j])
                a[i][j] = False
    while ql:
        cost, x, y = ql.popleft()
        for xv, yv in ((x + 1, y), (x - 1, y), (x, y + 1), (x, y - 1)):
            if 0 <= xv < h and 0 <= yv < w:
                if a[xv][yv]:
                    ql.append([cost + 1, xv, yv])
                    a[xv][yv] = False
    print(cost)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    h, w = list(map(int, input().rstrip('\n').split()))
    a = [["."] * w for _ in range(h)]
    ql = []
    ql = collections.deque(ql)
    fq = collections.defaultdict(list)
    for i in range(h):
        s = str(readline().rstrip().decode('utf-8'))
        for j in range(w):
            if s[j] == "#":
                a[i][j] = "#"
                ql.append([0, i, j])
                fq[i, j]

    mt = 0
    while True:
        if len(ql) != 0:
            cost, x, y = ql.popleft()
            mt = max(mt, cost)
            for xv, yv in [[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1]]:
                if 0 <= xv < h and 0 <= yv < w:
                    if (xv, yv) not in fq and a[xv][yv] == ".":
                        ql.append([cost + 1, xv, yv])
                        fq[xv, yv]
        else:
            break
    print(mt)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    h, w = list(map(int, input().rstrip('\n').split()))
    a = [["."] * w for _ in range(h)]
    ql = []
    ql = collections.deque(ql)
    fq = collections.defaultdict(list)
    for i in range(h):
        s = str(readline().rstrip().decode('utf-8'))
        for j in range(w):
            if s[i][j] == "#":
                a[i][j] = "#"
                ql.append([0, i, j])
                fq[i, j]

    mt = 0
    while True:
        if len(ql) != 0:
            cost, x, y = ql.popleft()
            mt = max(mt, cost)
            for xv, yv in [[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1]]:
                if 0 <= xv < h and 0 <= yv < w:
                    if (xv, yv) not in fq and a[xv][yv] == ".":
                        ql.append([cost + 1, xv, yv])
                        fq[xv, yv]
        else:
            break
    print(mt)


if __name__ == '__main__':
    solve()
Problem p03137 (python)

Fixed submission:
import heapq
n, m = map(int, input().split())
if n >= m:
    print(0)
else:
    x = list(map(int, input().split()))
    x.sort()
    d = []
    heapq.heapify(d)
    for i in range(1, m):
        heapq.heappush(d, [-abs(x[i] - x[i-1]), i, i - 1])
    total = 0
    a = [0, m - 1]
    for i in range(n-1):
        p = heapq.heappop(d)
        a.append(p[1])
        a.append(p[2])
    a.sort()
    total = 0
    for i in range(1, len(a), 2):
        total += abs(x[a[i]] - x[a[i-1]])
    print(total)

Buggy submission (verdict: Runtime Error):
def slove():
    import sys
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    x = list(map(int, input().rstrip('\n').split()))
    if n >= m:
        print(0)
    else:
        x.sort()
        y = []
        for i, v in enumerate(x):
            if i != 0:
                y.append([abs(v - x[i-1]), i, i-1])
        y = sorted(y, key=lambda x: x[0], reverse=True)
        cnt = 0
        z = [0, m-1]
        for i in range(n-1):
            z.append(y[i][1])
            z.append(y[i][2])
        z.sort()
        for i in range(1, m, 2):
            cnt += abs((x[z[i]] - x[z[i-1]]))
        print(cnt)


if __name__ == '__main__':
    slove()
Problem p03221 (python)

Fixed submission:
n, m = map(int, input().split())
a = []
b = [1] * n
py = []
for i in range(m):
    p, y = map(int, input().split())
    py.append([p, y, i, 0])
py = sorted(py, key=lambda x: (x[0], x[1]))
for i in range(len(py)):
    py[i][3] = b[py[i][0]-1]
    b[py[i][0] - 1] += 1
py = sorted(py, key=lambda x: x[2])
for i in py:
    print(("000000" + str(i[0]))[-6:] + ("000000" + str(i[3]))[-6:])

Buggy submission (verdict: Runtime Error):
def slove():
    import sys
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    py = []
    ls = [1] * (n + 1)
    for i in range(m):
        p, y = list(map(int, input().rstrip('\n').split()))
        py.append([p, y, 0, i])
    py.sort()
    for i in range(m):
        py[i][2] = ls[py[i][0]]
        ls[py[i][0]] += 1
    py.sort(key=lambda x: x[3])
    for i in range(len(py)):
        a = ["0"] * 6
        a.append(list(str(py[i][0])))
        a = a[-6:]
        b = ["0"] * 6
        b.append(list(str(py[i][2])))
        b = b[-6:]
        print("".join(a + b))


if __name__ == '__main__':
    slove()
Problem p03253 (python)

Fixed submission:
import sys
import collections


def alg_duplicate_combination_mod(n, r, mod):
    n = n + r - 1
    r = min(n - r, r)
    if r == 0:
        return 1
    else:
        denominator = 1
        for i in range(n, n - r, -1):
            denominator = (denominator * i) % mod
        molecule = 1
        for i in range(1, r + 1):
            molecule = (molecule * i) % mod
        return denominator * pow(molecule, mod - 2, mod) % mod


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, input().rstrip('\n').split()))
    t = m
    d = collections.defaultdict(int)
    for i in range(2, int(t ** 0.5) + 1):
        while True:
            if t % i == 0:
                d[i] += 1
                t //= i
            else:
                break
    if t != 1:
        d[t] += 1
    cnt = 1
    for k, v in d.items():
        cnt *= alg_duplicate_combination_mod(n, v, mod)
        cnt %= mod
    print(cnt)


if __name__ == '__main__':
    solve()

Buggy submission (verdict: Runtime Error):
import sys
import collections


def alg_duplicate_combination_mod(n, r, mod):
    n = n + r - 1
    r = min(n - r, r)
    if r == 0:
        return 1
    else:
        denominator = 1
        for i in range(n, n - r, -1):
            denominator = (denominator * i) % mod
        molecule = 1
        for i in range(1, r + 1):
            molecule = (molecule * i) % mod
        return denominator * pow(molecule, mod - 2, mod) % mod


def solve():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, input().rstrip('\n').split()))
    t = m
    d = collections.defaultdict(int)
    for i in range(2, int(t ** 0.5) + 1):
        while True:
            if t % i == 0:
                d[i] += 1
                t //= i
            else:
                break
    if t != 1:
        cnt *= alg_duplicate_combination_mod(n, v, od)
        cnt %= mod
    print(cnt)


if __name__ == '__main__':
    solve()
Problem p02552 (python)

Fixed submission:
x=int(input())

def main(x):
    if x ==1:
        return 0
    else:
        return 1
print(main(x))

Buggy submission (verdict: Runtime Error):
def main(x):
    if x =1:
        return 0
    else:
        return 1

main(x)

Buggy submission (verdict: Runtime Error):
def main(x):
    if x =1:
        return 0
    else:
        return 1

main(x)

Buggy submission (verdict: Runtime Error):
def main():
    if x =1:
        return 0
    else:
        return 1

main()

Buggy submission (verdict: Runtime Error):
def main():
    if x =1:
        return 0
    elif x !=1:
        return 1

main()
Problem p02862 (python)

Fixed submission:
x, y = [int(s) for s in input().split()]

a, a_mod = divmod(2 * y - x, 3)
b, b_mod = divmod(2 * x - y, 3)
if a < 0 or a_mod != 0 or b < 0 or b_mod != 0:
    print(0)
    exit()

mod = 10 ** 9 + 7

n = a + b
temp_list = [1] * (n + 1)
for i in range(1, n + 1):
    temp_list[i] = i * temp_list[i - 1] % mod

stop = a if a < b else b
i_temp_list = [1] * (n + 1)
i_temp_list[-1] = pow(temp_list[-1], mod - 2, mod)
for i in range(n, stop, -1):
    i_temp_list[i - 1] = i_temp_list[i] * i % mod

ans = temp_list[n] * i_temp_list[a] * i_temp_list[b] % mod
print(ans)

Buggy submission (verdict: Runtime Error):
x, y = [int(s) for s in input().split()]

a, a_mod = divmod(2 * y - x, 3)
b, b_mod = divmod(2 * x - y, 3)
if a_mod != 0 or b_mod != 0:
    print(0)
    exit()

mod = 10 ** 9 + 7

n = a + b
temp_list = [1] * (n + 1)
for i in range(1, n + 1):
    temp_list[i] = i * temp_list[i - 1] % mod

stop = a if a < b else b
i_temp_list = [1] * (n + 1)
i_temp_list[-1] = pow(temp_list[-1], mod - 2, mod)
for i in range(n, stop, -1):
    i_temp_list[i - 1] = i_temp_list[i] * i % mod

ans = temp_list[n] * i_temp_list[a] * i_temp_list[b] % mod
print(ans)
Problem p03013 (python)

Fixed submission:
n, m = [int(x) for x in input().split()]
a_list = [0] * m
for i in range(m):
    a_list[i] = int(input())

mod = 1000000007

temp_list = [0] * (n + 1)
temp_list[0] = 1
temp_list[1] = 1
j = 0
if j < m and a_list[0] == 1:
    temp_list[1] = 0
    j = 1

for i in range(2, n + 1):
    if j < m and i == a_list[j]:
        j += 1
        continue
    temp_list[i] = (temp_list[i - 2] + temp_list[i - 1]) % mod
print(temp_list[n])

Buggy submission (verdict: Runtime Error):
n, m = [int(x) for x in input().split()]
a_list = [0] * m
for i in range(m):
    a_list[i] = int(input())

mod = 1000000007

temp_list = [0] * (n + 1)
temp_list[0] = 1
if a_list[0] != 1:
    temp_list[1] = 1
    j = 0
else:
    j = 1

for i in range(2, n + 1):
    if j < m and i == a_list[j]:
        j += 1
        continue
    temp_list[i] = (temp_list[i - 2] + temp_list[i - 1]) % mod
print(temp_list[n])
Problem p02659 (python)

Fixed submission:
A, B = map(str, input().split())
A = int(A)
B1, B2, B3 = int(B[0]), int(B[2]), int(B[3])
ans = A*B1*100 + A*B2*10 + A*B3
ans = str(ans)
if len(ans)>2:
    print(int(ans[:-2]))
else:
    print(0)

Buggy submission (verdict: Runtime Error):
A, B = map(str, input().split())
A = int(A)
B1, B2, B3 = int(B[0]), int(B[2]), int(B[3])
ans = A*B1*100 + A*B2*10 + A*B3
ans = str(ans)
print(int(ans[:-2]))
Problem p02682 (python)

Fixed submission:
A, B, C, K = map(int, input().split())
if K <= A :
    print(K)

elif K <= A + B:
    print(A)

else:
    print(A - (K - (A + B)))

Buggy submission (verdict: Runtime Error):
A, B, C, K = map(int, input().spliit())
if K <= A :
    print(K)

elif K <= A + B:
    print(A)

else:
    print(A - (K - (A + B)))

Buggy submission (verdict: Runtime Error):
A, B, C, K = map(int, input().spliit())
if K <= A :
    return K

elif K <= A + B:
    return A

else:
    return A - (K - (A + B))
Problem p02689 (python)

Fixed submission:
N, M = map(int, input().split())
H = list(map(int, input().split()))
H_val = [H[i] for i in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    A, B = A-1, B-1
    if H[A] > H[B]:
        H_val[B] = 0
        
    elif H[B] > H[A]:
        H_val[A] = 0
        
    else:
        H_val[A], H_val[B] = 0, 0

count = 0
for i in range(N):
    if H_val[i] != 0:
        count+= 1

print(count)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
H = list(map(int, input().split()))
H_val = [H[i] for i in range(N)]
for _ in range(M):
    A, B = map(int, input().split())
    A, B = A-1, B-1
    if H[A] > H[B]:
        H_val[B] = 0
        
    elif H[B] > H[A]:
        H_val[A] = 0
        
    else:
        H_val[A], H_val[B] = 0, 0

    print(H, H_val)

count = 0
for i in range(N):
    if H_val[i] != 0:
        count+= 1

print(count)
Problem p02552 (python)

Fixed submission:
x = int(input())
if x == 0:
  print(1)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
if x = 0:
  print(1)
else:
  print(0)
Problem p02552 (python)

Fixed submission:
n = int(input())
if n == 0:
	print(1)
elif n == 1:
	print(0)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 0 {
	print(1)
} else n == 1 {
	print(0)
}
Problem p02948 (python)

Fixed submission:
from operator import itemgetter
import heapq
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(n)]
ab.sort(key = itemgetter(0))
q = []
idx = 0
ans = 0
for i in range(1, m+1):
    while idx < n:
        a, b = ab[idx]
        if a <= i:
            heapq.heappush(q, -b)
            idx += 1
        else:
            break
    if len(q) > 0:
        b = heapq.heappop(q)
        ans -= b
print(ans)

Buggy submission (verdict: Runtime Error):
n, m = map(int, input().split())
work_list = [list(map(int, input().split())) for _ in range(n)]
work_cand = []
salary = 0
for j in range(1, m + 1):
    for i in range(n):
        if work_list[i][0] == j:
            work_cand.append(work_list[i])
            del work_list[i]
        else:
            pass
    if work_cand != []:
         work_cand.sort(key = lambda x: x[1], reverse = True)
         salary += work_cand[0][1]
         del work_cand[0]
    else:
        pass
print(salary)
            pass