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

Fixed submission:
import sys
def input(): return sys.stdin.readline().strip()


def main():
    x = input()
    if ord(x) <= 90: print("A")
    else: print("a")

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
import sys
def input(): return sys.stdin.readline().strip()
import numpy as np


def main():
    x = input()
    if ord(x) <= 90: print("A")
    else: print("a")

if __name__ == "__main__":
    main()
Problem p02771 (python)

Fixed submission:
A, B, C = map(int, input().split())
if A == B and B != C:
    print("Yes")
elif B == C and C != A:
    print("Yes")
elif C == A and A != B:
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):
A, B, C = map(int, input().split())
if A == B and B != C:
    print("Yes)
elif B == C and C != A:
    print("Yes")
elif C == A and A != B:
    print("Yes")
else:
    print("No")
Problem p02781 (python)

Fixed submission:
N = int(input())
K = int(input())
memo = {}

def F(N, K):
    """
    F(N, K) = (1以上N以下で0でない桁がちょうどK個なものの個数)
    Nを一の桁から見ていくことで再帰で求める
    （例）F(314,3) = F(31,2)*4 + F(30,2)*5 + F(31,3)
                      = {F(3,1) + F(2,1)*8 + F(3,2)} * 4
                            + {F(2,1)*9 + F(3,2)} * 5
                            + {F(3,2) + F(2,2)*8 + F(3,3)}
                      = ...
    """
    r = int(str(N)[-1])
    M = (N - r) // 10
    if K == 0 and N >= 0:
        return 1
    elif K == 0 and N <= -1:
        return 0
    elif N <= 0:
        return 0
    else:
        return F(M, K-1) * r + F(M-1, K-1) * (9-r) + F(M, K)

print(F(N, K))

Buggy submission (verdict: Runtime Error):
N = int(input())
K = int(input())

l = len(str(N))
a = N // 10**(l - 1)
b = N // 10**(l - 2)
c = N // 10**(l - 3)

d = b - 10 * a
e = c - 100 * a - 10 * d

if K == 1:
    ans = 9 * (l - 1) + a
    print(ans)
elif K == 2:
    if l == 1:
        print(0)
    else:
        ans = 81 * (l - 1) * (l - 2) // 2
        ans += (a - 1) * 9 * (l - 1) + 9 * (l - 2) + d
        print(ans)
else:
    if l == 1 or l == 2:
        print(0)
    else:
        ans = 729 * (l - 1) * (l - 2) * (l - 3) // 6
        ans += (a - 1) * 81 * (l - 1) * (l - 2) // 2
        ans += 81 * (l - 2) * (l - 3) // 2
        if d != 0:
            ans += (d - 1) * 9 * (l - 2)
        ans += (l - 3) * 9 + e

print(ans)
Problem p02831 (python)

Fixed submission:
import sys, fractions
from collections import defaultdict
from copy import deepcopy
import itertools
input = sys.stdin.readline
# 文字列の場合は普通のinput()を使うか下を使う
# input = sys.stdin.readline().rstrip()


A, B = map(int, input().split())
gcd = fractions.gcd(A, B)
ans = A * B // gcd
print(ans)

Buggy submission (verdict: Runtime Error):
import sys, math
from collections import defaultdict
from copy import deepcopy
import itertools
input = sys.stdin.readline
# 文字列の場合は普通のinput()を使うか下を使う
# input = sys.stdin.readline().rstrip()


A, B = map(int, input().split())
gcd = math.gcd(A, B)
ans = A * B // gcd
print(ans)
Problem p02833 (python)

Fixed submission:
import sys
from collections import defaultdict
from copy import deepcopy
import itertools
input = sys.stdin.readline
# 文字列の場合は普通のinput()を使うか下を使う
# input = sys.stdin.readline().rstrip()


def log(k, b):
    a = 0
    while b ** a <= k:
        a += 1
    return a - 1



N = int(input())
if N % 2 == 1:
    print(0)
else:
    k = N // 2
    a = log(k, 5)
    ans = 0
    for i in range(1, a + 1):
        ans += k // (5 ** i)
    print(ans)

Buggy submission (verdict: Runtime Error):
import sys, math
from collections import defaultdict
from copy import deepcopy
import itertools
input = sys.stdin.readline
# 文字列の場合は普通のinput()を使うか下を使う
# input = sys.stdin.readline().rstrip()


N = int(input())
if N % 2 == 1:
    print(0)
else:
    k = N // 2
    a = int(math.log(k, 5))
    ans = 0
    for i in range(1, a + 1):
        ans += k // (5 ** i)
    print(ans)
Problem p02948 (python)

Fixed submission:
import heapq

N, M = map(int, input().split())
dict = {}
keys = set([])
for i in range(N):
    a, b = map(int, input().split())
    if a in keys:
        dict[a].append(b)
    else:
        keys.add(a)
        dict[a] = [b]


cand = []
cand_num = 0
val = 0
for a in range(1, M + 1):
    # insert values in cand
    if a in keys:
        for b in dict[a]:
            heapq.heappush(cand, (-b, a))
            cand_num += 1

    if cand_num != 0:
        (b_0, a_0)= heapq.heappop(cand)
        cand_num -= 1
        val += -b_0
    else:
        pass

print(val)

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

summation = [[] for i in range(10 ** 5 + 10 ** 4 + 1)]
for i in range(N):
    a, b = map(int, input().split())
    summation[a + b].append((a, b))

lst = []
for i in range(10 ** 5 + 10 ** 4):
    summation[i].sort()
    if summation[i] != []:
        for v in summation[i]:
            lst.append(v)

ans = 0
for i in range(M):
    remain = M - i
    if lst != []:
        while True:
            a, b = lst.pop()
            if a > remain:
                continue
            else:
                ans += b
                break
    else:
        break

print(ans)
Problem p02951 (python)

Fixed submission:

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

d = a - b
print(max(0, c - d))

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

d = a - b
print(max(0, c - d))
Problem p02954 (python)

Fixed submission:
S = [v for v in input()]
N = len(S)
M = [0] * N
for i in range(N):
    if S[i] == 'L':
        M[i] = i - 1
    else:
        M[i] = i + 1

binary = format(10 ** 100, 'b')
Bin = []
for v in binary:
    a = int(v)
    Bin.append(a)

ans = [1] * N
while Bin:
    a = Bin.pop()
    if a == 0:
        L = [0] * N
        for j in range(N):
            L[j] = M[M[j]]
        M = L
    else:
        new_ans = [0] * N
        for j in range(N):
            new_ans[M[j]] += ans[j]
        ans = new_ans

        L = [0] * N
        for j in range(N):
            L[j] = M[M[j]]
        M = L

print(' '.join(map(str, ans)))

Buggy submission (verdict: Runtime Error):
import numpy as np
from scipy import sparse

S = [v for v in input()]
N = len(S)
M = np.array([[0] * N for i in range(N)])
for i in range(N):
    if S[i] == 'L':
        M[i - 1][i] = 1
    else:
        M[i + 1][i] = 1
M = sparce.csr_matrix(M)

binary = format(10 ** 100, 'b')
Bin = []
for v in binary:
    a = int(v)
    Bin.append(a)

ans = [1] * N
for i in range(len(Bin)):
    a = Bin.pop()
    if a == 0:
        M = M * M
    else:
        ans = np.dot(M, ans)
        M = M * M

print(' '.join(map(str, ans)))

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

S = [v for v in input()]
N = len(S)
M = np.array([[0] * N for i in range(N)])
for i in range(N):
    if S[i] == 'L':
        M[i - 1][i] = 1
    else:
        M[i + 1][i] = 1

L = np.linalg.matrix_power(M, 10 ** 10)
a = np.dot(L, [1 for i in range(N)])

print(' '.join(map(str, a)))
Problem p02990 (python)

Fixed submission:
import operator as op
from functools import reduce
 
def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer // denom
 
 
N, K = list(map(int, input().split()))
 
def num(i):
    if i > N - K + 1:
        return 0
    else:
        num1 = ncr(N-K+1, i) % (10**9 + 7)
        num2 = ncr(K-1, i-1) % (10**9 + 7)
        num = (num1 * num2) % (10**9 + 7)
        return num
 
 
for i in range(1, K+1):
    print(num(i))

Buggy submission (verdict: Runtime Error):
import operator as op
from functools import reduce
 
def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom
 
 
N, K = list(map(int, input().split()))
 
def num(i):
    if i > N - K + 1:
        return 0
    else:
        num1 = int(ncr(N-K+1, i)) % (10**9 + 7)
        num2 = int(ncr(K-1, i-1)) % (10**9 + 7)
        num = (num1 * num2) % (10**9 + 7)
        return num
 
 
for i in range(1, K+1):
    print(num(i))

Buggy submission (verdict: Runtime Error):
import operator as op
from functools import reduce

def ncr(n, r):
    r = min(r, n-r)
    numer = reduce(op.mul, range(n, n-r, -1), 1)
    denom = reduce(op.mul, range(1, r+1), 1)
    return numer / denom


N, K = list(map(int, input().split()))

def num(i):
    if i > N - K + 1:
        return 0
    else:
        num1 = ncr(N-K+1, i) % (10**9 + 7)
        num2 = ncr(K-1, i-1) % (10**9 + 7)
        num = (num1 * num2) % (10**9 + 7)
        return int(num)


for i in range(1, K+1):
    print(num(i))
Problem p03038 (python)

Fixed submission:
from collections import deque

N, M = map(int, input().split())
A = list(map(int, input().split()))
A = [[1, A[i]] for i in range(N)]
A = deque(A)

BC = [list(map(int, input().split())) for i in range(M)]
A.extend(BC)
A = list(A)
A.sort(key=lambda x: x[1], reverse=1)


sum = 0
k = 0
for b, c in A:
        if k + b <= N:
                sum += b * c
                k += b
        elif k <= N:
                sum += (N - k) * c
                break

print(sum)

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

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
A = deque(A)


BC = [list(map(int, input().split())) for i in range(M)]
BC.sort(key=lambda x: x[1])
D = deque([])
for i in range(M):
        D.extend([BC[i][1]] * BC[i][0])


sum = 0
for i in range(N):
        if A[-1] >= D[-1]:
                sum += A.pop()
        else:
                sum += D.pop()

print(sum)

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

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
A = deque(A)

print(A)

BC = [list(map(int, input().split())) for i in range(M)]
BC.sort(key=lambda x: x[1])
D = deque([])
for i in range(M):
        D.extend([BC[i][1]] * BC[i][0])

print(D)

sum = 0
for i in range(N):
        if A[-1] >= D[-1]:
                sum += A.pop()
        else:
                sum += D.pop()

print(sum)

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
print(A)

for i in range(M):
        B, C = map(int, input().split())
        if C <= A[0]:
                pass
        else:
                idx = 0
                for k in range(N):
                        if A[k] < C:
                                idx = k
                        else:
                                break
                print(idx)

                if idx + 1 <= B:
                        for l in range(idx+1):
                                A[l] = C
                else:
                        A = A[B:idx+1] + [C for i in range(B)] + A[idx+1:]

        print(A)

print(sum(A))
Problem p02915 (python)

Fixed submission:
def main():
  n = int(input())
  print(n**3)
  
main()

Buggy submission (verdict: Runtime Error):
def main():
  n = int(input())
  pirnt(n**3)
  
main()
Problem p02580 (python)

Fixed submission:
H,W,M = map(int,input().split())
hs = [0] * H
ws = [0] * W
s = set()

for i in range(M):
  r,c = map(int,input().split())
  r -= 1
  c -= 1
  hs[r] += 1
  ws[c] += 1
  s.add((r,c))
mh = 0
mw = 0
for i in range(H):
  mh = max(mh, hs[i])
for j in range(W):
  mw = max(mw, ws[j])

i_s = list()
j_s = list()
for i in range(H):
  if mh == hs[i]:
    i_s.append(i)
for j in range(W):
  if mw == ws[j]:
    j_s.append(j)
ans = mh + mw
for i in i_s:
  for j in j_s:
    if (i,j) in s:
      continue
    print(ans)
    exit()
ans -= 1
print(ans)

Buggy submission (verdict: Runtime Error):
H,W,M = map(int, input().split())
hNum = [0]*H
wNum = [0]*W
bom = [[0] * W for i in range(H)]
for i in range(M):
  h,w = map(int, input().split())
  bom[h-1][w-1] = 1
  hNum[h-1] += 1
  wNum[w-1] += 1

hmax = max(hNum)
wmax = max(wNum)
ans = hmax + wmax
if bom[hNum.index(hmax)][wNum.index(wmax)] == 1:
  ans -= 1

print(ans)

Buggy submission (verdict: Runtime Error):
H,W,M = map(int, input().split())
hNum = [0]*H
wNum = [0]*W
bom = [[0] * W for i in range(H)]
for i in range(M):
  h,w = map(int, input().split())
  bom[h-1][w-1] = 1
  hNum[h-1] += 1
  wNum[w-1] += 1

ans = 0
for i in range(H):
  for j in range(W):
    if bom[i][j] == 1:
      ans = max(ans, hNum[i]+wNum[j]-1)
    else:
      ans = max(ans, hNum[i]+wNum[j])

print(ans)
Problem p02596 (python)

Fixed submission:
K = int(input())

if K%7 == 0:
  L = 9*K/7
else:
  L = 9*K
s = 1

for i in range(1, 9*(10**6)+1):
  s = s*10%L
  if s == 1:
    print(i)
    exit()

print("-1")

Buggy submission (verdict: Runtime Error):
K = int(input())
L = 0
if K % 7 == 0:
  L = 9*K//L
else:
  L = 9*K
  
t = 1
ans = -1
for i in range(1,L,1):
  t = t*10
  if t % L == 1:
    ans = i
    break
  t = t % L
print(ans)

Buggy submission (verdict: Runtime Error):
K = int(input())
L = 0
if K % 7 == 0:
  L = 9*K//L
else:
  L = 9*K
  
t = 1
ans = 0
for i in range(1,L,1):
  t = t*10
  if t % L == 1:
    ans = i
    break
  t = t % L
print(ans)
Problem p02659 (python)

Fixed submission:
from decimal import Decimal
A,B = input().split()
print(int(int(A)*Decimal(B)))

Buggy submission (verdict: Runtime Error):
A,B = map(float, input().split())
ans = Decimal(A)*Decimal(B)
print(int(ans))
Problem p02661 (python)

Fixed submission:
import statistics
import math

N = int(input())
listA = [0] * N
listB = [0] * N
idx = 0
for i in range(N):
  listA[idx],listB[idx] = map(int, input().split())
  idx += 1

medianA = 0
medianB = 0
ans = 0
if N%2 == 0:
  medianA = statistics.median(listA)
  medianB = statistics.median(listB)
  ans = (medianB - medianA) * 2 + 1
else:
  medianA = statistics.median(listA)
  medianB = statistics.median(listB)
  ans = medianB - medianA + 1

print(int(ans))

Buggy submission (verdict: Runtime Error):
N = int(input())
listA = [0] * N
listB = [0] * N
idx = 0
for i in range(N):
  listA[idx],listB[idx] = map(int, input().split())
  idx += 1

medianA = 0
medianB = 0
ans = 0
if N%2 == 0:
  medianA = statistics.median(listA)
  medianB = statistics.median(listB)
  ans = (medianB - medianA) * 2 + 1
else:
  medianA = statistics.median(listA)
  medianB = statistics.median(listB)
  ans = medianB - medianA + 1

print(int(ans))
Problem p03127 (python)

Fixed submission:
import fractions
from functools import reduce

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

n = int(input())
A = list(map(int, input().split()))
ans = gcd(*A)
print(str(ans))

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

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

n = int(input())
A = list(map(int, input().split()))
ans = gcd(*A)
print(str(ans))

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

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

n = int(input())
A = list(map(int, input().split()))
ans = gcd(*A)
print(str(ans))
Problem p03221 (python)

Fixed submission:
import sys
readline = sys.stdin.readline
write = sys.stdout.write

N, M = map(int,input().split())
cities = []
for i in range(M):
    p, y = map(int,readline().split())
    temp = [p, y, i]
    cities.append(temp)
id = [1 for i in range(N)] #国i+1の都市に対して次に割り振るべきID
sortedcities = sorted(cities, key=lambda x:x[1])
for i in range(M):
    sortedcities[i].append(id[sortedcities[i][0]-1])
    id[sortedcities[i][0]-1] += 1
originalcities = sorted(sortedcities, key=lambda x:x[2])
for i in range(M):
    write(str(originalcities[i][0]).zfill(6) + str(originalcities[i][3]).zfill(6) + "\n")

Buggy submission (verdict: Runtime Error):
import sys
readline = sys.stdin.readline
write = sys.stdout.write

N, M = map(int,input().split())
cities = []
for i in range(M):
    p, y = map(int,readline().split())
    temp = [p, y, i]
    cities.append(temp)
id = [1 for i in range(M)]
sortedcities = sorted(cities, key=lambda x:x[1])
for i in range(M):
    sortedcities[i].append(id[sortedcities[i][0]-1])
    id[sortedcities[i][0]-1] += 1
originalcities = sorted(sortedcities, key=lambda x:x[2])
for i in range(M):
    write(str(originalcities[i][0]).zfill(6) + str(originalcities[i][3]).zfill(6) + "\n")
Problem p02597 (python)

Fixed submission:
N = int(input())
s = input()
r = s.count("R")
print(s[:r].count("W"))

Buggy submission (verdict: Runtime Error):
def popcount(x):
    '''xの立っているビット数をカウントする関数
    (xは64bit整数)'''

    # 2bitごとの組に分け、立っているビット数を2bitで表現する
    x = x - ((x >> 1) & 0x5555555555555555)

    # 4bit整数に 上位2bit + 下位2bit を計算した値を入れる
    x = (x & 0x3333333333333333) + ((x >> 2) & 0x3333333333333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0f # 8bitごと
    x = x + (x >> 8) # 16bitごと
    x = x + (x >> 16) # 32bitごと
    x = x + (x >> 32) # 64bitごと = 全部の合計
    return x & 0x0000007f

n = int(input())
data = input()
c = 0
countR = 0
mask = 0
for i in range(len(data)):
  #print(i)
  #print(data[i])
  if i != 0:
    c = c << 1
  ci = data[i]
  if ci == 'R':
    countR += 1
  else:
    c += 1
for i in range(n - countR):
  mask += 1
  mask = mask << 1
mask = mask << countR - 1
#print(bin(c))
#print(bin(mask))
#print(countR)
print(popcount(c & mask))
Problem p02726 (python)

Fixed submission:
n, x, y = list(map(int,input().split()))
d = [0 for i in range(n-1)] 
for i in range(1,n+1):
  for j in range(i+1,n+1):
    d[min([j-i, abs(x-i) + 1 + abs(j-y), abs(y-i) + 1 + abs(j-x)])-1] += 1

for i in d:
  print(i)

Buggy submission (verdict: Runtime Error):
n, x, y = list(map(int,input().split()))
d = [0 for i in range(1,n)] 
for i in range(1,n+1):
  for j in range(1,i+1):
    d[min([j-i, abs(x-i) + 1 + abs(j-y), abs(y-i) + 1 + abs(j-x)])-1] += 1

for i in d:
  print(i)
Problem p03127 (python)

Fixed submission:

n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
def gcd(x,y):
    while y:
        x,y=y,x%y
    return x

for i in a:
    c=gcd(c,i)
print(c)

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
for i in a:
    c=gcd(c,a)
print(c)

Buggy submission (verdict: Runtime Error):
#copy code
from fractions import gcd
n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
for i in a:
    c=gcd(c,a)
print(c)
Problem p03774 (python)

Fixed submission:
n,m=[int(i) for i in input().split()]
ab=[]
cd=[]
for i in range(n):
    a,b=[int(j) for j in input().split()]
    ab.append((a,b))

for i in range(m):
    c,d=[int(j) for j in input().split()]
    cd.append((c,d))

for i in range(n):
    mini=10000000000000000
    for j in range(m):
        dis=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if mini>dis:
            mini=dis
            point=j+1
    print(point)

Buggy submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
ab=[]
cd=[]
for i in range(n):
    a,b=[int(j) for j in input().split()]
    ab.append((a,b))

for i in range(m):
    c,d=[int(j) for j in input().split()]
    cd.append((c,d))

for i in range(n):
    mini=10000000
    for j in range(m):
        dis=abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if mini>dis:
            mini=dis
            point=j+1
    print(point)
Problem p03804 (python)

Fixed submission:
n,m=[int(i) for i in input().split()]
a=[input() for i in range(n)]
b=[input() for i in range(m)]
result=True
for i in range(m):
    if (b[i] in a[i])==False:
        result=False
        break
print("Yes" if result else "No")

Buggy submission (verdict: Runtime Error):
n,m=[int(i) for i in input().split()]
a=[input() for i in range(n)]
b=[input() for i in range(m)]
for i in range(m):
    for j in range(len(b[i])):
        if b[i][j]!=a[i][j]:
            result=True
            break
print("No" if result else "Yes")
Problem p03011 (python)

Fixed submission:
*A, = map(int,input().split())
A.sort()
print(A[0]+A[1])

Buggy submission (verdict: Runtime Error):
*A = map(int,input().split())
A.sort()
print(A[0]+A[1])
Problem p02546 (python)

Fixed submission:
s=input()
if(s[-1]=='s'):
  s+='es'
else:
  s+='s'
print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
c,f=0,0
while(n>0):
  a,b=map(int,input().split())
  if(a==b):
    c+=1
  else:
    c=0
  if(c>=3):
    f=1
    break
  n-=1
if(f==1 or c>=3):
  print("Yes")
else:
  print("No")
Problem p02570 (python)

Fixed submission:
d,t,s=map(int,input().split())
if(d/s<=t):
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
d,t,s=map(int,input())
if(d/s<=t):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
d,t,s=map(int,input())
if(d//t>=s):
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
d,t,s=map(int,input())
if(d/t>=s):
  print("YES")
else:
  print("NO")
Problem p02836 (python)

Fixed submission:
S = input()
ans = 0
N = len(S)
for i in range(N):
    if S[i] != S[N-1-i]:
        ans += 1
print(ans//2)

Buggy submission (verdict: Runtime Error):
S = input()
ans = 0
N = len(S)
for i in range(N):
    if S[i] != S[N-1-i]:
        ans += 1
print(cnt//2)
Problem p02897 (python)

Fixed submission:
n = int(input())
a = n // 2
if n % 2 == 1:
    a += 1
print(a / n)

Buggy submission (verdict: Runtime Error):
=int(input())
even=N//2
odd=N-even
print(str(odd/N)+'000000000')
Problem p02989 (python)

Fixed submission:
n=int(input())
d=list(map(int,input().split()))
d.sort()
print(d[n//2]-d[n//2-1])

Buggy submission (verdict: Runtime Error):
n=int(input())
d=list(map(int,input().split()))
d.sort()
print(d[n//2]-d[n//
Problem p03041 (python)

Fixed submission:
n,k=map(int,input().split())
S=list(input())
s=S[k-1].lower()
S[k-1]=s
lst=''.join(S)
print(lst)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
s=input()
for i in n:
	if i==k:
        if i=='A':
            i='a'
        elif i=='B':
            i='b'
        elif i=='C':
            i='c'        
print(i)
Problem p03272 (python)

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

Buggy submission (verdict: Runtime Error):
N,I=map(int,input().split())
print(N-I+
Problem p02577 (python)

Fixed submission:
print('Yes' if sum(list(map(int, list(input()))))%9 == 0 else 'No')

Buggy submission (verdict: Runtime Error):
from  math import log10
n = int(input())
dig = int(log10(n)+1)
cnt = 0
for _ in range(dig):
  cnt += n%10 
  n //= 10
print('Yes' if cnt%9 == 0 else 'No')
Problem p02659 (python)

Fixed submission:
from math import floor
from fractions import Fraction
a, b = input().split()
a = int(a)
b = Fraction(b)
print(floor(a * b))

Buggy submission (verdict: Runtime Error):
a ,b = map(int, input().split()) 
print(int(a*b))
Problem p02785 (python)

Fixed submission:
N,K = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
print(sum(H[K:]))

Buggy submission (verdict: Runtime Error):
N,K = map(int, input().split())
H = list(map(int, input().split()))
H.sort(reverse=True)
for i in range(K):
  H[i] = 0
print(sum(H))
Problem p02819 (python)

Fixed submission:
x = int(input())
def prime(x):
  for i in range(2, int(x**0.5)+1):
    if x%i == 0:
      return False
  return True
for i in range(x, 100003 + 1):
  ans = prime(i)
  if ans:
    break
print(i)

Buggy submission (verdict: Runtime Error):
x = int(input())
def prime(n):
  for j in range(2, int(n**(0.5))+1):
    if n%j == 0:
      return False
  return True
for i in range(x, 10**(5) + 1):
  if prime(i):
    ans = i
    break
print(ans)
Problem p03075 (python)

Fixed submission:
ans = [int(input()) for _ in range(6)]
print(':(' if abs(ans[0]-ans[4]) > ans[-1] else 'Yay!')

Buggy submission (verdict: Runtime Error):
ans = [int(input()) for _ range(6)]
print(':(' if abs(ans[0]-ans[4]) > ans[-1] else 'Yay!')

Buggy submission (verdict: Runtime Error):
ans = [int(input()) for _ range(6)]
print(':(' if abs(ans[0]-ans[4]) <= ans[-1] else 'Yay!')
Problem p03127 (python)

Fixed submission:
from fractions import gcd
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def gcd_list(numbers):
    return reduce(gcd, numbers)
print(gcd_list(a))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
print(reduce(gcd, numbers))

Buggy submission (verdict: Runtime Error):
from fractions import gcd
from functools import reduce
n = int(input())
a = list(map(int, input().split()))
def gcd(*numbers):
    return reduce(math.gcd, numbers)
print(gcd(a))