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

Fixed submission:
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)
def comb(n,r):
    if r > n:
        return 0
    else:
        return factorial(n)//(factorial(n-r)*factorial(r))
n,a,b = map(int,input().split())
v = list(map(int,input().split()))
v.sort(reverse=True)
max_mean = sum(v[0:a])/a
print(max_mean)
#選び方の総数を求める
c = Counter(v)
i = 0
num = 0
ans = 0
while num<a:
    if num+c[v[i]]>=a:
        num += c[v[i]]
    else:
        num += c[v[i]]
        i += 1
num -= c[v[i]]

if i > 0:
        ans += comb(c[v[i]],a-num)
        print(ans)
else:
    for j in range(a,b+1):
        if c[v[0]] >=j:
            ans += comb(c[v[0]],j)
    print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = 10**18
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)
def comb(n,r):
    return factorial(n)//(factorial(n-r)*factorial(r))
n,a,b = map(int,input().split())
v = list(map(int,input().split()))
v.sort(reverse=True)
max_mean = sum(v[0:a])/a
print(max_mean)
#選び方の総数を求める
c = Counter(v)
i = 0
num = 0
ans = 0
while num<=a:
    if num+c[v[i]]>=a:
        num += c[v[i]]
    else:
        i +=1
        num += c[v[i]]
if i > 0:
    ans += comb(c[v[i]],a)
    print(ans)
else:
    for i in range(a,b+1):
        if c[v[0]] >=i:
            ans += comb(c[v[0]],i)
    print(ans)
Problem p03806 (python)

Fixed submission:
N,Ma,Mb = map(int,input().split())
abc = [list(map(int,input().split())) for _ in range(N)]
inf = 10**9
dp = [[inf for i in range(N*10+1)] for i in range(N*10+1)]
dp[0][0] = 0
max_a = 0
max_b = 0
for i in range(N):
    max_a += abc[i][0]
    max_b += abc[i][1]
    for ai in range(abc[i][0],max_a+1)[::-1]:
        for bi in range(abc[i][1],max_b+1)[::-1]:
            dp[ai][bi] = min(dp[ai][bi],dp[ai-abc[i][0]][bi-abc[i][1]]+abc[i][2])
