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

Fixed submission:
from collections import defaultdict


int_n = int(input())

counter = defaultdict(int)

for i in range(int_n):
    counter[int(input())] += 1

written = 0
for c in counter.values():
    if c % 2 == 1:
        written += 1


print(written)

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

ar_int_a = []
for i in range(int_n):
    ar_int_a.append(int(input()))

numbers = set(ar_int_a)

# written = [i for i in numbers if ar_int_a.count(i) % 2 == 1]
written = len((i for i in numbers if ar_int_a.count(i) % 2 == 1))

# print(len(written))
print(written)
Problem p03633 (python)

Fixed submission:
from fractions import gcd


n = int(input())
li_t = list()

for _ in range(n):
    li_t.append(int(input()))

# a * b = 最小公倍数 * 最大公約数


def lcm(a, b):
    return (a * b) // gcd(a, b)

work = 1

for t in li_t:
    work = lcm(work, t)

print(work)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
li_t = list()

for _ in range(n):
    li_t.append(int(input()))

# a * b = 最小公倍数 * 最大公約数


def lcm(a, b):
    return (a * b) // math.gcd(a, b)

work = 1

for t in li_t:
    work = lcm(work, t)

print(work)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
li_t = list()

for _ in range(n):
    li_t.append(int(input()))

# a * b = 最小公倍数 * 最大公約数


def lcm(a, b):
    return (a * b) // math.gcd(a, b)


work = li_t.pop(0)

for t in li_t:
    work = lcm(work, t)

print(work)

Buggy submission (verdict: Runtime Error):
import math

n = int(input())
li_t = list()

for _ in range(n):
    li_t.append(int(input()))

# a * b = 最小公倍数 * 最大公約数

def lcm(a, b):
    return (a * b) // math.gcd(a, b)

work = li_t.pop(0)

for t in li_t:
    work = lcm(work, t)

print(work)
Problem p03699 (python)

Fixed submission:
int_n = int(input())

ar_int_s = list()

for i in range(int_n):
    ar_int_s.append(int(input()))


if sum(ar_int_s) % 10 != 0:
    print(sum(ar_int_s))
else:
    li_minus = list(filter(lambda x: x % 10 != 0, ar_int_s))
    if len(li_minus) == 0:
        print(0)
    else:
        print(sum(ar_int_s) - min(li_minus))

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

ar_int_s = list()

for i in range(int_n):
    ar_int_s.append(int(input()))

minused = list()

for i in range(int_n):
    if (sum(ar_int_s) - sum(minused)) % 10 != 0:
        break
    else:
        minused.append(sorted(ar_int_s)[i:i])

print(sum(ar_int_s) - sum(minused))
Problem p03779 (python)

Fixed submission:
x = int(input())

w = 0
for i in range(1, x + 1):
    w += i
    if w >= x:
        print(i)
        exit(0)

Buggy submission (verdict: Runtime Error):
from itertools import combinations

int_x = int(input())

answer = int_x

for i in range(1, int_x + 1):
    c = combinations(range(1, int_x + 1), i)
    for w_c in c:
        if sum(w_c) == int_x:
            answer = min(answer, max(w_c))
print(answer)

Buggy submission (verdict: Runtime Error):
import itertools

int_x = int(input())
answer = int_x
for i in range(1, int_x + 1):
    for v in itertools.combinations(range(1, int_x + 1), i):
        if sum(v) == int_x:
            answer = min(answer, max(v))
print(answer)

Buggy submission (verdict: Runtime Error):
import itertools

int_x = int(input())
answer = int_x
for i in range(1, int_x):
    for v in itertools.combinations(range(1, int_x + 1), i):
        if sum(v) == int_x:
            answer = min(answer, max(v))
print(answer)
Problem p03854 (python)

Fixed submission:
int_s = input()
str_sr = int_s[::-1]


str_a = ['dream', 'dreamer', 'erase', 'eraser']

str_r = list(map(lambda x: x[::-1], str_a))

result = True

while len(str_sr):
    currnt_flg = False
    for r in str_r:
        # print('r:' + r)
        if len(str_sr) >= len(r) and str_sr[:len(r)] == r:
            # print('ok')
            str_sr = str_sr[len(r):]
            # print(str_sr)
            current_flg = True
            break
    else:
        result = False
        break

