Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
a, b, c = map(int, input().split())

if ((c - (a - b)) >= 0):
    print(c - (a - b))
else print(0)

Fixed submission:
a, b, c = map(int, input().split())

if ((c - (a - b)) >= 0):
    print(c - (a - b))
else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
k, s = map(int, input().split())
c = 0
for x in range(k + 1):
    for y in range(k + 1):
        for z in range(k + 1):
            if x + y + z == s:
                c += 1
print(c)

Fixed submission:
k, s = map(int, input().split())
c = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if z <= k and z >= 0:
            c += 1
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
x = [int(i) for i in input().split()]

ans = 0

rmax = x[3]/x[0]
for i in range(int(rmax)+1):
    gmax = (x[3] -x[0]*i)/x[1]
    for j in range(int(gmax)+1):
        bmax = (x[3] - x[0]*i - x[1]*j)/x[2]
        for k in range(int(bmax)+1):
            if (x[0]*i + x[1]*j + x[2]*k ) == x[3]:
                ans = ans + 1

print(ans)

Fixed submission:
x = [int(i) for i in input().split()]

ans = 0

rmax = x[3]/x[0]
for i in range(int(rmax)+1):
    gmax = (x[3] -x[0]*i)/x[1]
    for j in range(int(gmax)+1):
        if (x[3]-x[0]*i - x[1]*j)%x[2] == 0:
                ans = ans + 1

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

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

n = ni()
m = nl()
res = 1
for i in m:
    res *= i
print(res if not res > 10**18 else -1)

Fixed submission:
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

n = ni()
m = nl()
res = 1
if 0 in m:
    print(0)
else:
    for i in m:
        res *= i
        if res > 10**18 :
            print(-1)
            break
    else:
        print(res)
Buggy python submission (verdict: Runtime Error):
import sys
import math

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

a,b = input().split(' ')
a = int(a)
b = float(b)
t = str(b).replace('.','')
res = 0
for i in range(3):
    res += int(str(t)[i]) * a // (10 ** i)
print(int(res))

Fixed submission:
import sys
import math

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

a,b = input().split(' ')
ash_1 = int(a[-1])
ash_2 = int(a[-2:])
bsh_1 = int(b[-2])
bsh_2 = int(b[-1])
bsh_0 = int(b[0])
kuri = (ash_1*bsh_1*10 + ash_2*bsh_2) //100
if len(a) == 1:
    res = int(a)*bsh_0 + kuri
elif len(a) == 2:
    a1 = a[:-1]
    res = int(a)*bsh_0 + int(a1)*bsh_1 + kuri
else:
    a1 = a[:-1]
    a2 = a[:-2]
    res = int(a)*bsh_0 + int(a1)*bsh_1 + int(a2)*bsh_2 + kuri
print(res)

Buggy python submission (verdict: Runtime Error):
import sys
import math

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

a,b = input().split(' ')
a = int(a)
b = float(b)
t = int(b * 100)
res = 0
for i in range(3):
    res += int(str(t)[i]) * a // (10 ** i)
print(int(res))

Fixed submission:
import sys
import math

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

a,b = input().split(' ')
ash_1 = int(a[-1])
ash_2 = int(a[-2:])
bsh_1 = int(b[-2])
bsh_2 = int(b[-1])
bsh_0 = int(b[0])
kuri = (ash_1*bsh_1*10 + ash_2*bsh_2) //100
if len(a) == 1:
    res = int(a)*bsh_0 + kuri
elif len(a) == 2:
    a1 = a[:-1]
    res = int(a)*bsh_0 + int(a1)*bsh_1 + kuri
else:
    a1 = a[:-1]
    a2 = a[:-2]
    res = int(a)*bsh_0 + int(a1)*bsh_1 + int(a2)*bsh_2 + kuri
print(res)
Buggy python submission (verdict: Runtime Error):
a,b,c,k = map(int, input().split())

ti = [1] * a
[ti.append(0) for _ in range(b)]
[ti.append(-1) for _ in range(c)]

res = 0
for i in range(k):
    res += ti[i]
print(res)

Fixed submission:
a,b,c,k = map(int, input().split())

a_ = k - a
b_ = k - a - b

res = 0
if a_ <= 0:
    res += k
elif b_ <= 0:
    res += a 
else:
    res += a - b_

print(res)
Buggy python submission (verdict: Runtime Error):
import numpy as np


n,m,x = map(int, input().split())
lis = [np.asarray(list(map(int, input().split()))) for _ in range(n)]
lis = np.array(lis)

