Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
import sys
import numpy
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    print("{0:.3f} {1:.3f}".format(numpy.round((c * e - b * f) / (a * e - b * d), 3), numpy.round((c * d - a * f) / (b * d - a * e), 3)))


Fixed submission:
import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if abs(x) < 10e-4 else x
    y = abs(y) if abs(y) < 10e-4 else y
    print("{:.3f} {:.3f}".format(x, y))

Buggy python submission (verdict: Runtime Error):
import sys
import numpy
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    x = abs(x) if x < 10e-4 else x
    print("{:.3f} {:.3f}".format(x, (c - x) / b))


Fixed submission:
import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if abs(x) < 10e-4 else x
    y = abs(y) if abs(y) < 10e-4 else y
    print("{:.3f} {:.3f}".format(x, y))

Buggy python submission (verdict: Runtime Error):
import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if x < 10e-4 else x
    y = abs(y) if y < 10e-4 else y
    print("{:.3f} {:.3f}".format(round(x,3), rount(y,3)))


Fixed submission:
import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if abs(x) < 10e-4 else x
    y = abs(y) if abs(y) < 10e-4 else y
    print("{:.3f} {:.3f}".format(x, y))

Buggy python submission (verdict: Runtime Error):
import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if abs(x) < 10e-4 else x
    y = abs(y) if abs(y) < 10e-4 else y
    print("{:.3f} {:.3f}".format(x, y)


Fixed submission:
import sys
for i in sys.stdin:
    a, b, c, d, e, f = map(int, i.split())
    x = (c * e - b * f) / (a * e - b * d)
    y = (c * d - a * f) / (b * d - a * e)
    x = abs(x) if abs(x) < 10e-4 else x
    y = abs(y) if abs(y) < 10e-4 else y
    print("{:.3f} {:.3f}".format(x, y))
Buggy python submission (verdict: Runtime Error):
import sys
[print([670, 660, 633, 592, 540, 480, 415, 348, 282, 220, 165, 120, 84, 56, 35, 20, 10, 4, 1][abs(18 - int(e))]) for e in sys.stdin]


Fixed submission:
import sys
d=[sum((10-abs(9-i))*(10-abs(9+i-j))for i in range(j+1))for j in range(19)[::-1]]+[0]*14
[print(d[abs(18-int(e))])for e in sys.stdin]
Buggy python submission (verdict: Time Limit Exceeded):
s = input()
a = "".join([chr(97 + i) for i in range(26)])
b = "".join([a[i -1] for i in range(26)])
x = str.maketrans(a, b)
while True:
    s = s.translate(x)
    if " the " in s or " that " in s or " this " in s:
        print(s)
        break


Fixed submission:
import sys
a = "abcdefghijklmnopqrstuvwxyz"
x = str.maketrans(a, a[1:] + a[:1])
for s in sys.stdin:
    while True:
        s = s.translate(x)
        if "the" in s or "that" in s or "this " in s:
            print(s, end = "")
            break

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
a = "".join([chr(97 + i) for i in range(26)])
b = "".join([a[i - 1] for i in range(26)])
x = str.maketrans(a, b)
while True:
    s = s.translate(x)
    if " the " in s or "that " in s or "this " in s:
        print(s)
        break


Fixed submission:
import sys
a = "abcdefghijklmnopqrstuvwxyz"
x = str.maketrans(a, a[1:] + a[:1])
for s in sys.stdin:
    while True:
        s = s.translate(x)
        if "the" in s or "that" in s or "this " in s:
            print(s, end = "")
            break

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
a = "".join([chr(97 + i) for i in range(26)])
b = "".join([a[i - 1] for i in range(26)])
x = str.maketrans(a, b)
while True:
    s = s.translate(x)
    if "the." in s or "that." in s or "this." in s:
        print(s)
        break


Fixed submission:
import sys
a = "abcdefghijklmnopqrstuvwxyz"
x = str.maketrans(a, a[1:] + a[:1])
for s in sys.stdin:
    while True:
        s = s.translate(x)
        if "the" in s or "that" in s or "this " in s:
            print(s, end = "")
            break

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
a = "".join([chr(97 + i) for i in range(26)])
b = "".join([a[i -1] for i in range(26)])
x = str.maketrans(a, b)
while True:
    s.translate(x)
    if "the" in s or "that" in s or "this" in s:
        print(s)
        break


Fixed submission:
import sys
a = "abcdefghijklmnopqrstuvwxyz"
x = str.maketrans(a, a[1:] + a[:1])
for s in sys.stdin:
    while True:
        s = s.translate(x)
        if "the" in s or "that" in s or "this " in s:
            print(s, end = "")
            break
Buggy python submission (verdict: Runtime Error):
s = (0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30)
w = ("Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday")
while True:
    m, d = map(int, input().split())
    if m == 0:break
    print(w[(d + sum(s[:m])) % 7])


Fixed submission:
s = (0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30)
w = ("Wednesday", "Thursday", "Friday", "Saturday", "Sunday", "Monday", "Tuesday")
while True:
    m, d = map(int, input().split())
    if m == 0:break
    print(w[(d + sum(s[:m])) % 7])
Buggy python submission (verdict: Time Limit Exceeded):
while 1:
    a = list(input())
    if a == ["0", "0", "0", "0"]:break
    if a[0] == a[1] == a[2] == a[3]:print("NA")
    else:
        c = 0
        while 1:
            if a == ["6", "1", "7", "4"]:break
            c += 1
            s = int("".join(sorted(a)))
            l = int("".join(sorted(a, reverse = True)))
            a = list(str(l - s))
        print(c)


Fixed submission:
while 1:
    a = list(input())
    if a == ["0", "0", "0", "0"]:break
    if a[0] == a[1] == a[2] == a[3]:print("NA")
    else:
        c = 0
        while 1:
            if a == ["6", "1", "7", "4"]:break
            c += 1
            s = int("".join(sorted(a)))
            l = int("".join(sorted(a, reverse = True)))
            a = list("{:04d}".format(l - s))
        print(c)
Buggy python submission (verdict: Time Limit Exceeded):
while 1:
    n = int(input())
    if n == 0:break
    l = sum(map(int, input().split()))
    j = sorted(map(int, input().split()), reverse = True)
    print(max([((l + sum(j[:i])) * (n - i)) for i in range(n)]))


Fixed submission:
while 1:
    n = int(input())
    if n == 0:break
    l = sum(map(int, input().split()))
    j = sorted(map(int, input().split()), reverse = True)
    d = [0] * n
    for i in range(n):
        d[i] = (l + sum(j[:i])) * (n - i)
        if d[i] < d[i - 1]:
            print(d[i - 1])
            break
    else:print(d[-1])
Buggy python submission (verdict: Runtime Error):
n, m, p = map(int,input().split())
a = sorted([(int(input()) - p) % n for _ in range(m)])
print(min(a[-1], n - a[0], min([a[i] + n - a[i + 1] + min(a[i], n - a[i + 1]) for i in range(m - 1)])) * 100)


Fixed submission:
n, m, p = map(int,input().split())
a = sorted([(int(input()) - p) % n for _ in range(m)])
print(min(a[-1], n - a[0], min([a[i] + n - a[i + 1] + min(a[i], n - a[i + 1]) for i in range(m - 1)])) * 100 if m > 1 else min(a[0], n - a[0]) * 100)

Buggy python submission (verdict: Runtime Error):
n, m, p = map(int,input().split())
a = sorted([(int(input()) - p) % n for _ in range(m)])
print(min(a[-1], n - a[0], min([a[i] + n - a[i + 1] + min(a[i], n - a[i + 1]) for i in range(m - 1)])) * 100 if m > 0 else min(a[0], n - a[0]))


Fixed submission:
n, m, p = map(int,input().split())
a = sorted([(int(input()) - p) % n for _ in range(m)])
print(min(a[-1], n - a[0], min([a[i] + n - a[i + 1] + min(a[i], n - a[i + 1]) for i in range(m - 1)])) * 100 if m > 1 else min(a[0], n - a[0]) * 100)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = sorted(map(int,input().split()))
b = [(a[i + 1] - a[i], i) for i in range(n -1)]
b.sort(key = lambda x:x[0])
if b[0][1] < n - 2:print((a[-1] + a[-2]) / c)
elif b[0][1] == n - 3:
    if b[1][1] == n - 2:print(max((a[-1] + a[-2]) / b[2][0], (a[-1] + a[-4]) / b[0][0], (a[-3] + a[-4]) / b[1][0]))
    else:print(max((a[-1] + a[-2]) / b[1][0], (a[-1] + a[-4]) / b[0][0]))
else:
    if b[1][1] == n - 3:print(max((a[-1] + a[-2]) / b[2][0], (a[-1] + a[-4]) / b[1][0], (a[-3] + a[-4]) / b[0][0]))
    else:print(max((a[-1] + a[-2]) / b[1][0], (a[-3] + a[-4]) / b[0][0]))


Fixed submission:
n = int(input())
a = sorted(map(int,input().split()))
b = [(a[i + 1] - a[i], i) for i in range(n -1)]
b.sort(key = lambda x:x[0])
if b[0][1] < n - 2:print((a[-1] + a[-2]) / b[0][0])
elif b[0][1] == n - 3:
    if b[1][1] == n - 2:print(max((a[-1] + a[-2]) / b[2][0], (a[-1] + a[-4]) / b[0][0], (a[-3] + a[-4]) / b[1][0]))
    else:print(max((a[-1] + a[-2]) / b[1][0], (a[-1] + a[-4]) / b[0][0]))
else:
    if b[1][1] == n - 3:print(max((a[-1] + a[-2]) / b[2][0], (a[-1] + a[-4]) / b[1][0], (a[-3] + a[-4]) / b[0][0]))
    else:print(max((a[-1] + a[-2]) / b[1][0], (a[-3] + a[-4]) / b[0][0]))
Buggy python submission (verdict: Time Limit Exceeded):
import bisect
while True:
    n, m = map(int, input().split())
    if n == 0:
        break
    p = list(int(input()) for i in range(n))
    point = [] + p
    for i in p:
        for j in p:
            a = i + j
            if a <= m and a not in point:
                point.append(a)
    point.sort()
    maxp = 0
    for i in point:
        if m - i in point:
            print(m)
            break
        pp = i + point[bisect.bisect_left(point, m - i) - 1]
        if pp > maxp:
            maxp = pp
    else:
        print(maxp)


Fixed submission:
import bisect
def main():
    while True:
        n, m = map(int, input().split())
        if n == 0:
            break
        p = [0] + list(int(input()) for i in range(n))
        point = []
        for i in range(n):
            for j in p[i:]:
                a = p[i] + j
                if a < m:
                    point.append(a)
        point.sort()

        print(max(i + point[bisect.bisect_left(point, m - i) - 1] for i in point))
            
if __name__=="__main__":
	main()

Buggy python submission (verdict: Time Limit Exceeded):
import bisect
def main():
    while True:
        n, m = map(int, input().split())
        if n == 0:
            break
        p = list(int(input()) for i in range(n))
        point = [] + p
        for i in p:
            for j in p:
                a = i + j
                if a <= m and a not in point:
                    point.append(a)
        point.sort()
        maxp = 0
        for i in point:
            if m - i in point:
                print(m)
                break
            pp = i + point[bisect.bisect_left(point, m - i) - 1]
            if pp > maxp:
                maxp = pp
        else:
            print(maxp)
            
if __name__=="__main__":
	main()


Fixed submission:
import bisect
def main():
    while True:
        n, m = map(int, input().split())
        if n == 0:
            break
        p = [0] + list(int(input()) for i in range(n))
        point = []
        for i in range(n):
            for j in p[i:]:
                a = p[i] + j
                if a < m:
                    point.append(a)
        point.sort()

        print(max(i + point[bisect.bisect_left(point, m - i) - 1] for i in point))
            
if __name__=="__main__":
	main()
Buggy python submission (verdict: Runtime Error):
from scipy.misc import comb
n, m, r = map(int, input().split())
a = r - n * m
if a < 0:
    print(0)
else:
    print(int(comb(a + n - 1, n - 1)))


Fixed submission:
import math
n, m, r = map(int, input().split())
a = r - n * m
def combination(p, q):
    if q < 0 or p < q:
        return 0
    return math.factorial(p) // math.factorial(q) // math.factorial(p - q)
if a < 0:
    print(0)
else:
    print(int(combination(a + n - 1, a)))

Buggy python submission (verdict: Runtime Error):
import math
n, m, r = map(int, input().split())
a = r - n * m
if a < 0:
    print(0)
else:
    print(int(math.factorial(a + n - 1) / math.factorial(n - 1) / math.factorial(a)))


Fixed submission:
import math
n, m, r = map(int, input().split())
a = r - n * m
def combination(p, q):
    if q < 0 or p < q:
        return 0
    return math.factorial(p) // math.factorial(q) // math.factorial(p - q)
if a < 0:
    print(0)
else:
    print(int(combination(a + n - 1, a)))

Buggy python submission (verdict: Runtime Error):
import math
n, m, r = map(int, input().split())
a = r - n * m
if a < 0:
    print(0)
else:
    b = 1
    if n - 1 > a:
        for i in range(a):
            b *= a + n - 1 - i
        for i in range(1, a + 1):
            b /= i
    else:
        for i in range(n - 1):
            b *= a + n - 1 - i
        for i in range(1, n):
            b /= i
    print(int(b))


Fixed submission:
import math
n, m, r = map(int, input().split())
a = r - n * m
def combination(p, q):
    if q < 0 or p < q:
        return 0
    return math.factorial(p) // math.factorial(q) // math.factorial(p - q)
if a < 0:
    print(0)
else:
    print(int(combination(a + n - 1, a)))

Buggy python submission (verdict: Runtime Error):
import math
n, m, r = map(int, input().split())
a = r - n * m
if a < 0:
    print(0)
else:
    b = 1
    if n - 1 > a:
        for i in range(a):
            b *= a + n - 1 - i
        for i in range(1, a + 1):
            b = int(b / i)
    else:
        for i in range(n - 1):
            b *= a + n - 1 - i
        for i in range(1, n):
            b /= int(b / i)
    print(int(b))


Fixed submission:
import math
n, m, r = map(int, input().split())
a = r - n * m
def combination(p, q):
    if q < 0 or p < q:
        return 0
    return math.factorial(p) // math.factorial(q) // math.factorial(p - q)
if a < 0:
    print(0)
else:
    print(int(combination(a + n - 1, a)))

Buggy python submission (verdict: Runtime Error):
import math
n, m, r = map(int, input().split())
a = r - n * m
if a < 0:
    print(0)
else:
    b = 1
    if n - 1 > a:
        for i in range(a):
            b *= a + n - 1 - i
        for i in range(1, a + 1):
            b = int(b / i)
    else:
        for i in range(n - 1):
            b *= a + n - 1 - i
        for i in range(1, n):
            b = int(b / i)
    print(int(b))


Fixed submission:
import math
n, m, r = map(int, input().split())
a = r - n * m
def combination(p, q):
    if q < 0 or p < q:
        return 0
    return math.factorial(p) // math.factorial(q) // math.factorial(p - q)
if a < 0:
    print(0)
else:
    print(int(combination(a + n - 1, a)))
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
d = [int(input()) for _ in range(n)]
c = [int(input()) for _ in range(m)]
h = [[10e10 for _ in range(m)] for _ in range(n)]
q = [[0, 0, 0]]
while True:
    nq = []
    for i in q:
        dn = i[2] + d[i[0]] * c[i[1]] 
        if dn < min(h[i[0]][:i[1] + 1]):
            if i[0] < n - 1:
                nq.append([i[0] + 1, i[1] + 1, dn])
            h[i[0]][i[1]] = dn
        if n - i[0] < m - i[1] and i[1] < m - 1:
            nq.append([i[0], i[1] + 1, i[2]])
    if nq == []:
        break
    q = nq
print(min(h[-1]))


Fixed submission:
n, m = map(int, input().split())
d = [int(input()) for _ in range(n)]
c = [int(input()) for _ in range(m)]
h = [[0 for _ in range(m)] for _ in range(n)]
for i in range(n):
    for j in range(i, m):
        if i == j:
            h[i][j] = h[i -1][j - 1] + d[i] * c[j]
        else:
            h[i][j] = min(h[i][j - 1], h[i - 1][j - 1] + d[i] * c[j])
            
print(h[n - 1][m - 1])
Buggy python submission (verdict: Time Limit Exceeded):
n, q, s, t = map(int, input().split())
a = [int(input()) for _ in range(n + 1)]
for _ in range(q):
    l, r, x = map(int, input().split())
    for i in range(l, r + 1):
        a[i] += x
    temp = 0
    for i in range(1, n + 1):
        temp += (a[i - 1] - a[i]) * s if a[i] > a[i - 1] else (a[i - 1] - a[i]) * t
    print(temp)


Fixed submission:
n, q, s, t = map(int, input().split())
a = [int(input()) for _ in range(n + 1)]
for i in range(1, n + 1)[::-1]:
    a[i] -= a[i - 1]
count = 0
for i in range(n + 1):
    count -= a[i] * s if a[i] > 0 else a[i] * t
for _ in range(q):
    l, r, x = map(int, input().split())
    count += a[l] * s if a[l] > 0 else a[l] * t
    a[l] += x
    count -= a[l] * s if a[l] > 0 else a[l] * t
    if r < n:
        count += a[r + 1] * s if a[r + 1] > 0 else a[r + 1] * t
        a[r + 1] -= x
        count -= a[r + 1] * s if a[r + 1] > 0 else a[r + 1] * t
    print(count)
Buggy python submission (verdict: Runtime Error):
for i in range(int(input())):
    n, k = map(int, input().split())
    d = list(map(int, input().split()))
    if k >= n:
        print(0)
    elif k == 1:
        d.sort()
        print(d[-1] - d[0])
    else:
        k = [0] * (k - 1)
        d.sort()
        for i in range(1, n):
            if d[i] - d[i - 1] > k[0]:
                k[0] = d[i] - d[i - 1]
                k.sort()
        print(d[-1] - d[0] - sum(k))


Fixed submission:
for i in range(int(input())):
    t, k = map(int, input().split())
    d=list(map(int,input().split()))
    d=sorted([d[i+1]-d[i] for i in range(t-1)])
    print(sum(d[:t-k]) if t>k else 0)
Buggy python submission (verdict: Runtime Error):
import itertools
from decimal import Decimal, ROUND_HALF_UP
for _ in range(int(input())):
    a, b = tuple(map(int, input().split())), tuple(map(int, input().split()))
    c = 0
    for i in itertools.permutations(b):
        s = 0
        for j in range(9):s += (a[j] + i[j]) * (a[j] > i[j])
        if s > 85:c += 1
    c /= 362880
    print("{} {}".format(Decimal(c).quantize(Decimal('0.00001'), rounding=ROUND_HALF_UP), Decimal(1 - c).quantize(Decimal('0.00001'), rounding=ROUND_HALF_UP)))


Fixed submission:
import math
from decimal import Decimal, ROUND_HALF_UP
for _ in range(int(input())):
    a, b = tuple(sorted(map(int, input().split()), reverse = True)), tuple(sorted(map(int, input().split())))
    c = 0
    q = {():(0, 0)}
    for i in range(9):
        nq = {}
        for k in q:
            for j in b:
                if j not in k:
                    x = q[k][0] + (a[i] + j) * (a[i] > j)
                    y = q[k][1] + (a[i] + j) * (a[i] < j)
                    if x > 85:c += math.factorial(9 - i - 1)
                    elif y < 86:nq[tuple(list(k) + [j])] = (x, y)
        q = nq
    c /= 362880
    print("{} {}".format(Decimal(c).quantize(Decimal('0.000001'), rounding=ROUND_HALF_UP), Decimal(1 - c).quantize(Decimal('0.000001'), rounding=ROUND_HALF_UP)))
Buggy python submission (verdict: Runtime Error):
m = {"yotta":24, "zetta":21, "exa":18, "peta":15, "tera":12, "giga":9, "mega":6, "kilo":3, "hecto":2, "deca":1, "deci":-1, "centi":-2, "milli":-3, "micro":-6, "nano":-9, "pico":-12, "femto":-15, "ato":-18, "zepto":-21, "yocto":-24}
for _ in range(int(input())):
    v, *b = input().split()
    if len(b) == 2:
        k, b = b[0], b[1]
        a = m[k]
    else:b = b[0];a = 0
    s = 0
    for i in range(len(v)):
        if v[i] in "123456789":
            s = len(v) - i
            if "." in v[i + 1:]:s -= 1
            break
    x = float(v)
    while x < 1:
        x *= 10
        a -= 1
    while x >= 10:
        x /= 10
        a += 1
    while 1:
        if v[0] in "123456789":
            if len(v) != 1:
                v = v[0] + "." + v[1:]
                if "." in v[2:]:
                    a = 2 + v[2:].index(".")


Fixed submission:
m = {"yotta":24, "zetta":21, "exa":18, "peta":15, "tera":12, "giga":9, "mega":6, "kilo":3, "hecto":2, "deca":1, "deci":-1, "centi":-2, "milli":-3, "micro":-6, "nano":-9, "pico":-12, "femto":-15, "ato":-18, "zepto":-21, "yocto":-24}
for _ in range(int(input())):
    v, *b = input().split()
    if len(b) == 2:
        k, b = b[0], b[1]
        a = m[k]
    else:b = b[0];a = 0
    s = 0
    for i in range(len(v)):
        if v[i] in "123456789":
            if i != 0:
                a -= i - 1
                if i != len(v) - 1:v = v[i] + "." + v[i + 1:]
                else:v = v[i]
            else:
                try:
                    j = v[i:].index(".")
                    a += j - 1
                    v = v[0] + "." + v[1:j] + v[j + 1:]
                except:
                    a += len(v) - 1
                    v = v[0] + "." + v[1:]
            break
    print("{} * 10^{} {}".format(v, a, b))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [float(input()) for _ in range(n)]
p = [0] * n
for i in range(n):
    for j in range(i + 1, n):
        if a[i] > a[j]:
            p[i] += 3
        elif a[i] == a[j]:
            p[i] += 1
            p[j] += 1
        else:
            p[j] += 3
for i in p:
    print(i)


Fixed submission:
import bisect
n = int(input())
a = [float(input()) for _ in range(n)]
b = sorted(a)
for i in range(n):
    x = bisect.bisect_left(b, a[i])
    y = bisect.bisect_right(b, a[i])
    print(x * 2 + y - 1)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = [float(input()) for _ in range(n)]
b = sorted(a)
for i in range(n):
    print(b.index(a[i]) * 3 + b.count(a[i]) - 1)


Fixed submission:
import bisect
n = int(input())
a = [float(input()) for _ in range(n)]
b = sorted(a)
for i in range(n):
    x = bisect.bisect_left(b, a[i])
    y = bisect.bisect_right(b, a[i])
    print(x * 2 + y - 1)
Buggy python submission (verdict: Time Limit Exceeded):
n, m, c = map(int, input().split())
l = (0,) + tuple(map(int, input().split()))
a = [0] * (c + 1)
w = [tuple(map(int, input().split())) for _ in range(n)]
w.sort(key = lambda x:x[1], reverse = True)
v = 0
for i in range(n):
    if a[w[i][0]] < l[w[i][0]]:
        v += w[i][1]
        a[w[i][0]] += 1
    if sum(a) == m:
        break
print(v)


Fixed submission:
n, m, c = map(int, input().split())
l = [0] + list(map(int, input().split()))
w = [tuple(map(int, input().split())) for _ in range(n)]
w.sort(key = lambda x:x[1], reverse = True)
v = 0
p = 0
for i in range(n):
    if l[w[i][0]]:
        l[w[i][0]] -= 1
        v += w[i][1]
        p += 1
        if p == m:
            break
print(v)

Buggy python submission (verdict: Runtime Error):
n, m, c = map(int, input().split())
l = (0,) + tuple(map(int, input().split()))
a = [0] * (c + 1)
w = [tuple(map(int, input().split())) for _ in range(n)]
w.sort(key = lambda x:x[1], reverse = True)
v = 0
p = 0
for i in range(n):
    if l[w[i][0]]:
        l[w[i][0]] -= 1
        v += w[i][1]
        p += 1
        if p == m:
            break
print(v)


Fixed submission:
n, m, c = map(int, input().split())
l = [0] + list(map(int, input().split()))
w = [tuple(map(int, input().split())) for _ in range(n)]
w.sort(key = lambda x:x[1], reverse = True)
v = 0
p = 0
for i in range(n):
    if l[w[i][0]]:
        l[w[i][0]] -= 1
        v += w[i][1]
        p += 1
        if p == m:
            break
print(v)
Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
c = 0
for i in range(n - 1):
    j = np.argmin(a[i:]) + i
    if i != j:
        a[i], a[j] = a[j], a[i]
        c += 1
print(" ".join(map(str, list(a))))
print(c)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(n - 1):
    j = a[i:].index(min(a[i:])) + i
    if i != j:
        a[i], a[j] = a[j], a[i]
        c += 1
print(" ".join(map(str, a)))
print(c)

Buggy python submission (verdict: Runtime Error):
import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))
c = 0
for i in range(n - 1):
    j = np.argmin(a[i:]) + i
    if i != j:
        a[i], a[j] = a[j], a[i]
        c += 1
print(" ".join(map(str, list(a))))
print(c)


Fixed submission:
n = int(input())
a = list(map(int, input().split()))
c = 0
for i in range(n - 1):
    j = a[i:].index(min(a[i:])) + i
    if i != j:
        a[i], a[j] = a[j], a[i]
        c += 1
print(" ".join(map(str, a)))
print(c)