if result:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
int_s = input()
str_sr = int_s[::-1]


str_a = ['dream', 'dreamer', 'erase', 'eraser']

str_r = list(map(lambda x: x[::-1], str_a))

result = True

while len(str_sr):
    currnt_flg = False
    for r in str_r:
        print('r:' + r)
        if len(str_sr) >= len(r) and str_sr[:len(r)] == r:
            print('ok')
            str_sr = str_sr[len(r):]
            print(str_sr)
            current_flg = True
            break
    else:
        result = False
        break

if result:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
int_s = input()
str_sr = int_s[::-1]


str_a = ['dream', 'dreamer', 'erase', 'eraser']

str_r = list(map(lambda x: x[::-1], str_a))

result = True

while len(str_sr):
    currnt_flg = False
    for r in str_r:
        print('r:' + r)
        if len(str_sr) >= len(r) and str_sr[:len(r)] == r:
            print('ok')
            str_sr = str_sr[len(r):]
            print(str_sr)
            current_flg = True
            break
    else:
        result = False
        break

if result:
    print('YES')
else:
    print('No')
Problem p02720 (python)

Fixed submission:
#!/usr/bin/env python3
ans = [0] * 10
ans[1] = '1'
for i in range(2, 10):
    ans[i] = str(i)
alpha = "0123456789"
def dfs(s):
    if len(s) == N:
        ans.append(s)
        if len(ans) >= 100001:
            return
    else:
        for c in range(int(s[-1])-1,int(s[-1])+2):
            if c >= 0:
                dfs(s+str(c))
            if c == 9:
                break
K = int(input())
N = 2
while len(ans) < 100001:
    for i in range(1, 10):
        dfs(str(i))
        if len(ans) >= 100001:
            break
    N+=1

print(ans[K])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
ans = [0] * 10
ans[1] = '1'
for i in range(2, 10):
    ans[i] = str(i)
alpha = "0123456789"
def dfs(s):
    if len(s) == N:
        ans.append(s)
        if len(ans) >= 100001:
            return
    else:
        for c in range(int(s[-1])-1,int(s[-1])+2):
            if c >= 0:
                dfs(s+str(c))
            if c == '9':
                break
K = int(input())
N = 2
while len(ans) < 100001:
    for i in range(1, 10):
        dfs(str(i))
        if len(ans) >= 100001:
            break
    N+=1

print(ans[K])

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
ans = [0] * 10
ans[1] = '1'
for i in range(2, 10):
    ans[i] = str(i)
alpha = "0123456789"
def dfs(s):
    if len(s) == N:
        ans.append(s)
        if len(ans) >= 100001:
            return
    else:
        for c in (int(s[-1])-1,int(s[-1])+2):
            if c >= 0:
                dfs(s+str(c))
            if c == '9':
                break
K = int(input())
N = 2
while len(ans) < 100001:
    for i in range(1, 10):
        dfs(str(i))
        if len(ans) >= 100001:
            break
    N+=1

print(ans[K])
Problem p02787 (python)

Fixed submission:
inf = 10**9
H, N = map(int, input().split())
AB = [[0, 0] for i in range(N)]
for i in range(N):
    AB[i][0], AB[i][1] = map(int, input().split())