res = []
for i in range(2**n):
    t = np.array([0]*(m+1))
    for j in range(n):
        if ((i >> j) & 1):
            t += lis[j]
    res.append(t)

res = np.array(res)

z = 10**10

for i in res:
    if np.amin(i[1:m]) >= x and i[0] < z:
        z = i[0]

print(z if z != 10**10 else -1)

Fixed submission:
import numpy as np
import math


n,m,x = map(int, input().split())
lis = [np.asarray(list(map(int, input().split()))) for _ in range(n)]
lis = np.array(lis)

res = []
for i in range(2**n):
    t = np.array([0]*(m+1))
    for j in range(n):
        if ((i >> j) & 1):
            t += lis[j]
    res.append(t)

res = np.array(res)

z = math.inf

for i in res:
    if np.amin(i[1:]) >= x and i[0] < z:
        z = i[0]

print(z if z != math.inf else -1)

Buggy python submission (verdict: Runtime Error):
import numpy as np


n,m,x = map(int, input().split())
lis = [np.asarray(list(map(int, input().split()))) for _ in range(n)]
lis = np.array(lis)

res = []
for i in range(2**n):
    t = np.array([0]*(n+1))
    for j in range(n):
        if ((i >> j) & 1):
            t += lis[j]
    res.append(t)

res = np.array(res)

z = 10**10

for i in res:
    if np.amin(i[1:m]) >= x and i[0] < z:
        z = i[0]

print(z)

Fixed submission:
import numpy as np
import math


n,m,x = map(int, input().split())
lis = [np.asarray(list(map(int, input().split()))) for _ in range(n)]
lis = np.array(lis)

res = []
for i in range(2**n):
    t = np.array([0]*(m+1))
    for j in range(n):
        if ((i >> j) & 1):
            t += lis[j]
    res.append(t)

res = np.array(res)

z = math.inf

for i in res:
    if np.amin(i[1:]) >= x and i[0] < z:
        z = i[0]

print(z if z != math.inf else -1)
Buggy python submission (verdict: Time Limit Exceeded):
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

n,m = nm()
h = nl()
path = [[False]*n for _ in range(n)]

for i in range(n):
    path[i][i] = True 

for i in range(m):
    a,b = nm()
    path[a-1][b-1] = path[b-1][a-1] = True

res = 0
for i,j in enumerate(path):
    temp = []
    for k,l in enumerate(j):
        if l:
            temp.append(h[k])
    ma = max(temp)
    if temp.count(ma) == 1 and  ma == h[i]:
        res += 1

print(res)

Fixed submission:

n,m = map(int, input().split(' '))
h = list(map(int, input().split(' ')))
a = [list(map(int, input().split(' '))) for _ in range(m)]

res = [set() for _ in range(n)]

for i,j in a:
    res[i-1].add(j-1)
    res[j-1].add(i-1)
ans = 0
res = [j if j != set() else set([i]) for i,j in enumerate(res)]
for i in range(n):
    for j in res[i]:
        if i == j:
            ans += 1
            break
        if h[i] <= h[j]:
            break
    else:
        ans += 1
print(ans)

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

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

n,m = nm()
h = nl()
path = [[False]*n for _ in range(n)]

for i in range(n):
    path[i][i] = True 

for i in range(m):
    a,b = nm()
    path[a-1][b-1] = path[b-1][a-1] = True

res = 0
for i,j in enumerate(path):
    temp = []
    for k,l in enumerate(j):
        if l:
            temp.append(h[k])
    ma = max(temp)
    if temp.count(ma) == 1 and  ma == h[i]:
        res += 1

print(res)

Fixed submission:

n,m = map(int, input().split(' '))
h = list(map(int, input().split(' ')))
a = [list(map(int, input().split(' '))) for _ in range(m)]

res = [set() for _ in range(n)]

for i,j in a:
    res[i-1].add(j-1)
    res[j-1].add(i-1)
ans = 0
res = [j if j != set() else set([i]) for i,j in enumerate(res)]
for i in range(n):
    for j in res[i]:
        if i == j:
            ans += 1
            break
        if h[i] <= h[j]:
            break
    else:
        ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
from itertools import combinations_with_replacement as comb

n,m,q = map(int, input().split(' '))
lis = [list(map(int, input().split())) for _ in range(q)]
tes = comb(range(1,m))
res = 0
for i in tes:
    te = 0
    for a,b,c,d in lis:
        if c == i[b-1] - i[a-1]:
            te += d
    res = max(te,res)
print(res)

Fixed submission:
from itertools import combinations_with_replacement as comb

