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

Fixed submission:
N,A,B,C = map(int, input().split())
l = [int(input()) for _ in range(N)]
INF = 10**9

def dfs(cur, a, b, c):
    if cur == N:
        return abs(a-A)+abs(b-B)+abs(c-C)-30 if min(a,b,c) > 0 else INF
    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 = [int(input()) for _ in range(N)]
INF = 10**9

def dfs(cur, a, b, c):
    if cur == N:
        return abs(a-A)+abs(b-B)+abs(c-C) > 0 else INF
    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 p03219 (python)

Fixed submission:
X,Y = map(int, input().split())
print(X + Y//2)

Buggy submission (verdict: Runtime Error):
X Y = map(int, input().split())
print(X + Y//2)
Problem p03262 (python)

Fixed submission:
from functools import reduce

def gcd_two(a,b):
    if b==0:
        return a
    return gcd(b,a%b)

def gcd(*numbers):
    return reduce(gcd_two, numbers)

#values
INF = 10**9

#input
N,X = map(int, input().split())
x_list = [int(i) for i in input().split()]

d_list = [abs(X-i) for i in x_list]
print(gcd(*d_list))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

#values
INF = 10**9

#input
N,X = map(int, input().split())
x_list = [int(i) for i in input().split()]

d_list = [abs(X-i) for i in x_list]
print(gcd(*d_list))
Problem p03274 (python)

Fixed submission:
INF = 10**9

N, K = map(int, input().split())
x_list = [int(i) for i in input().split()]
for i in range(N):
    if x_list[i] >= 0:
        T = i
        break
else:
    print(abs(x_list[-K]))
    exit()
min_take_time = INF
for i in range(K+1):
    if T-K+i < 0 or T+i>N:
        continue
    if x_list[T-K+i] *  x_list[T+i-1] <= 0:
        take_time = min(abs(x_list[T-K+i]), abs(x_list[T+i-1])) * 2 + max(abs(x_list[T-K+i]), abs(x_list[T+i-1]))
    else:
        take_time = max(abs(x_list[T-K+i]), abs(x_list[T+i-1]))
    min_take_time = min(min_take_time, take_time)


print(min_take_time)

Buggy submission (verdict: Runtime Error):
INF = 10**9

N, K = map(int, input().split())
x_list = [int(i) for i in input().split()]
for i in range(N):
    if x_list[i] >= 0:
        T = i
        break
else:
    print(abs(x_list[-K])
    exit()
min_take_time = INF
for i in range(K+1):
    if T-K+i < 0 or T+i>N:
        continue
    if x_list[T-K+i] *  x_list[T+i-1] <= 0:
        take_time = min(abs(x_list[T-K+i]), abs(x_list[T+i-1])) * 2 + max(abs(x_list[T-K+i]), abs(x_list[T+i-1]))
    else:
        take_time = max(abs(x_list[T-K+i]), abs(x_list[T+i-1]))
    min_take_time = min(min_take_time, take_time)


print(min_take_time)

Buggy submission (verdict: Runtime Error):
INF = 10**9

N, K = map(int, input().split())
x_list = [int(i) for i in input().split()]
for i in range(N):
    if x_list[i] >= 0:
        T = i
        break
min_take_time = INF
for i in range(K+1):
    if T-K+i < 0 or T+i>N:
        continue
    if x_list[T-K+i] *  x_list[T+i-1] <= 0:
        take_time = min(abs(x_list[T-K+i]), abs(x_list[T+i-1])) * 2 + max(abs(x_list[T-K+i]), abs(x_list[T+i-1]))
    else:
        take_time = max(abs(x_list[T-K+i]), abs(x_list[T+i-1]))
    min_take_time = min(min_take_time, take_time)


print(min_take_time)
Problem p03316 (python)

Fixed submission:
N = input()
S = 0
for i in N:
    S += int(i)
print("Yes" if int(N) % S == 0 else "No")

Buggy submission (verdict: Runtime Error):
N = input()
S = 0
for i in N:
    S += int(i)
print("Yes" if N % S == 0 else "No")
Problem p03325 (python)

Fixed submission:
N = int(input())
l = [int(i) for i in input().split()]
count = 0
for i in l:
    while i % 2 == 0:
        i /= 2
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
l = [int(i) for i in input().split()]
count = 0
total = 1
for i in l:
    total *= i
while total%2==0:
    total /= 2
    count += 1
print(count)
Problem p02945 (python)

Fixed submission:

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

input_cal = [a + b, a - b, a * b]
print(max(input_cal))

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

input_cal = []
input_cal.append(a + b)
input_cal.append(a - b)
input_cal.append(a * b)
print(max(input_cal))
Problem p02615 (python)

Fixed submission:
n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
arr=sorted(arr)
arr=arr[::-1]
# newArr=[arr[0]]
ans=0
# for i in range(1,n//2):
#     newArr.append(arr[i])
#     newArr.append(arr[i])
for i in range(1,n):
    # print()
    ans+=arr[i//2]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
arr=sorted(arr)
arr=arr[::-1]
newArr=[arr[0]]
ans=0
for i in range(1,n//2):
    newArr.append(arr[i])
    newArr.append(arr[i])
for i in range(n-1):
    ans+=newArr[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
arr=sorted(arr)
arr=arr[::-1]
newArr=[arr[0]]
ans=0
for i in arr[1:]:
    newArr.append(arr[i])
    newArr.append(arr[i])
for i in range(n-1):
    ans+=newArr[i]
print(ans)
Problem p02628 (python)

Fixed submission:
n,k=[int(i) for i in input().strip().split(" ")]
arr=[int(i) for i in input().strip().split(" ")] 
ans=0
arr=sorted(arr)
for i in range(k):
    ans+=arr[i]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=[int(i) for i in input().strip().split(" ")]
arr=[int(i) for i in input().strip().split(" ")]
arrs=sorted(arr)
print(arrs)
ans=0
for i in range(k):
    ans+=arrs[k]
print(ans)

Buggy submission (verdict: Runtime Error):
n,k=[int(i) for i in input().strip().split(" ")]
arr=[int(i) for i in input().strip().split(" ")]
arr=sorted(arr)
ans=0
for i in range(k):
    ans+=arr[k]
print(ans)
Problem p02630 (python)

Fixed submission:
n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
t=int(input())
dic={}
sum_array=0
for i in arr:
    dic[i]=dic.get(i,0)+1
    sum_array+=i
    

for _ in range(t):
    a,b=[int(i) for i in input().split(" ")]
    if a not in dic:
        print(sum_array)
        continue
    if b in dic:
        dic[b]+=dic[a]
    else:
        dic[b]=dic[a]
    
    sum_array+=dic[a]*(b-a)
    print(sum_array)
    dic[a]=0

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
t=int(input())
dic={}
sum_array=0
for i in arr:
    dic[i]=dic.get(i,0)+1
    sum_array+=i
    

for _ in range(t):
    a,b=[int(i) for i in input().split(" ")]
    if b in dic:
        dic[b]+=dic[a]
    else:
        dic[b]=dic[a]
    
    sum_array+=dic[a]*(b-a)
    print(sum_array)
    dic[a]=0

Buggy submission (verdict: Runtime Error):
n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
t=int(input())
dic={}
sum_array=0
for i in arr:
    dic[i]=dic.get(i,0)+1
    sum_array+=i
    

for _ in range(t):
    a,b=[int(i) for i in input().split(" ")]
    if b in dic:
        dic[b]+=dic[a]
    else:
        dic[b]=dic[a]
    
    sum_array+=dic[a]*(b-a)
    print(dic,sum_array)
    dic[a]=0

Buggy submission (verdict: Runtime Error):
def sum_dic(dic):
    ans=0
    for i in dic:
        ans+=dic[i]*i
    return ans

n=int(input())
arr=[int(i) for i in input().strip().split(" ")]
t=int(input())
dic={}
for i in arr:
    dic[i]=dic.get(i,0)+1
    

for _ in range(t):
    a,b=[int(i) for i in input().split(" ")]
    if b in dic:
        dic[b]+=dic[a]
    else:
        dic[b]=dic[a]
    dic[a]=0
    print(sum_dic(dic))
Problem p02641 (python)

Fixed submission:
# arr=input().strip().split(' ')
def aa():
    x,n=[int(i) for i in input().strip().split(' ')]
    if n==0:
        print(x)
        return 
    arr=[int(i) for i in input().strip().split(' ')]
    # neg,pos=[],[]
    # for i in arr:
    # 	if x-i >0 :
    # 		pos.append(x-i)
    # 	else:
    # 		neg.append(i-x)
    # pos=sorted(pos)
    # neg=sorted(neg)
    
    diff=[]
    for i in arr:

        diff.append(x-i)
    i=-1
    j=0
    while i in diff:
        i=i-1
    while j in diff:
        j=j+1
    if abs(i)<abs(j):
        print(x-i)
    else:
        print(x-j)
    # print(x+)
aa()

Buggy submission (verdict: Runtime Error):
# arr=input().strip().split(' ')
x,n=[int(i) for i in input().strip().split(' ')]
arr=[int(i) for i in input().strip().split(' ')]
# neg,pos=[],[]
# for i in arr:
# 	if x-i >0 :
# 		pos.append(x-i)
# 	else:
# 		neg.append(i-x)
# pos=sorted(pos)
# neg=sorted(neg)
diff=[]
for i in arr:
    
	diff.append(x-i)
i=-1
j=0
while i in diff:
	i=i-1
while j in diff:
	j=j+1
if abs(i)<abs(j):
    print(x-i)
else:
    print(x-j)
# print(x+)

Buggy submission (verdict: Runtime Error):
# arr=input().strip().split(' ')
x,n=[int(i) for i in input().strip().split(' ')]
arr=[int(i) for i in input().strip().split(' ')]
# neg,pos=[],[]
# for i in arr:
# 	if x-i >0 :
# 		pos.append(x-i)
# 	else:
# 		neg.append(i-x)
# pos=sorted(pos)
# neg=sorted(neg)
diff=[]
for i in arr:
	diff.append(x-i)
i=-1
j=1
while i in diff:
	i=i-1
while j in diff:
	j=j+1
print(min(x+i,x+j))
Problem p02730 (python)

Fixed submission:
def partpall(s,n):
	if s!=s[::-1]:
		return False
	else:
		return True

def pall(s,n):
	if s!=s[::-1]:
		return False
	return partpall(s[n//2 +1 :],n) and partpall(s[:n//2 ],n)


# s=input("enter:")
s=input()
# print("sucess",s,s[::-1])
# revStr=s[::-1]
n=len(s)
# print(n)
if pall(s,n):
	print("Yes")
else:
	print("No")

Buggy submission (verdict: Runtime Error):
def partpall(s,n):
	if s!=s[::-1]:
		return False
	else:
		return True

def pall(s,n):
	if s!=s[::-1]:
		return False
	return partpall(s[n//2 +1 :],n) and partpall(s[:n//2 ],n)


# s=input("enter:")
s="akakaka"
# print("sucess",s,s[::-1])
# revStr=s[::-1]
#n=len(s)
# print(n)
if pall(s,n):
	print("Yes")
else:
	print("No")
Problem p03074 (python)

Fixed submission:
n, k = map(int, input().split())
s = list(input())
ans_0 = []
ans_1 = []

cnt = 0
for i in range(n):
    if s[i] == "1" and cnt == 0:
        ans_0.append(i)
        cnt += 1
    elif s[i] == "0":
        cnt = 0
cnt = 0
for i in range(n):
    if s[n-1 - i] == "1" and cnt == 0:
        ans_1.append(n-1-i)
        cnt += 1
    elif s[n-1 - i] == "0":
        cnt = 0
ans_1.sort()
ans_list = []
if len(ans_0) == 0:
    print(n)
elif len(ans_0) == 1:
    if k == 1:
        print(max(n-ans_0[0], ans_1[0]+1))
    else:
        print(n)
elif len(ans_0) < k:
    print(n)
else:
    if 0 not in ans_0:
        ans_0.append(0)
        ans_1.append(0)
        ans_0.sort()
        ans_1.sort()
    if n-1 not in ans_1:
        ans_0.append(n-1)
        ans_1.append(n-1)
    for i in range(len(ans_0) - k):
        ans_list.append(ans_1[i+k] - ans_0[i])
    print(max(ans_list) + 1)

Buggy submission (verdict: Runtime Error):
n, k = map(int, input().split())
s = input()
ans_0 = []
ans_1 = []
cnt = 0

if s.count("1") == 1:
    print(max(n - 1 - s.index("1"), s.index("1") + 1))
else:
    s = list(s)
    for i in range(n):
        if s[i] == "1" and cnt == 0:
            ans_0.append(i)
            cnt += 1
        elif s[i] == "0":
            cnt = 0
    cnt = 0
    for i in range(n):
        if s[n-1 - i] == "1" and cnt == 0:
            ans_1.append(n-1-i)
            cnt += 1
        elif s[n-1 - i] == "0":
            cnt = 0
    ans_1.sort()
    ans_list = []
    for i in range(len(ans_0) - k):
        ans_list.append(ans_1[i+k] - ans_0[i])
    print(max(ans_list) + 1)
Problem p03086 (python)

Fixed submission:
s = list(input())
cnt = 0
list = []
for i in range(len(s)):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        cnt += 1
        list.append(cnt)
    else:
        cnt = 0
        list.append(cnt)
print(max(list))

Buggy submission (verdict: Runtime Error):
s = list(input())
cnt = 0
list = []
for i in range(len(s)):
    if s[i] == "A" or s[i] == "T" or s[i] == "C" or s[i] == "G":
        cnt += 1
    else:
        list.append(cnt)
        cnt = 0
print(max(list))
Problem p03087 (python)

Fixed submission:
n, q = map(int, input().split())
s = list(input())
quiz = [list(map(int, input().split())) for _ in range(q)]

cnt_list = [0]*n
judge = 0

for i in range(n):
    if s[i] == "A":
        judge = 1
        cnt_list[i] = cnt_list[i-1]
    elif judge == 1 and s[i] == "C":
        judge = 0
        cnt_list[i] = cnt_list[i-1] + 1
    else:
        judge = 0
        cnt_list[i] = cnt_list[i-1]

for i in range(q):
    print(cnt_list[quiz[i][1] - 1] - cnt_list[quiz[i][0]-1])

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = list(input())
quiz = [list(map(int, input().split())) for _ in range(q)]

cnt_list = [0]*n
jufge = 0

for i in range(n):
    if s[i] == "A":
        judge = 1
        cnt_list[i] = cnt_list[i-1]
    elif judge == 1 and s[i] == "C":
        judge = 0
        cnt_list[i] = cnt_list[i-1] + 1
    else:
        cnt_list[i] = cnt_list[i-1]

for i in range(q):
    print(cnt_list[quiz[i][1] - 1] - cnt_list[quiz[i][0]-1])

Buggy submission (verdict: Runtime Error):
n, q = map(int, input().split())
s = list(input())
quiz = [list(map(int, input().split())) for _ in range(q)]

cnt_list = [0]*n
jufge = 0

for i in range(n):
    if s[i] == "A":
        judge = 1
        cnt_list[i] = cnt_list[i-1]
    elif judge == 1 and s[i] == "C":
        judge = 0
        cnt_list[i] = cnt_list[i-1] + 1
    else:
        cnt_list[i] = cnt_list[i-1]

for i in range(n):
    print(cnt_list[quiz[i][1] - 1] - cnt_list[quiz[i][0]-1])
Problem p03095 (python)

Fixed submission:
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(26):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(n):
    ans *= (s.count(t[i]) + 1)

print((ans-1)%(10**9+7))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(n):
    ans *= (s.count(t[i]) + 1)
    if ans > 10**9 + 7:
        ans %= 10**9+7

print(ans-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
ans = 1

for i in range(n):
    ans *= (s.count(t[i]) + 1)

print(ans-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
list = []

for i in range(n):
    list.append(s.count(t[i]))

ans = 1

for i in range(n):
    ans *= (list[i]+1)
    if ans > 10**9 + 7:
        ans = ans % (10**9+7)

print(ans-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
list = []

for i in range(n):
    list.append(s.count(t[i]))

ans = 1

for i in range(len(list)):
    ans *= (list[i]+1)
    if ans > 10**9 + 7:
        ans = ans % (10**9+7)

print(ans-1)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = list(input())
t = "abcdefghijklmnopqrstuvwxyz"
list = []

for i in range(n):
    list.append(s.count(t[i]))

ans = 1

for i in range(len(list)):
    ans *= (list[i]+1)

print(ans-1)
Problem p03231 (python)

Fixed submission:
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

n, m = map(int, input().split())
s = list(input())
t = list(input())

for i in range(gcd(n, m)):
    if s[i * (n // gcd(n, m))] != t[i * (m // gcd(n, m))]:
        print(-1)
        break
    if i == gcd(n, m) - 1:
        print(lcm(n, m))

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

n, m = map(int, input().split())
s = list(input())
t = list(input())

s1 = ['*'] * lcm(n, m)
l = len(s1)

for i in range(n):
    s1[(l//n) * i] = s[i]

for j in range(m):
    if s1[(l//m) * j] != '*':
        if s1[(l//m) * j] != t[j]:
            print(-1)
            break
    if j == m - 1:
        print(l)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

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

n, m = map(int, input().split())
s = list(input())
t = list(input())

s1 = ['*'] * lcm(n, m)
l = len(s1)

for i in range(n):
    s1[(l//n) * i] = s[i]

for j in range(m):
    if s1[(l//m) * j] != '*' and s1[(l//m) * j] != t[j]:
        print(-1)
        break
    if j == m - 1:
        print(l)

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

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

n, m = map(int, input().split())
s = list(input())
t = list(input())

s1 = ['*'] * lcm(n, m)
l = len(s1)

for i in range(n):
    s1[(l//n) * i] = s[i]

for j in range(m):
    if s1[(l//m) * j] != '*' and s1[(l//m) * j] != t[j]:
        print(-1)
        break
    if j == m - 1:
        print(l)

Buggy submission (verdict: Runtime Error):
import math

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

n, m = map(int, input().split())
s = list(input())
t = list(input())

s1 = ['*'] * lcm(n, m)
l = len(s1)

for i in range(n):
    s1[(l//n) * i] = s[i]

for j in range(m):
    if s1[(l//m) * j] != '*' and s1[(l//m) * j] != t[j]:
        print(-1)
        break
    if j == m - 1:
        print(l)

Buggy submission (verdict: Runtime Error):
import math

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

n, m = map(int, input().split())
s = list(input())
t = list(input())

s1 = ['*'] * lcm(n, m)
l = len(s1)

for i in range(n):
    s1[(l//n) * i] = s[i]

for j in range(m):
    if s1[(l//m) * j] != '*' and s1[(l//m) * j] != t[j]:
        print(-1)
        break
    if j == m - 1:
        print(l)
Problem p03599 (python)

Fixed submission:
a,b,c,d,e,f = map(int, input().split())
g = max(a, b)
h = min(a, b)
salt = []
water = []
concentration = 0

for i in range(int(e*f/(c*100)) + 1):
    j = 0
    while e*f/100 >= c*i +d*j:
        salt.append(c*i+d*j)
        j += 1
salt.sort()

for i in range(int(f/(100*g)) + 1):
    j = 0
    while f >= 100*(g*i+h*j):
        water.append(100*(g*i+h*j))
        j += 1
water.sort()
water = water[1:]

for i in range(len(water)):
    addsalt = min(water[i] * e // 100, f - water[i])
    while addsalt not in salt:
        addsalt -=1
    if concentration < addsalt / (water[i] + addsalt):
        concentration = addsalt / (water[i] + addsalt)
        salt1 = addsalt
        water1 = water[i]

try:
    print(salt1+water1, salt1)
except NameError:
    print(water[0], 0)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f = map(int, input().split())
g = max(a, b)
h = min(a, b)
salt = []
water = []
concentration = 0

for i in range(int(e*f/(c*100)) + 1):
    j = 0
    while e*f/100 >= c*i +d*j:
        salt.append(c*i+d*j)
        j += 1
salt.sort()

for i in range(int(f/(100*g))+1):
    j = 0
    while f >= 100*(g*i+h*j):
        water.append(100*(g*i+h*j))
        j += 1
water.sort()
water = water[1:]

for i in range(len(water)):
    addsalt = min(water[i] * e // 100, f - water[i])
    while addsalt not in salt and addsalt > 0:
        addsalt -=1
    if concentration < addsalt / (water[i] + addsalt):
        concentration = addsalt / (water[i] + addsalt)
        salt1 = addsalt
        water1 = water[i]

print(salt1+water1, salt1)

Buggy submission (verdict: Runtime Error):
a,b,c,d,e,f = map(int, input().split())
g = max(a, b)
h = min(a, b)
salt = []
water = []
concentration = 0

for i in range(int(e*f/(c*100)) + 1):
    j = 0
    while e*f/100 >= c*i +d*j:
        salt.append(c*i+d*j)
        j += 1
salt.sort()

for i in range(int(f/(100*g))+1):
    j = 0
    while f >= 100*(g*i+h*j):
        water.append(100*(g*i+h*j))
        j += 1
water.sort()
water = water[1:]

for i in range(len(water)):
    addsalt = min(water[i] * e // 100, f - water[i])
    while addsalt not in salt:
        addsalt -=1
    if concentration < addsalt / (water[i] + addsalt):
        concentration = addsalt / (water[i] + addsalt)
        salt1 = addsalt
        water1 = water[i]

print(salt1+water1, salt1)
Problem p03309 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A_ = [a-i-1 for i,a in enumerate(A)]

A_.sort()

b = A_[N//2]

print(sum([abs(ai-b) for ai in A_]))

Buggy submission (verdict: Runtime Error):
5
2 2 3 5 5

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
A_ = [a-i-1 for i,a in enumerate(A)]
print (A_)
A_.sort()
print (A_)
b = A_[N//2]
print (b)
print(sum([abs(ai-b) for ai in A_]))
Problem p02748 (python)

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

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

amin = min(a)
bmin = min(b)

ans = amin + bmin

for i in range(M):
  x, y, c = map(int, input().split())
  ans = min( ans , a[x-1] + b[y-1] - c )

print(ans)

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

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

amin = min(a)
bmin = min(b)

ans = amin + bmin

for i in range(M):
  x, y, c = map(int, input().split())
  ans = min( ans , a[x-1] + b[x-1] - c )

print(ans)
Problem p03337 (python)

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

print(max(a+b, a-b, a*b))

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

print(max(a+b, a-b, a*b))
Problem p03370 (python)

Fixed submission:
n,x = map(int, input().split())

donutspowderconsumption = [int(input()) for i in range(n)]
totalpowderconsumption = sum(donutspowderconsumption)
donutspowderconsumption.sort()

print( n + (x-totalpowderconsumption) // donutspowderconsumption[0])

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

donutspowderconsumption = [int(input()) for i in range(n)]
totalpowderconsumption = sum(donutspowderconsumption)
sort(donutspowderconsumption)

prin( n + (x-totalpowderconsumption) // donutspowderconsumption[0])
Problem p03609 (python)

Fixed submission:
x,t = map(int, input().split())
print(max(x-t, 0))

Buggy submission (verdict: Runtime Error):
x = int(input())
t = int(input())

print(max(x-t, 0))
Problem p03680 (python)

Fixed submission:
n = int(input())

a = [int(input()) - 1 for _ in range(n)]

i = 0
count = 0

for _ in range(n+1):
  i = a[i]
  count += 1
  if i == 1:
    break

if count == n + 1:
  count = -1
  
print(count)

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

a = [int(input()) - 1 for i in range(n)]

i = 0
count = 0

while(1):
  i = a[i]
  count += 1
  if i == 1:
    break
  elif i == 0:
    print(-1)
    return 0
  
print(count)
Problem p02791 (python)

Fixed submission:
a = int(input())
b = list(map(int,input().split()))
c = 1
k = b[0]
for i in range(1,a):
  if k>b[i]:
  	
  	k = b[i]
  	c+=1
print(c)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = list(map(int,input().split()))
b[0:0]=0
c = 0
for i in range(1,a+1):
  switch = 0
  for j in range(0,i):
    if b[i] < b[j]:
      switch = 1
    if switch == 1:
      c += 1
print(c)
Problem p02743 (python)

Fixed submission:
import sys
a, b, c = map(int,sys.stdin.readline().split())
d = c - a - b
if d > 0 and d * d > 4 * b * a:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
import sys
a, b, c = map(int,sys.stdin.readline().split())
d = c - a - b
if d > 0 && d * d > 4 * b * a:
  print("Yes")
else:
  print("No")