AB.sort()
T = [[inf for i in range(H+1)] for j in range(N)]
for i in range(N):
    T[i][0] = 0
    if i == 0:
        for j in range(1, H+1):
            if j % AB[i][0] > 0:
                T[i][j] = AB[0][1] * (j // AB[0][0] + 1)
            else:
                T[i][j] = AB[0][1] * (j // AB[0][0])
    else:
        for j in range(1, min(AB[i][0], H+1)):
            T[i][j] = min(T[i-1][j], AB[i][1])
        for j in range(AB[i][0], H+1):
            T[i][j] = min(T[i-1][j], T[i][j - AB[i][0]]+AB[i][1])
print(T[N-1][H])

Buggy submission (verdict: Runtime Error):
inf = 10**9
H, N = map(int, input().split())
AB = [[0, 0] for i in range(N)]
for i in range(N):
    AB[i][0], AB[i][1] = map(int, input().split())
AB.sort()
T = [[inf for i in range(H+1)] for j in range(N)]
for i in range(N):
    T[i][0] = 0
    if i == 0:
        for j in range(1, H+1):
            if j % AB[i][0] > 0:
                T[i][j] = AB[0][1] * (j // AB[0][0] + 1)
            else:
                T[i][j] = AB[0][1] * (j // AB[0][0])
    else:
        for j in range(1, AB[i][0]):
            T[i][j] = min(T[i-1][j], AB[i][1])
        for j in range(AB[i][0], H+1):
            T[i][j] = min(T[i-1][j], T[i][j - AB[i][0]]+AB[i][1])
print(T[N-1][H])

Buggy submission (verdict: Runtime Error):
inf = 10**9
H, N = map(int, input().split())
AB = [[0, 0] for i in range(N)]
for i in range(N):
    AB[i][0], AB[i][1] = map(int, input().split())
AB.sort()
T = [[inf for i in range(H+1)] for j in range(N)]
for i in range(N):
    T[i][0] = 0
    if i == 0:
        for j in range(1, H+1):
            if j % AB[i][0] > 0:
                T[i][j] = AB[0][1] * (j // AB[0][0] + 1)
            else:
                T[i][j] = AB[0][1] * (j // AB[0][0])
    else:
        for j in range(1, AB[i][0]):
            T[i][j] = T[i-1][j]
        for j in range(AB[i][0], H+1):
            T[i][j] = min(T[i-1][j], T[i][j - AB[i][0]]+AB[i][1])
print(T[-1][-1])

Buggy submission (verdict: Runtime Error):
inf = 10**9
H, N = map(int, input().split())
AB = [[0, 0] for i in range(N)]
for i in range(N):
    AB[i][0], AB[i][1] = map(int, input().split())
AB.sort()
T = [[inf for i in range(H+1)] for j in range(N)]
for i in range(N):
    T[i][0] = 0
    if i == 0:
        for j in range(1, H+1):
            if j % AB[i][0] > 0:
                T[i][j] = AB[0][1] * (j // AB[0][0] + 1)
            else:
                T[i][j] = AB[0][1] * (j // AB[0][0])
    else:
        for j in range(1, H+1):
            T[i][j] = min(T[i-1][j], T[i][j - AB[i][0]]+AB[i][1])
print(T[-1][-1])
Problem p02853 (python)

Fixed submission:
X, Y = map(int, input().split())
ans = 0
k = [3, 2, 1]
if X <= 3:
    ans += k[X-1]
if Y <= 3:
    ans += k[Y-1]
if X == 1 and Y == 1:
    ans += 4
print(ans * 100000)

Buggy submission (verdict: Runtime Error):
X, Y = map(int, input().split())
ans = 0
k = [3, 2, 1]
if X <= 3:
    ans += k[X-1]
if Y <= 3:
    ans += k[X-1]
if X == 1 and Y == 1:
    ans += 4
print(ans * 100000)
Problem p02913 (python)

Fixed submission:
N = int(input())
S = str(input())
dp = [[0 for i in range(N+1)] for i in range(N+1)]

for i in reversed(range(N)):
    for j in reversed(range(N)):
        if S[i] == S[j]:
            dp[i][j] = dp[i+1][j+1] + 1
ans = 0
for i in range(N):
    for j in range(N):
        if j > i:
            tmp = min(j-i,dp[i][j])
            ans = max(tmp,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())
dp = [[0 for i in range(N)] for i in range(N+1)]

for i in reversed(range(N)):
    for j in reversed(range(N)):
        if S[i] == S[j]:
            dp[i][j] = dp[i+1][j+1] + 1
ans = 0
for i in range(N):
    for j in range(N):
        tmp = dp[i][j]
        if j >= i:
            tmp = min(j-i,tmp)
        ans = max(tmp,ans)
print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
S = str(input())
dp = [[0] for i in range(N+1)]

for i in reversed(range(N)):
    for j in reversed(range(N)):
        if S[i] == S[j]:
            dp[i][j] = dp[i+1][j+1] + 1
ans = 0
for i in range(N):
    for j in range(N):
        tmp = dp[i][j]
        if j >= i:
            tmp = min(j-i,tmp)
        ans = max(tmp,ans)
print(ans)
Problem p02936 (python)

Fixed submission:
N, Q = map(int, input().split())
d = [0 for i in range(N)]

for i in range(N-1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    d[b] = a
ans = [0 for i in range(N)]

for i in range(Q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x

for i in range(1, N):
    ans[i] += ans[d[i]]

print(*ans)

Buggy submission (verdict: Runtime Error):
def main():
    import sys
	sys.setrecursionlimit(700000)
	N, Q = map(int, input().split())
	d = [[] for i in range(N)]

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

	ans = [0]*N

	for i in range(Q):
    	p, x = map(int, input().split())
    	p -= 1
    	ans[p] += x

	def dfs(cur, parent):
    	for child in d[cur]:
        	if child != parent:
            	ans[child] += ans[cur]
            	dfs(child,cur)
	dfs(0,-1) 

	print(*ans)
    
main()

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
d = [[] for i in range(N)]

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

ans = [0 for i in range(N)]

for i in range(Q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x

def dfs(cur, parent):
    for child in d[cur]:
        if child != parent
            ans[child] += ans[cur]
            dfs(child,car)
dfs(0,-1) 

print(*ans)

Buggy submission (verdict: Runtime Error):
from collections import defaultdict
from collections import deque

def setD(d, N):
    for i in range(N):
        d[i] = setsub(d, i)
            
def setsub(d, i):
    tmp = deque()
    for x in d[i]:
        tmp.append(x)
        if d[x] != 0:
            tmp += setsub(d, x)
    return tmp

N, Q = map(int, input().split())
d = defaultdict(deque)

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

setD(d, N)

ans = [0 for i in range(N)]

for i in range(Q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x
    for i in d[p]:
        ans[i] += x


for i in range(N):
    ans[i] = str(ans[i])
print(" ".join(ans))
Problem p02969 (python)

Fixed submission:
r = int(input())
print(3*(r**2))

Buggy submission (verdict: Runtime Error):
N = int(input())
memo = 1
ans = []
tmp = int(input())
for i in range(1,N):
    A = int(input())
    if A <= tmp:
        memo += 1
    else:
        ans.append(memo)
        memo = 1
    tmp = A
ans.append(memo)
print(max(ans))
Problem p02997 (python)

Fixed submission:
N,K = map(int, input().split())
memo = (N-1)*(N-2)//2
if K <= memo:
    print((N-1) + memo - K)
    for i in range(2,N+1):
        print(1,i)
    cnt = 0
    i = 2
    j = i + 1
    while cnt < memo-K:
        while j <= N and cnt < memo-K:
            print(i,j)
            j += 1
            cnt += 1
        i += 1
        j = i + 1
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
memo = (N-1)*(N-2)//2
if K <= memo:
    print(((N-1) + memo - K)
    for i in range(2,N+1):
        print("1 " + str(i))
    tmp = 1
    i = 1
    j = i + 1
    while tmp < memo-K:
        while j <= N and tmp < memo-K:
            print(str(i) + " " + str(j))
            j += 1
            tmp += 1
        i += 1
        j = i + 1
else:
    print(-1)
Problem p03005 (python)

Fixed submission:
N,K = map(int, input().split())
if K > 1:
    print(N-K)
else:
    print(0)

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

Buggy submission (verdict: Runtime Error):
N,K = map(int,input())
print(N%K)
Problem p03006 (python)

Fixed submission:
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
xy.sort()
from collections import defaultdict
d = defaultdict(int)
for i in range(N):
    for j in range(i+1,N):
        tmp = (xy[j][0]-xy[i][0],xy[j][1]-xy[i][1])
        d[tmp] += 1
if N == 1:
    print(1)
else:
    print(N-max(d.values()))

Buggy submission (verdict: Runtime Error):
N = int(input())
xy = [list(map(int,input().split())) for i in range(N)]
xy.sort()
from collections import defaultdict
d = defaultdict(int)
for i in range(N):
    for j in range(i+1,N):
        tmp = (xy[j][0]-xy[i][0],xy[j][1]-xy[i][1])
        d[tmp] += 1
print(N-max(d.values()))
Problem p03043 (python)

Fixed submission:
N, K = map(int, input().split())
ans = 0
for i in range(1,N+1):
    tmp = i
    memo = 0
    while tmp < K:
        memo += 1
        tmp *= 2
    ans += 0.5 ** memo
print(ans/N)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
log = 18
dp = [[0 for i in range(K+1)] for j in range(log)]
for i in range(1,N+1):
    dp[0][i] = 1/N
if  K%2 == 0:
    lim = K//2 - 1
else:
    lim = K//2
for i in range(1,log):
    j = 2
    while j <= K-1:
        dp[i][j] = dp[i-1][j//2] / 2
        j += 2
    dp[i][K] = dp[i-1][K] + sum(dp[i-1][lim+1:K-1])/2
print(dp[log-1][K])
Problem p03047 (python)

Fixed submission:
N, K = map(int, input().split())
print(N-K+1)

Buggy submission (verdict: Runtime Error):
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)
Problem p03048 (python)

Fixed submission:
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0
    while r*R + g*G <= N:
        if (N - r*R - g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)

Buggy submission (verdict: Runtime Error):
R, G, B, N = map(int, input().split())
ans = 0
r=0
while r*R <= N:
    g=0:
    while r*R + g*G <= N:
        if (r*R + g*G) % B == 0:
            ans += 1
        g += 1
    r += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N, R, G, B = map(int, input().split())
ans = 0
for i in range(R):
    for j in range(G):
        if 0 <= N-i-j <= b:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
N=int(input())
print(N*(N+1)*(2*N+1)//6)

Buggy submission (verdict: Runtime Error):
N=int(input())
print(N*(N+1)*(2*n+1)//6)
Problem p03071 (python)

Fixed submission:
A, B = map(int, input().split())
if max(A,B) - min(A,B) >= 1:
    answer = max(A,B) * 2 - 1
else:
    answer = 2 * max(A,B)
print(answer)

Buggy submission (verdict: Runtime Error):
N, K = map(int, input().split())
S = str(input())
S_list = []
cum_list = [0]
tmp = 1
count = 0
if "0" not in S:
    print(len(S))
else:
    for i in range(N):
        if i == 0:
            if int(S[i]) == tmp:
                count += 1
            else:
                S_list.append(count)
                count = 1
        else:
            if S[i] == S[i - 1]:
                count += 1
                if i == N - 1:
                    S_list.append(count)
            else:
                S_list.append(count)
                count = 1


    if S[-1] == "0":
        S_list.append(0)




    now = 0
    for i in range(len(S_list)):
        now += S_list[i]
        cum_list.append(now)
    def check(x,K):
        answer_list = []
        i = 0
        if i + 2 * K + 1 < len(x):
            while i + 2 * K + 1 < len(x):
                answer_list.append(x[i + 2 * K + 1] - x[i])
                i += 2
            return answer_list
        elif K > 0:
            check(x,K-1)
    answer_list = check(cum_list,K)

    answer = max(answer_list)
    print(answer)
Problem p03076 (python)

Fixed submission:
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

list_1 = [A, B, C, D, E]
list_2 = [a, b, c, d, e]
list_2_2 = []
for x in list_2:
    if x != 0:
        list_2_2.append(x)
if list_2_2 != []:
	smallest = min(list_2_2)
else:
  	smallest = 10

list_3 = []

count = 0
for i in range(5):
    if list_2[i] == smallest and count % 10 == 0:
        list_3.append(list_1[i])
    elif list_2[i] != 0:
        list_3.append(list_1[i] - list_2[i] + 10)
    else:
        list_3.append(list_1[i])
    count += list_3[i]

sum = 0
for x in list_3:
    sum += x
    
print(sum)

Buggy submission (verdict: Runtime Error):
A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

a = A % 10
b = B % 10
c = C % 10
d = D % 10
e = E % 10

list_1 = [A, B, C, D, E]
list_2 = [a, b, c, d, e]
list_2_2 = []
for x in list_2:
    if x != 0:
        list_2_2.append(x)

smallest = min(list_2_2)

list_3 = []

count = 0
for i in range(5):
    if list_2[i] == smallest and count % 10 == 0:
        list_3.append(list_1[i])
    elif list_2[i] != 0:
        list_3.append(list_1[i] - list_2[i] + 10)
    else:
        list_3.append(list_1[i])
    count += list_3[i]

sum = 0
for x in list_3:
    sum += x
    
print(sum)
Problem p03085 (python)

Fixed submission:
b = str(input())
if b == "A":
    print("T")
elif b == "T":
    print("A")
elif b == "C":
    print("G")
elif b == "G":
    print("C")

Buggy submission (verdict: Runtime Error):
b = str(input())
if b = "A":
    print("T")
elif b = "T":
    print("A")
elif b = "C":
    print("G")
elif b = "G":
    print("C")
Problem p03087 (python)

Fixed submission:
N, Q = map(int, input().split())
S = str(input())
position = [0] * N
count = 0
for i in range(N-1):
    if S[i] == "A" and S[i + 1] == "C":
        count += 1
    position[i+1] = count
answers = []
for i in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    answer = position[r] - position[l]
    answers.append(answer)
for i in range(Q):
    print(answers[i])

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = str(input())
position = [0] * (N)
count = 0
for i in range(N):
    if S[i] == "A" and S[i + 1] == "C":
        count += 1
    position[i] = count

for i in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 1
    answer = position[r] - position[l]
    print[answer]

Buggy submission (verdict: Runtime Error):
N, Q = map(int, input().split())
S = str(input())
position = []
for i in range(N):
    if S[i] == "A" and S[i + 1] == "C":
        position.append(i)

answers = []

for i in range(Q):
    l, r = map(int, input().split())
    l -= 1
    r -= 2
    
    low = 0
    high = len(position)
    t = (low + high)//2
   
    while low<=high:
        
        if l == position[t]:
            break
        elif l > position[t]:
            if l < position[t-1]:
                break
            else:
                low = t + 1
        elif l < position[t]:
            high = t - 1
        
        tmp = (low + high) // 2
        if 0 <= tmp <= len(position) - 1:
            t = tmp
        else:
            break
    
     
    low = 0
    high = len(position)
    s = (low + high)//2
    while low<=high:
       
        if r == position[s]:
            break
        elif r > position[s]:
            low = s + 1
        elif r < position[s]:
            if r > position[s+1]:
                break
            else:
                high = s - 1
        tmp = (low + high) // 2
        if 0 <= tmp <= len(position) - 1:
            s = tmp
        else:
            break
    
    answer = s - t + 1
    if s == t:
        if not l <= position[s] <= r:
            answer = 0
    
        
    answers.append(answer)
    
for x in answers:
    print(x)
Problem p03111 (python)

Fixed submission:
N,A,B,C = map(int, input().split())
l = [int(input()) for i in range(N) ]
def dfs(cur,a,b,c):
    if cur == N:
        if min(a, b, c) > 0:
                return abs(a-A) + abs(b-B) + abs(c-C) - 30
        else:
                return 10**9
    ret0 = dfs(cur+1, a, b, c)
    ret1 = dfs(cur+1, a + l[cur], b, c) + 10
    ret2 = dfs(cur+1, a, b + l[cur], c) + 10
    ret3 = dfs(cur+1, a, b, c + l[cur]) + 10
    return min(ret0,ret1,ret2,ret3)

print(dfs(0, 0, 0, 0))

Buggy submission (verdict: Runtime Error):
N,A,B,C = map(int, input().split())
l = list(map(int, input().split()))
def dfs(cur,a,b,c):
    if cur == N:
        if min(a, b, c) > 0:
                return abs(a-A) + abs(b-B) + abs(c-C) - 30
        else:
                return 10**9
    ret0 = dfs(cur+1, a, b, c)
    ret1 = dfs(cur+1, a + l[cur], b, c) + 10
    ret2 = dfs(cur+1, a, b + l[cur], c) + 10
    ret3 = dfs(cur+1, a, b, c + l[cur]) + 10
    return min(ret0,ret1,ret2,ret3)

print(dfs(0, 0, 0, 0))
Problem p03145 (python)

Fixed submission:
c,a,b = map(int, input().split())
print(int(a * c / 2))

Buggy submission (verdict: Runtime Error):
c,a,b = map(int, input().split())
printint((a * c / 2))