n,m,q = map(int, input().split(' '))
lis = [list(map(int, input().split())) for _ in range(q)]
tes = comb(range(1,m+1),n)
res = 0
for i in tes:
    te = 0
    for a,b,c,d in lis:
        if c == i[b-1] - i[a-1]:
            te += d
    res = max(te,res)
print(res)
Buggy python submission (verdict: Runtime Error):
n,m=map(int, input().split(' '))
a = list(map(int, input().split()))
res = n-sum(a)
print(res if res >= 0 else -1

Fixed submission:
n,m=map(int, input().split(' '))
a = list(map(int, input().split()))
res = n-sum(a)
print(res if res >= 0 else -1)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

a = list(map(int, input().split(' ')))
for i in range(n):
    print(a.count(i+1))

Fixed submission:
n = int(input())

a = list(map(int, input().split(' ')))
res = [0]*n
for i in a:
    res[i-1] += 1

[print(i) for i in res]
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
red = s.count('R')
green = s.count('G')
blue = s.count('B')
res = red * green * blue
k = n//2
for i in range(n-2):
    for t in range(i+1,((n-1+i)//2)+1):
        if set((s[i],s[t],s[2*t-i])) == set(('R','G','B')):
            res -= 1
print(res)

Fixed submission:
n = int(input())
s = input()
red = s.count('R')
green = s.count('G')
blue = s.count('B')
res = red * green * blue
k = n//2
for i in range(n-2):
    for t in range(i+1,((n-1+i)//2)+1):
        if set((s[i],s[t],s[2*t-i])) == set(('R','G','B')):
            res -= 1
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
red = s.count('R')
green = s.count('G')
blue = s.count('B')
res = red * green * blue
for i in range(n-2):
    t = i+1
    while 2*t-i <= n-1:
        if set((s[i],s[t],s[2*t-i])) == set(('R','G','B')):
            res -= 1
        t += 1
print(res)

Fixed submission:
n = int(input())
s = input()
red = s.count('R')
green = s.count('G')
blue = s.count('B')
res = red * green * blue
k = n//2
for i in range(n-2):
    for t in range(i+1,((n-1+i)//2)+1):
        if set((s[i],s[t],s[2*t-i])) == set(('R','G','B')):
            res -= 1
print(res)
Buggy python submission (verdict: Runtime Error):
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
a_ = set(a)
x = Counter(a)
y = []
for i in a_:
    t = x[i]
    y.append(t*(t-1)//2)
res = sum(y)
for i in a:
    t = x[i]
    t_ = y[i-1]
    print(res-t_+(t-1)*(t-2)//2)

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
a_ = set(a)
x = Counter(a)
y = {i:x[i]*(x[i]-1)//2 for i in a_}

res = sum(y.values())
for i in a:
    t = x[i]
    t_ = y[i]
    print(res-t_+(t-1)*(t-2)//2)

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

n = int(input())
a = list(map(int, input().split()))
a_ = set(a)
dic = {x:{} for x in a_}
lis = {i:a.count(i) for i in a_}
for i in a_:
    res =0
    for j in a_:
        k = lis[j]
        if i == j:
            k -= 1
            if k > 1:
                x = math.factorial(k) // (math.factorial(k-2) * math.factorial(2))
                res += x
        else:
            if k > 1:
                x = math.factorial(k) // (math.factorial(k-2) * math.factorial(2))
                res += x
    dic[i] = res
for i in a:
    print(dic[i])

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
a_ = set(a)
x = Counter(a)
y = {i:x[i]*(x[i]-1)//2 for i in a_}

res = sum(y.values())
for i in a:
    t = x[i]
    t_ = y[i]
    print(res-t_+(t-1)*(t-2)//2)

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

n = int(input())
a = list(map(int, input().split()))
for i in range(n):
    a_ = a.copy()
    res = 0
    a_.pop(i)
    a_ = sorted(a_)
    a__ = set(a_)
    for j in a__:
        k = a_.count(j)
        if k != 1:
            res += math.factorial(k) // (math.factorial(k-2) * math.factorial(2))
    print(res)

Fixed submission:
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
a_ = set(a)
x = Counter(a)
y = {i:x[i]*(x[i]-1)//2 for i in a_}

res = sum(y.values())
for i in a:
    t = x[i]
    t_ = y[i]
    print(res-t_+(t-1)*(t-2)//2)
Buggy python submission (verdict: Runtime Error):
for i in range(3):
    for j in a[i]:
        if j != 0:
            break
    else:
        print('Yes')
        break
    if a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0:
        print('Yes')
        break
    if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
        print('Yes')
        break
    if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
        print('Yes')
        break
else:
    print('No')

Fixed submission:
a = [list(map(int, input().split(' '))) for _ in range(3)]
n = int(input())
for _ in range(n):
    b = int(input())
    for i in range(3):
        for j in range(3):
            if a[i][j] == b:
                a[i][j] = 0

for i in range(3):
    for j in a[i]:
        if j != 0:
            break
    else:
        print('Yes')
        break
    if a[0][i] == 0 and a[1][i] == 0 and a[2][i] == 0:
        print('Yes')
        break
    if a[0][0] == 0 and a[1][1] == 0 and a[2][2] == 0:
        print('Yes')
        break
    if a[0][2] == 0 and a[1][1] == 0 and a[2][0] == 0:
        print('Yes')
        break
else:
    print('No')
Buggy python submission (verdict: Time Limit Exceeded):
import heapq as hp
n = int(input())
p = list(map(int, input().split(' ')))
res = 0
for i in range(n):
    q = []
    for j in range(i+1):
        hp.heappush(q,p[j])
    if hp.heappop(q) >= p[i]:
        res += 1
print(res)

Fixed submission:
n = int(input())
p = list(map(int, input().split(' ')))
res = 0
y = p[0]
for i in range(n):
    z = p[i]
    if y >= z:
        y = z
        res += 1
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
p = list(map(int, input().split(' ')))
res = 0
for i in range(n):
    x = p[:i+1]
    if min(x) >= p[i]:
        res += 1
print(res)

Fixed submission:
n = int(input())
p = list(map(int, input().split(' ')))
res = 0
y = p[0]
for i in range(n):
    z = p[i]
    if y >= z:
        y = z
        res += 1
print(res)
Buggy python submission (verdict: Runtime Error):
c = input()
a = 'abcdefchijklmnopqrstu'
print(a[a.index(c)+1])

Fixed submission:
c = input()
a = 'abcdefghijklmnopqrstuvwxyz'
print(a[a.index(c)+1])
Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split(' '))
for i in range(m):
    l, r = map(int, input().split(' '))
    if i == 0:
        s = [l, r]
        continue
    else:
        result = []
        for j in range(s[0], s[1]+1):
            if l <= j <= r:
                result += [j]
        s[0] = min(result)
        s[1] = max(result)
print(s[1] - s[0] + 1)

Fixed submission:
n, m = map(int, input().split(' '))
l_ = []
r_ = []
for i in range(m):
    l,r = map(int, input().split(' '))
    l_ += [l]
    r_ += [r]
l = max(l_)
r = min(r_)
if n < l:
    print(0)
elif n < r:
    r = n
    print(r - l + 1)
elif l > r:
    print(0)
elif l == r:
    print(1)
else:
    print(r - l + 1)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split(' '))
for i in range(m):
    l, r = map(int, input().split(' '))
    a = set(j for j in range(l, r+1))
    if i == 0:
        result = a
    else:
        result = result & a
print(len(list(result)))

Fixed submission:
n, m = map(int, input().split(' '))
l_ = []
r_ = []
for i in range(m):
    l,r = map(int, input().split(' '))
    l_ += [l]
    r_ += [r]
l = max(l_)
r = min(r_)
if n < l:
    print(0)
elif n < r:
    r = n
    print(r - l + 1)
elif l > r:
    print(0)
elif l == r:
    print(1)
else:
    print(r - l + 1)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split(' '))
s = []
for i in range(m):
    l, r = map(int, input().split(' '))
    a = set(j for j in range(l, r+1))
    s.append(a)
result = s[0]
for i in range(len(s)-1):
    result = result & s[i+1]
print(len(list(result)))

Fixed submission:
n, m = map(int, input().split(' '))
l_ = []
r_ = []
for i in range(m):
    l,r = map(int, input().split(' '))
    l_ += [l]
    r_ += [r]
l = max(l_)
r = min(r_)
if n < l:
    print(0)
elif n < r:
    r = n
    print(r - l + 1)
elif l > r:
    print(0)
elif l == r:
    print(1)
else:
    print(r - l + 1)
Buggy python submission (verdict: Time Limit Exceeded):
R, G, B, N = map(int, input().split(' '))
count = 0
for i in range((N // R)+1):
    for j in range((N // G)+1):
        tmp = N - (R * i + G * j)
        if tmp < 0:
            break
        if tmp == 0:
            count += 1
        elif tmp % B == 0:
            count += 1
print(count)

Fixed submission:
R, G, B, N = map(int, input().split(' '))
count = 0
for i in range((N // R)+1):
    for j in range((N // G)+1):
        tmp = N - (R * i + G * j)
        if tmp < 0:
            break
        if tmp == 0:
            count += 1
        elif tmp % B == 0:
            count += 1
print(count)
Buggy python submission (verdict: Runtime Error):
import re

N, S = map(int, input().split(' '))
pattern = "AC+"
T = input()
for _ in range(S):
    fir,fin = map(int, input().split(' '))
    result = re.findall(pattern, T[fir -1:fin])
    print(len(result))

Fixed submission:
dic = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
b = input()
print(dic[b])

Buggy python submission (verdict: Runtime Error):
import re

N, S = map(int, input().split(' '))
pattern = "AC+"
T = input()
for _ in range(S):
    first,final = map(int, input().split(' '))
    print(first, final)
    result = re.findall(pattern, T[first -1:final])
    print(result)
    print(len(result))

Fixed submission:
dic = {'A': 'T', 'T': 'A', 'C': 'G', 'G': 'C'}
b = input()
print(dic[b])
Buggy python submission (verdict: Runtime Error):
info = input().split(' ')
num_one = int(info[0])
num_two = int(info[1])
num_class = int(info[2])
one_list = [i for i in range(1,num_one + 1) if num_one % i == 0]
two_list = [i for i in range(1,num_two + 1) if num_one % i == 0]
one_set = set(one_list)
two_set = set(two_list)
match_set = one_set & two_set
match_list = list(match_set)
match_list.sort()
print(match_list[num_class-1])

Fixed submission:
info = input().split(' ')
price = int(info[0])
money = int(info[1])
max_time = int(info[2])
times = money // price
if times <= max_time:
  print(times)
else:
  print(max_time)
Buggy python submission (verdict: Time Limit Exceeded):
from itertools import dropwhile as dw

D,G = map(int, input().split(' '))
p_dict = {}
op = []
for i in range(D):
    j, k = map(int, input().split(' '))
    op += [100*(i+1)] * j
    p_dict[i] = (j, k)

leng = len(op)
min_op = 10 ** 8
for i in range(2 ** leng):
    op_list = op.copy()
    for j in range(leng):
        if ((i >> j) & 1):
            op_list[-1*(j+1)] = 0
    result = sum(op_list)
    op_list.sort()
    count = len(list(dw(lambda x: x == 0, op_list)))
    for k in p_dict.keys():
        if op_list.count(100*(k+1)) == p_dict[k][0]:
            result += p_dict[k][1]
    if result >= G and count < min_op:
        min_op = count
print(min_op)









Fixed submission:
import sys
import math

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

d,g = nm()
comp = [nl() for _ in range(d)]
ans = 10**10
check = set([i for i in range(d)])
for i in range(2**d):
    res = 0
    times = 0
    visited = set()
    for j in range(d):
        if (i >> j) & 1:
            res += 100 * (j+1)*comp[j][0] + comp[j][1]
            times += comp[j][0]
            visited.add(j)
    if res < g:
        ma = max(check-visited)
        waru =  100 * (ma+1)
        waru_times = math.ceil((g-res)/waru)
        res += 100*waru_times*waru
        if waru_times > comp[ma][0]-1 or res < g:
            continue
        times += waru_times
        if ans > times:
            ans = times
    elif res >= g:
        if ans > times:
            ans = times
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

readline = sys.stdin.readline
readall = sys.stdin.read
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split(''))
nl = lambda: list(map(int, readline().split()))
prl = lambda x: print(*x ,sep='\n')

a = ns()
for i in range(2**3):
    ans = f'{a[-1]}'
    for j in range(3):
        if (i >> j) & 1:
            ans = a[-1-(j+1)] + '+' + ans
        else:
            ans = a[-1-(j+1)] + '-' + ans
    if eval(ans) == 7:
        print(ans+'=7')
        break

Fixed submission:
n = input()
op_cnt = len(n) - 1
for i in range(2 ** op_cnt):
    op = ['-'] * op_cnt
    for j in range(op_cnt):
        if ((i >> j) & 1):
            op[op_cnt - 1 - j] = '+'
    
    formula = ''
    for p_n, p_o in zip(n, op + ['']):
        formula += p_n + p_o
    result = eval(formula)
    if result == 7:
        print(formula + '=7')
        break
Buggy python submission (verdict: Time Limit Exceeded):
K, S = map(int, input().split(' '))
count = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            result = x + y + z
            if result == S:
                count += 1
print(count)

Fixed submission:
K, S = map(int, input().split(' '))
count = 0
for x in range(K+1):
    t1 = S - x
    for y in range(K+1):
        z = S - x - y
        if 0 <= z <= K:
            count+=1
print(count)