ans = inf
for i in range(1,min(max_a//Ma,max_b//Mb)):
    ans = min(ans,dp[i*Ma][i*Mb])
if ans == inf:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
inf = 10**18

N,Ma,Mb = map(int,input().split())
abc = [list(map(int,input().split())) for _ in range(N)]
inf = 10**9
dp = [[inf for i in range(N*10)] for i in range(N*10)]
dp[0][0] = 0
max_a = 0
max_b = 0
for i in range(N):
    max_a += abc[i][0]
    max_b += abc[i][1]
    for ai in range(abc[i][0],max_a+1)[::-1]:
        for bi in range(abc[i][1],max_b+1)[::-1]:
            dp[ai][bi] = min(dp[ai][bi],dp[ai-abc[i][0]][bi-abc[i][1]]+abc[i][2])
ans = inf
for i in range(1,min(max_a//Ma,max_b//Mb)):
    ans = min(ans,dp[i*Ma][i*Mb])
if ans == inf:
    print(-1)
else:
    print(ans)

Buggy submission (verdict: Runtime Error):
N,Ma,Mb = map(int,input().split())
abc = [list(map(int,input().split())) for _ in range(N)]
inf = 10**9
dp = [[inf for i in range(N*10)] for i in range(N*10)]
dp[0][0] = 0
max_a = 0
max_b = 0
for i in range(N):
    max_a += abc[i][0]
    max_b += abc[i][1]
    for ai in range(abc[i][0],max_a+1)[::-1]:
        for bi in range(abc[i][1],max_b+1)[::-1]:
            dp[ai][bi] = min(dp[ai][bi],dp[ai-abc[i][0]][bi-abc[i][1]]+abc[i][2])
ans = inf
for i in range(1,min(max_a//Ma,max_b//Mb)):
    ans = min(ans,dp[i*Ma][i*Mb])
if ans == inf:
    print(-1)
else:
    print(ans)
Problem p03834 (python)

Fixed submission:
s = list(input())
s[5] = " "
s[13] = " "
ans = map(str,s)

print("".join(ans))

Buggy submission (verdict: Runtime Error):
s = input()
s[5] = " "
s[13] = " "
print(s)
Problem p03839 (python)

Fixed submission:
from itertools import*
from math import*
from collections import*
from heapq import*
from bisect import bisect_left,bisect_right
from copy import deepcopy
inf = float("inf")
mod = 10**9+7
from functools import reduce
import sys
sys.setrecursionlimit(10**7)

#色を塗るタイプの操作は逆順に見ていけば確定した色が上書きされることは無いと思える
N,K = map(int,input().split())
a = list(map(int,input().split()))
A = [0]*(N+1)
S = [0]*(N+1)

for i in range(N):
    A[i+1] = A[i]+max(0,a[i])
    S[i+1] = S[i]+a[i]

ans = -inf
for i in range(0,N-K+1):
    ans = max(ans,A[i]+max(0,S[i+K]-S[i])+(A[N]-A[i+K]))

print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
a = list(map(int,input().split()))
A = [0]*(N+1)
S = [0]*(N+1)

for i in range(N):
    A[i+1] = A[i]+max(0,a[i])
    S[i+1] = S[i]+a[i]

ans = -inf
for i in range(0,N-K+1):
    ans = max(ans,A[i]+max(0,S[i+K]-S[i])+(A[N]-A[i+K]))

print(ans)
Problem p03108 (python)

Fixed submission:
from collections import Counter
from collections import deque
from functools import reduce
from pprint import pprint
import bisect
import copy
import fractions
import itertools
import math
import queue
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return map(int, sys.stdin.readline().split())
def II(): return int(sys.stdin.readline())
def IS(): return input()
def C(x): return Counter(x)
def GCD_LIST(numbers): return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers): return reduce(LCM, numbers)
def LCM(m, n): return (m * n // fractions.gcd(m, n))
def same(x, y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:
        return x
    else:
        node[x] = root(node[x])
        return node[x]
def unite(x, y):
    x, y = root(x), root(y)
    if x == y:
        return  # 結合不要
    if size[x] < size[y]:
        x, y = y, x
    node[y] = x
    size[x] += size[y]
def return_size(x):
    return size[root(x)]
    

n, m = MI()
ans = [0] * (m + 1)
bridge = [LI() for _ in range(m)]
# union-find
node = [i for i in range(n)]
size = [1 for i in range(n)]
# 辺を追加していない状態
ans[0] = (n * (n - 1)) // 2
i = 0 
for a, b in bridge[::-1]:
    if same(a - 1, b - 1):  # 辺を追加する以前のもともと連結であった
        ans[i + 1] = ans[i]
    else:
        ans[i + 1] = ans[i] - return_size(a - 1) * return_size(b - 1)
    unite(a - 1, b - 1)
    i += 1
for i in ans[:m][::-1]:
    print(i)

Buggy submission (verdict: Runtime Error):
n, m=map(int, input().split())
list = [list(map(int, input().split())) for _ in range(m)]
node = [i for i in range(0, n+1)]
ans = [0] * (m+1)
# print(node)
# print(ans)

def root(x):
    # print('ROOT!!')
    if node[x] == x:
        return x
    else:
        node[x] == root(node[x])
        return node[x]


def same(x, y):
    # print('SAME!!')
    return bool(root(x) == root(y))


def unite(x, y):
    # print('UNITE!!')
    x = root(x)
    y = root(y)
    if x == y:
        return
    node[x] = y
    # print('NODE')
    # print(node)


def find(x):
    # print('FIND!!!')
    # print(root(x))
    # print(node.count(root(x)))
    # print('NODE')
    # print(node)
    return node.count(root(x))


ans[0] = n*(n-1)//2


for i, element in enumerate(list[::-1]):
    # print('i,element')
    # if i == 0:
    #    continue
    # print(i, element)
    if same(element[0], element[1]):
        ans[i+1] = ans[i]
    else:
        ans[i+1] = ans[i]-find(element[0])*find(element[1])
        unite(element[0], element[1])
    # print('node')
    # print(node)
    # print('ans')
    # print(ans)
    # print('===============')

# print(ans)
# print(ans[:m:][::-1])
for i in ans[:m:][::-1]:
    print(i)
Problem p03775 (python)

Fixed submission:
import math
n=int(input())
k = math.floor(math.sqrt(n))
for a in range(k+1,0,-1):
    if n % a == 0:
        print(max(len(str(a)),len(str(n//a))))
        break

Buggy submission (verdict: Runtime Error):
n=int(input())
ans = len(str(n))
l = [ i for i in range(1,n+1) if i*i < n]
for a in l:
    if n % a == 0 and ans > max(len(str(a)),len(str(int(n / a))))
        ans = max(len(str(a)),len(str(int(n / a))))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
ans = len(str(n))
for a in range(1,int(math.sqrt(n)+1)):
    if n % a == 0 and ans > max(len(str(a)),len(str(int(n / a))))
        ans = max(len(str(a)),len(str(int(n / a))))
print(ans)

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
ans = len(str(n))
# print(int(math.sqrt(n)))
for a in range(1,int(math.sqrt(n)+1)):
    # print(a,n/a,n % a)
    if n % a == 0 and ans > max(len(str(a)),len(str(int(n / a))))
        ans = max(len(str(a)),len(str(int(n / a))))
print(ans)
Problem p02948 (python)

Fixed submission:
import heapq
def main(n,m,c):
    cost_map = dict([(i, [])for i in range(1,m+1)])
    for a, b in c:
        if a <= m:
            cost_map[a].append(b)
        
    hp =[]
    ret = 0
    for i in range(1, m+1):
        costs = cost_map[i]
        [heapq.heappush(hp, -c) for c in costs]
        if(len(hp) > 0):
            c = heapq.heappop(hp)
            ret -= c
    return ret
if __name__ == "__main__":
    n,m = map(lambda x: int(x), input().strip().split())
    c = [ list(map(lambda x: int(x), input().strip().split())) for i in range(n)]
    print(main(n,m,c))

Buggy submission (verdict: Runtime Error):
import heapq
def main(n,m,c):
    cost_map = dict([(i, [])for i in range(1,n+1)])
    for a, b in c:
        if a <= m:
            cost_map[a].append(b)
        
    hp =[]
    ret = 0
    for i in range(1, m+1):
        costs = cost_map[i]
        [heapq.heappush(hp, -c) for c in costs]
        if(len(hp) > 0):
            c = heapq.heappop(hp)
            ret -= c
    return ret
if __name__ == "__main__":
    n,m = map(lambda x: int(x), input().strip().split())
    c = [ list(map(lambda x: int(x), input().strip().split())) for i in range(n)]
    print(main(n,m,c))
Problem p03426 (python)

Fixed submission:
h,w,d = map(int, input().split())

from collections import defaultdict
G = defaultdict(list)
for i in range(h):
    l = list(map(int, input().split()))
    for n, item in enumerate(l):
        G[item] = [n,i]




# magic is just distance by 1

# if d is 4,
# 1,5,9 or 2,6,10.. make surplus to categorize
# query comes 10^5, so O(1) or O(logN) is limit -> cumulativesum

dp = [0 for i in range(h*w+1)]
for i in range(d): # 0,1,2,...d-1
    current_place = i+1
    while current_place + d <= h*w:
        x,y = G[current_place]
        next_place = current_place + d
        x1,y1 = G[next_place]
        magic = abs(x-x1) + abs(y-y1)
        dp[next_place] = magic + dp[current_place]
        current_place = next_place

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print(dp[r]-dp[l], flush=True)

Buggy submission (verdict: Runtime Error):
h,w,d = map(int, input().split())

from collections import defaultdict
G = defaultdict(list)
for i in range(h):
    l = list(map(int, input().split()))
    for n, item in enumerate(l):
        G[item] = [n,i]




# magic is just distance by 1

# if d is 4,
# 1,5,9 or 2,6,10.. make surplus to categorize
# query comes 10^5, so O(1) or O(logN) is limit -> cumulativesum

dp = [0 for i in range(h*w)]
for i in range((h*w)%d+1): # 1,2,...d
    current_place = i+1
    while current_place + d < h*w:
        x,y = G[current_place]
        next_place = current_place + d
        x1,y1 = G[next_place]
        magic = abs(x-x1) + abs(y-y1)
        dp[next_place] = magic + dp[current_place]
        current_place = next_place

q = int(input())
for i in range(q):
    l, r = map(int, input().split())
    print( dp[r]-dp[l], flush=True)
Problem p03242 (python)

Fixed submission:
n = input()
print(n.replace('1', '_').replace('9', '1').replace('_', '9'))

Buggy submission (verdict: Runtime Error):
n = input()
print(n.replace('1', '_').replace('9', '1').replace('_', '9')
Problem p03250 (python)

Fixed submission:
s = [int(x) for x in input().split()]
max_int = s.pop(s.index(max(s)))
print(max_int * 10 + sum(s))

Buggy submission (verdict: Runtime Error):
s = [int x for x in input().split()]
max_int = s.pop(s.index(max(s)))
print(max_int * 10 + sum(s))
Problem p03221 (python)

Fixed submission:
N,M = map(int, input().split())
O = []

for i in range(M):
    p,y = map(int, input().split())
    O.append([i+1, p, y])
O.sort(key=lambda x:x[2])
count=[0 for i in range(N)]

ans = []
for o in O:
    count[o[1]-1]+=1
    ans.append([o[0], o[1], count[o[1]-1]])
ans.sort(key=lambda x:x[0])

for v in ans:
    a1 = str(v[1])
    s = (6 - len(a1)) * "0"
    s += a1
    a2 = str(v[2])
    s += (6 - len(a2)) * "0"
    s += a2
    print( s )

Buggy submission (verdict: Runtime Error):
N,M = map(int, input().split())
P = []
Y = []
O = [[] for i in range(N)]

for i in range(M):
    p,y = map(int, input().split())
    P.append(p)
    Y.append(y)
    O[p-1].append(y)
    O[p-1].sort()

for i,p in enumerate(P):
    s = (6 - len(str(p))) * "0"
    s += str(p)
    s += (6 - len(str((O[p-1].index(Y[p-1])) + 1))) * "0"
    s += str((O[p-1].index(Y[i])) + 1)
    print( s )
Problem p02951 (python)

Fixed submission:
A,B,C=(int(x) for x in input().split())
answer = C-(A-B)
if answer<0:
  answer=0
print(int(answer))

Buggy submission (verdict: Runtime Error):
answer = C-(A-B)
if answer<0:
  answer=0
print(int(answer))

Buggy submission (verdict: Runtime Error):
  answer = C-(A-B)
  if answer<0:
    answer=0
  print(int(answer))
Problem p02951 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A >= 1 and A <=20 and B >= 1 and B <=20 and A >= B and C >= 1 and C <=20:
    if C - (A - B) >= 0:
        print(C - (A - B))
    else:
        print(0)

Buggy submission (verdict: Runtime Error):
N = int(input())
if N < 10 ** 1:
    print(N)
elif N < 10 ** 2:
    print(9)
elif N < 10 ** 3:
    print(N - 90)
elif N < 10 ** 4:
    print(909)
elif N < 10 ** 5:
    print(N - 9090)
else:
     print(90909)
Problem p02951 (python)

Fixed submission:
a, b, c = map(int, input().split())
print(max(b+c-a, 0))

Buggy submission (verdict: Runtime Error):
a,b,c = input().split()
print(max(b+c-a, 0))
Problem p02951 (python)

Fixed submission:
A, B, C, = tuple(map(int, input().split()))
if (A - B) >= C:
  	print(0)
else:
  	print(C - (A - B))

Buggy submission (verdict: Runtime Error):
A, B, C, = taple(map(int, input().split()))
if (A - B) >= C:
  	print(0)
else:
  	print(C - (A - B))

Buggy submission (verdict: Runtime Error):
A,　B, C, = taple(map(int, input().split()))
if (A - B) >= C:
  	print(0)
else:
  	print(C - (A - B))
Problem p02951 (python)

Fixed submission:
A,B,C = map(int, input().split())
if B >= 1 and A >= B and A <= 20 and C >= 1 and C <= 20:
    capacity = A - B
    if capacity <= C:
        remaining = C - capacity
    else:
        remaining = 0
    print(remaining)

Buggy submission (verdict: Runtime Error):
if B >= 1 and A >= B and A <= 20 and C >= 1 and C <= 20:
    capacity = A - B
    if capacity <= C:
        remaining = C - capacity
    else:
        remaining = 0
    print(remaining)

Buggy submission (verdict: Runtime Error):
N = int(input())
2 ans = 0
3 for i in range(1, N + 1):
4 if len(str(i)) % 2 == 1:
5 ans += 1
6 print(ans)

Buggy submission (verdict: Runtime Error):
if N < 10:
    print(N)
elif N >= 10 and N < 100:
    print(9)
elif N >= 100 and N < 1000:
    print(N - 90)
elif N >= 1000 and N < 10000:
    print(909)
elif N >= 10000 and N < 100000:
    print(N-9090)
else:
    print(90909)
Problem p02951 (python)

Fixed submission:
a, b, c = [int(x) for x in input().split(" ")]
 
rest = a - b
ans = c - rest
if ans < 0:
  ans = 0
 
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
h = [int(x) for x in input().split(" ")]
 
for i in range(1, n):
  if h[-i]-h[-i-1] >= 0:
    continue  
  elif h[-i]-h[-i-1] == -1:
    h[-i-1] = h[i-1] - 1
    continue
  elif h[i]-h[-i-1] < -1:
    ans = "No"
    break
else:
  ans = "Yes"
 
print(ans)
Problem p03042 (python)

Fixed submission:
#!/usr/bin/env python3
import sys


def solve(S: int):
    s = '{:04d}'.format(S)
    a, b = str(s)[:2], str(s)[2:]

    def judge(s):
        if s == '00' or int(s) > 12:
            return 'y'
        return 'ym'

    fa, fb = judge(a), judge(b)

    if fa == 'y' and fb == 'y':
        print('NA')
    elif fa == 'y' and fb == 'ym':
        print('YYMM')
    elif fa == 'ym' and fb == 'y':
        print('MMYY')
    elif fa == 'ym' and fb == 'ym':
        print('AMBIGUOUS')
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
import sys


def solve(S: int):
    a, b = str(S)[:2], str(S)[2:]
    if a == '00' or b == '00':
        print('NA')
        return
    fa, fb = False, False
    if int(a) > 12:
        fa = True
    if int(b) > 12:
        fb = True
    if fa and fb:
        print('NA')
        return
    if fa and not fb:
        print('YYMM')
        return
    if not fa and fb:
        print('MMYY')
        return
    if not fa and not fb:
        print('AMBIGUOUS')
        return
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools
# (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    S = int(next(tokens))  # type: int
    solve(S)


if __name__ == '__main__':
    main()
Problem p02951 (python)

Fixed submission:
a, b, c = [int(x) for x in input().split()]
water = max(c - (a - b), 0)
print(water)

Buggy submission (verdict: Runtime Error):
a, b, c = [int(x) for x in input()]
string = max([c - a - b,0])
print(string)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
print(str(c - a - b) + "ml")

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())
print(str((b + c) % a) + "ml")
Problem p02984 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
X = [0] * N

X[0] = sum(A) - 2 * (sum([A[i] for i in range(N) if i % 2 == 1]))

for i in range(N - 1):
    X[i + 1] = 2 * A[i] - X[i]

print(" ".join(map(str, X)))

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
avg = [0] * N

avg[0] = sum(A) - 2 * (sum([A[i] for i in range(N) if i % 2 == 1]))

for i in range(N - 1):
    X[i + 1] = 2 * A[i] - avg[i]

print(" ".join(map(str, avg)))

Buggy submission (verdict: Runtime Error):
L, R = map(int, input().split())

module = []
for i in range(L, R):
    for j in range(i+1, R+1):
        print("({} * {}) mod 2019 = {}".format(i, j, (i * j) % 2019))
        if (i * j) % 2019 == 0:
            print("0")
            exit()
        else:
            module.append((i * j) % 2019)

if not module:
    print("0")
else:
    print(min(module))
Problem p02987 (python)

Fixed submission:
import sys


#s = sys.argv[1]
s = input()
if len(s) == 4:
    if s.count(s[0]) == 2:
        if s.count(s[1]) == 2:
            if s.count(s[2]) == 2:
                if s.count(s[3]) == 2:
                    print("Yes")
                    exit()
print("No")
exit()

Buggy submission (verdict: Runtime Error):
import sys


s = sys.argv[1]

if len(s) == 4:
    if s.count(s[0]) == 2:
        if s.count(s[1]) == 2:
            if s.count(s[2]) == 2:
                if s.count(s[3]) == 2:
                    print("Yes")
                    exit()
print("No")
exit()

Buggy submission (verdict: Runtime Error):
import sys

""" print('sys.argv         : ', sys.argv)
print('type(sys.argv)   : ', type(sys.argv))
print('len(sys.argv)    : ', len(sys.argv))

print('sys.argv[0]      : ', sys.argv[0])
print('sys.argv[1]      : ', sys.argv[1])
print('type(sys.argv)   : ', type(sys.argv[1]))
 """
s = sys.argv[1]
# print(len(s))

if len(s) == 4:
    if s.count(s[0]) == 2:
        if s.count(s[1]) == 2:
            if s.count(s[2]) == 2:
                if s.count(s[3]) == 2:
                    print("Yes")
                    exit()
print("No")
exit()
Problem p02989 (python)

Fixed submission:
N = int(input())
d = list(map(int, input().split()))
""" 
d = [9, 1, 4, 4, 6, 7]
#N = 8
N = 6
#d = [9, 1, 14, 5, 5, 4, 4, 14]
d = [9, 1, 4, 4, 6, 7]
 """
# prob
# [number,value]
prob = []
cnt = 0
for i in d:
    prob.append([cnt, i])
    cnt += 1

""" print(prob)
print(sorted(prob, key=lambda x: x[1]))
 """
sorted_d = sorted(prob, key=lambda x: x[1])

#print(d_min, d_max)
cnt = 0
# if len(sorted_d[0:i]) == len(sorted_d[i:]):
cnt += sorted_d[int(N/2)][1] - sorted_d[int(N/2-1)][1]

print(cnt)

Buggy submission (verdict: Runtime Error):
 N = int(input())
 d = list(map(int, input().split()))
""" 
d = [9, 1, 4, 4, 6, 7]
#N = 8
N = 6
#d = [9, 1, 14, 5, 5, 4, 4, 14]
d = [9, 1, 4, 4, 6, 7]
 """
# prob
# [number,value]
prob = []
cnt = 0
for i in d:
    prob.append([cnt, i])
    cnt += 1

""" print(prob)
print(sorted(prob, key=lambda x: x[1]))
 """
sorted_d = sorted(prob, key=lambda x: x[1])

d_max = sorted_d[N-1][1]
d_min = sorted_d[0][1]
#print(d_min, d_max)

cnt = 0
for i in range(N):
    """ print(sorted_d[0:i])
    print(sorted_d[i:])
 """
    if len(sorted_d[0:i]) == len(sorted_d[i:]):
        """ print("True")
        print(sorted_d[i][1])
        print(sorted_d[i-1][1])
        print(sorted_d[i][1] - sorted_d[i-1][1])
         """
        cnt += sorted_d[i][1] - sorted_d[i-1][1]
    # print("------")

print(cnt)
Problem p03041 (python)

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

s = list(S)
s[K-1] = s[K-1].lower()
print(''.join(s))

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

s = list(S)
print(s[K+1].lower())
Problem p02951 (python)

Fixed submission:
list_ = input().split()
remain_quant = int(list_[0]) - int(list_[1])
if remain_quant >= int(list_[2]):
  print(0)
else:
  print(int(list_[2]) - remain_quant)

Buggy submission (verdict: Runtime Error):
list_ = input().split()
remain_quant = int(list_[0] - list_[1])
if remain_quant >= int(list_[2]):
  print(0)
else:
  print(int(list_[2] - remain_quant)
Problem p03072 (python)

Fixed submission:
n = int(input())
m = list(map(int, input().split()))
maxH = m[0]
numH = 0
for i in range(n):
    if m[i] >= maxH:
        maxH = m[i]
        numH += 1
print(numH)

Buggy submission (verdict: Runtime Error):
5
4 5 3 5 4
Problem p02951 (python)

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

if (B + C) >= A:
    print(C - (A - B))

else:
    print(0)

Buggy submission (verdict: Runtime Error):
import time

A = int(input())
B = int(input())
C = int(input())

if (B + C) >= A:
    print(C - (A - B))

else:
    print(0)
Problem p02951 (python)

Fixed submission:

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

ans = c - (a - b)
if ans < 0:
	ans = 0
print(ans)

Buggy submission (verdict: Runtime Error):
a = int(input())
b = int(input())
c = int(input())

ans = c - (a - b)
if ans < 0:
	ans = 0
print(ans)

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


ans = C - (A - B)
if ans == 0:
	ans = 0

print(ans)

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

if B != C:
	surplus = A - B
	ans = C - surplus 
	print(ans)
else:
	print(0)

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

if B != C:
	surplus = A - B
	result = C - surplus 
	print(result)
else:
	print(0)

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


if B != C {
	surplus = A - B
	result = C - surplus 
	print(result)
} else { 
	 print(0)
}