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

Fixed submission:
n = int(input())
money = 0
for _ in range(n):
  p = input().split()
  if p[1] == 'JPY':
    money += int(p[0])
  elif p[1] == 'BTC':
    money += float(p[0]) * 380000

print(money)

Buggy submission (verdict: Runtime Error):
n = int(input())
money = 0
for _ in range(n):
  p = input().split()
  if p[1] == 'JPY':
    money += int(p[0])
  elif p[1] == 'BTC':
    money += int(p[0]) * 380000

print(money)

Buggy submission (verdict: Runtime Error):
n = int(input())
money = 0
for _ in range(n):
  p = input().split()
  if p[1] == 'JPY':
    money += int(p[0])
  elif p[1] == 'BTC':
    money += int(p[0]) * 380000.0

print(money)
Problem p03239 (python)

Fixed submission:
n, limit = map(int, input().split())
cost = list()
for _ in range(n):
  c, time = [int(a) for a in input().split()]
  if time <= limit:
    cost.append(c)
print(min(cost) if len(cost) > 0 else 'TLE')

Buggy submission (verdict: Runtime Error):
n, limit = map(int, input().split())
cost = list()
for _ in range(n):
  c, time = [int(a) for a in input().split()]
  if time <= limit:
    cost.append(c)
print(max(cost))
Problem p03292 (python)

Fixed submission:
*a, = map(int, input().split())
print(max(a) - min(a))

Buggy submission (verdict: Runtime Error):
a = map(int, input().split())
print(max(a) - min(a))a = [int(i) for i in input().split()]
print(max(a) - min(a))

Buggy submission (verdict: Runtime Error):
*a = map(int, input().split())
print(max(a) - min(a))

Buggy submission (verdict: Runtime Error):
a = map(int, input().split())
print(max(a) - min(a))

Buggy submission (verdict: Runtime Error):
*a = map(int, input().split())
print(max(a) - min(a))
Problem p03469 (python)

Fixed submission:
s = input()
print(s.replace(s[0:4], '2018'))

Buggy submission (verdict: Runtime Error):
s = input()
print(s.replace(a[0:4], '2018'))
Problem p03470 (python)

Fixed submission:
n = int(input())
print(len(set([int(input()) for _ in range(n)])))

Buggy submission (verdict: Runtime Error):
n = int(input())
print(len(set([input() for a in range(m)])))
Problem p03471 (python)

Fixed submission:
N,Y=map(int,input().split())
answer=-1,-1,-1
for x in range(N+1):
    for y in range(N-x+1):
        z=N-x-y
        if 0<=z<=2000 and 10000*x+5000*y+1000*z==Y:
            answer=x,y,z
            break
    else:
        continue
    break
print(*answer)

Buggy submission (verdict: Runtime Error):
n, m = int(input().split())
answer = (-1, -1, -1,) # (１万円, 五千円, 千円,)
for x in range(n+1): # 一万円の枚数　０－９
    for y in range(n-x+1): # 五千円の枚数 ０－９
        z = n - x - y # 千円の枚数　０－９
        if 0 <= z <= 2000 and 10000 * x + 5000 * y + 1000 * z == m:
            answer = (x, y, z,)
            break
        else:
            continue
        break
print(*answer)

Buggy submission (verdict: Runtime Error):
n, m = int(input().split())
answer = (-1, -1, -1,) # (１万円, 五千円, 千円,)
for x in range(n+1): # 一万円の枚数　０－９
    for y in range(n+1): # 五千円の枚数 ０－９
        z = n - x - y # 千円の枚数　０－９
        if 0 <= z <= 2000 and 10000 * x + 5000 * y + 1000 * z == m:
            answer = (x, y, z,)
            break
        else:
            continue
        break
print(*answer)
Problem p03474 (python)

Fixed submission:
a,b=map(int,input().split())
s=input()
if 1<=a<=5 and 1<=b<=5:
    if s[a]=="-":
        if s[0:a].isdecimal() and s[a+1:a+b+1].isdecimal():
            print("Yes")
            exit()
print("No")

Buggy submission (verdict: Runtime Error):
A, B = map(int, input().split())
p = input()
a, b = p[:A], p[A:B+1]
print('Yes' if b[0] == '-' and (a + b[1:]).isdecimal else 'No')
Problem p03543 (python)

Fixed submission:
a,b,c,d=input()
print("Yes" if a==b==c or b==c==d else "No")

Buggy submission (verdict: Runtime Error):
n = input()
print('Yes' if n.count(n[0]) >= 3 or n.count(n[1] >= 3 else 'No'))
Problem p03606 (python)

Fixed submission:
n = int(input())
count = 0
for _ in range(n):
  s = [int(a) for a in input().split()]
  count += s[1] - (s[0]-1)
  
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
for _ in range(n):
  print(sum(map(int, input().split())))n = int(input())
count = 0
for _ in range(n):
  s = [int(a) for a in input().split()]
  count += s[1] - (s[0]-1)
  
print(count)
Problem p03738 (python)

Fixed submission:
a = int(input())
b = int(input())
print('GREATER' if a > b else 'LESS' if a < b else 'EQUAL')

Buggy submission (verdict: Runtime Error):
a, b = map(int, input().split())
print('GREATER' if a > b else 'LESS' if a < b else 'EQUAL')
Problem p02687 (python)

Fixed submission:
s = input()
if s =='ABC':
    print('ARC')
else:
    print('ABC')

Buggy submission (verdict: Runtime Error):
s = int(input())
if s =='ABC':
    print('ARC')
else:
    print('ABC')
Problem p02706 (python)

Fixed submission:
n,m = map(int,input().split())
ai = list(map(int,input().split()))
sumday = sum(ai)
if n-sumday<0:
  print(-1)
else:
  print(n-sumday)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input())
ai = list(map(int,input().split()))
sumday = sum(ai)
if n-sumday<0:
  print(-1)
else:
  print(n-sumday)
Problem p02795 (python)

Fixed submission:
h = int(input())
w = int(input())
n = int(input())

big = max(h, w)
count = 0
kuro = 0
while kuro < n:
    kuro += big
    count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n = int(input())
arr = [list(map(int,input().split())) for i in range(n)]
arr.sort()
outcount = 0
#リストの数を減らすと最後の２つがぶつかってた場合が判定できない
#時間がかかりすぎ1回okだったところは次はパスしたい
outnum = 0
def saiki():
    global outcount
    global outnum
    for i in range(outnum, len(arr)-2):
        if arr[i][0] + arr[i][1] > arr[i+1][0] - arr[i+1][1]:#アウトの条件
            outcount += 1
            outnum = i-1
            if [i+1][0] + arr[i+1][1] <= arr[i+2][0] - arr[i+2][1]:#1つあとのやつがぶつかってるか
                arr.pop(i)
            else:
                arr.pop(i + 1)
            return 'no'


while saiki() == 'no':
    saiki()

print(n - outcount)
Problem p02817 (python)

Fixed submission:
a, b  = map(str, input().split())
print(b + a)

Buggy submission (verdict: Runtime Error):
s,t = map(input().split())
print(t + s)
Problem p02898 (python)

Fixed submission:
n,k = map(int,input().split())
arrh = list(map(int,input().split()))
count = 0
for i in arrh:
    if i >= k:
        count += 1
print(count)

Buggy submission (verdict: Runtime Error):
n,k = map(int,input().split())
arrh = list(map(int,input().split())
count = 0
for i in arrh:
            if i >= k:
            	count += 1
print(count)
Problem p02909 (python)

Fixed submission:
s = input()
if s == 'Sunny':
  print('Cloudy')
elif s == 'Cloudy':
  print('Rainy')
else:
  print('Sunny')

Buggy submission (verdict: Runtime Error):
s = input()
a = ['Sunny','Cloudy','Rainy']
print(a[(a.index(s)+1) % 3]
Problem p02958 (python)

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

count = 0
for i in range(n):
  if arr[i]!=i+1:
    count += 1

if count<=2:
  print('YES')
else:
  print('NO')

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

count = 0
for i in range(n):
  if arr[n]!=i+1:
    count += 1

if count<=2:
  print('YES')
else:
  print('NO')
Problem p02971 (python)

Fixed submission:
n = int(input())
ai = [0]*n
for i in range(n):
  ai[i] = int(input())
bi = ai[:]
bi.sort()
num1 = bi[-1]
num2 = bi[-2]
for i in ai:
  if i == num1:
    print(num2)
  else:
    print(num1)

Buggy submission (verdict: Runtime Error):
n = int(input())
ai = []
for i in range(n):
  ai[i] = int(input())
bi = ai[:]
bi.sort()
num1 = bi[-1]
num2 = bi[-2]
for i in ai:
  if i == num1:
    print(num2)
  else:
    print(num1)
Problem p02995 (python)

Fixed submission:
a,b,c,d = map(int,input().split())
a -= 1
from fractions import gcd
divac = a // c
divad = a // d
divbc = b // c
divbd = b // d
divacd = a // (c*d//gcd(c,d))
divbcd = b // (c*d//gcd(c,d))
Acd = divac + divad - divacd
Bcd = divbc + divbd - divbcd
wareru = Bcd - Acd
ans = b-a-wareru
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,c,d = map(int,input().split())
a -= 1
from math import gcd
divac = a // c
divad = a // d
divbc = b // c
divbd = b // d
divacd = a // (c*d//gcd(c,d))
divbcd = b // (c*d//gcd(c,d))
Acd = divac + divad - divacd
Bcd = divbc + divbd - divbcd
wareru = Bcd - Acd
ans = b-a-wareru
print(ans)

Buggy submission (verdict: Runtime Error):
a, b, c, d  = map(int, input().split())
import math
divc = (b-a)//c
if a % c == 0:
    divc += 1
if b % c == 0:
    divc += 1
if a % c == 0 and b % c == 0:
    divc -= 1
if b-a<c:
    divc += 1

divd = (b-a)//d
if a % d == 0:
    divd += 1
if b % d == 0:
    divd += 1
if a % d == 0 and b % d == 0:
    divd -= 1   
if b-a<d:
    divd += 1

gcd = math.gcd(c,d)
cd = c * d // gcd
divcd = (b-a)//cd
if a % cd == 0:
    divcd += 1
if b % cd == 0:
    divcd += 1
if a % cd == 0 and b % cd == 0:
    divcd -= 1 
if b-a<cd:
    divcd += 1
wareru = divc + divd - divcd
ans = b - a - wareru +1
print(ans)
Problem p03000 (python)

Fixed submission:
n,x = map(int,input().split())
li = list(map(int,input().split()))
count = 1
kyori = 0
for i in li:
  kyori = kyori + i
  count += 1
  if kyori > x:
    count -=1
    break
print(count)

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
li = list(map(int,input().split()))
count = 1
kyori
for i in li:
  kyori = kyori + i
  count += 1
  if kyori > x:
    break
print(count-1)
Problem p03029 (python)

Fixed submission:
a,p = map(int,input().split())
ans = (3*a + p)//2
print(ans)

Buggy submission (verdict: Runtime Error):
a,p = map(int,input().split())
ans = (2*a + P)//2
print(ans)
Problem p03076 (python)

Fixed submission:
arr = [0]*5
for i in range(5):
    arr[i] = int(input())
time = 0
for ar in arr:
    time += (-(-ar//10))*10
amari = []
for i in arr:
    amari.append(i%10)
amari.sort()
while 0 in amari:
    amari.remove(0)
if amari == []:
    amari.append(10)
print(time - (10-amari[0]))

Buggy submission (verdict: Runtime Error):
arr = [0]*5
for i in range(5):
    arr[i] = int(input())
time = 0
for ar in arr:
    time += (-(-ar//10))*10
amari = []
for i in arr:
    amari.append(i%10)
amari.sort()
while 0 in amari:
    amari.remove(0)
print(time - (10-amari[0]))

Buggy submission (verdict: Runtime Error):
arr = [0]*5
for i in range(5):
  arr[i] = int(input())
time = 0
for ar in arr:
  time += -(-ar//10)
amari = []
for i in arr:
  amari.append(i%10)
amari.sort()
print(time - (10-amari[0])
Problem p03219 (python)

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

Buggy submission (verdict: Runtime Error):
x,y = map(int,inpu().split())
print(x+int(y/2))
Problem p03238 (python)

Fixed submission:
n = int(input())
if n ==1:
  print('Hello World')
else:
  a = int(input())
  b = int(input())
  print(a+b)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n ==1:
  print('Hello World'):
else:
  a = int(input())
  b = int(input())
  print(a+b)
Problem p03285 (python)

Fixed submission:
n = int(input())
kouho = []
for i in range(26):
    for j in range(15):
        kouho.append(i*4+j*7)
if n in kouho:
    print('Yes')
else:
    print('No')

Buggy submission (verdict: Runtime Error):
n = int(input())
if (n%7)%4==0:
  print('Yes')
  break
elif (n%4)%7==0:
  print('Yes')
  break
else:
  print('No')
Problem p03407 (python)

Fixed submission:
a,b,c = map(int,input().split())
if a+b>=c:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b,n = map(int,input().split())
if a+b>=c:
  print('Yes')
else:
  print('No')
Problem p03424 (python)

Fixed submission:
n = int(input())
arare = list(map(str,input().split()))
if 'Y' in arare:
  print('Four')
else:
  print('Three')

Buggy submission (verdict: Runtime Error):
n = int(input())
arare = list(map(int,input().split()))
if 'Y' in arare:
  print('Four')
else:
  print('Three')
Problem p03456 (python)

Fixed submission:
a,b = input().split()
num = int(a+b)
import math
root = math.sqrt(num)
if root%1==0:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
a,b = input().split()
num = int(a+b)
import math
root = math.sqrrt(num)
if root%1==0:
  print('Yes')
else:
  print('No')
Problem p03493 (python)

Fixed submission:
s = input()
print(int(s.count('1')))

Buggy submission (verdict: Runtime Error):
s = input()
print(int(s.count('1'))
Problem p03501 (python)

Fixed submission:
n,a,b = map(int,input().split())
print(min(a*n,b))

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

Fixed submission:
alf = ['A','B','C','D','E','F']
a,b = input().split()
if alf.index(a)<alf.index(b):
  print('<')
elif alf.index(a)==alf.index(b):
  print('=')
else:
  print('>')

Buggy submission (verdict: Runtime Error):
alf = ['A','B','C','D','E','F']
a,b = map(str,input().split())
if alf.index(a)<alf.index(b):
  print('<')
elif alf.index(a)=alf.index(b):
  print('=')
else:
  print('>')

Buggy submission (verdict: Runtime Error):
alf = ['A','B','C','D','E','F']
a,b = input().split()
if alf.index(a)<alf.index(b):
  print('<')
elif alf.index(a)=alf.index(b):
  print('=')
else:
  print('>')
Problem p03679 (python)

Fixed submission:
x,a,b = map(int,input().split())
kigen = b-a
if 0>=kigen:
    print('delicious')
elif 0<kigen<=x:
    print('safe')
else:
    print('dangerous')

Buggy submission (verdict: Runtime Error):
x,a,b = map(int,input().split())
kigen = b-a
if x>kigen:
  print('delicious')
elif x=kigen:
  print('safe')
else:
  print('dangerous')
Problem p03777 (python)

Fixed submission:
a,b = input().split()
if a=='H':
  print(b)
else:
  if b=='D':
    print('H')
  else:
    print('D')

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a=='H':
  print(b)
else:
  if b=='D':
    print('H')
  else:
    print('D')
Problem p03852 (python)

Fixed submission:
s = input()
boin = ["a","e","i","o","u"]
if s in boin:
  print('vowel')
else:
  print('consonant')

Buggy submission (verdict: Runtime Error):
s = input()
boin = [a,e,i,o,u]
if s in boin:
  print('vowel')
else:
  print('consonant')
Problem p02947 (python)

Fixed submission:
# ABC 137, c
n = int(input())
S = []
D = {}
count = 0
for i in range(n):
    s = ''.join(sorted(input()))
    if s in D:
        count += D[s]
        D[s] += 1
    else:
        D[s] =1
print(count)

Buggy submission (verdict: Runtime Error):
# ABC 137, c
from collections import Counter
import math
n = int(input())
d = []
for i in range(n):
    s = ''.join(sorted(input()))
    d.append(s)

C = Counter(d).most_common()
def comb(n, r):
    if n < r:
        return(0)
    f = math.factorial
    return (f(n) / f(r) / f(n-r))

count = 0
for key, value in C:
    count += comb(value, 2)
print(int(count))
Problem p03086 (python)

Fixed submission:
#ABC 122, B - ATCoder
S = input()
N = len(S)

ans = 0
for i in range(N):
    for j in range(i, N):
        if all('ACGT'.count(c) == 1 for c in S[i:j+1]):
            ans = max(ans, j - i + 1)
print(ans)

Buggy submission (verdict: Runtime Error):
#ABC 122, B - ATCoder
S = input()
N = len(S)

ans = 0
for i in range(N):
    for j in range(i, N):
        if all('ACGT'.count(c) == 1 for c in S[i:j+1])
            ans = max(ans, j - i + 1)
print(ans)
Problem p03282 (python)

Fixed submission:
s = input()
k = int(input())

ans = s[0]

for i in range(0, k):
	if s[i] != '1':
		ans = s[i]
		break
		
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
k = int(input())

if s[0] == '1':
	print(int(s[1]))
else:
	print(int(s[0]))
Problem p03324 (python)

Fixed submission:
#ABC 100 B - Ringo's favorite number
A = [int(el) for el in input().split(' ')]
if A[1] != 100:
    print(100**A[0] * A[1])
else:
    print(100**A[0] * 101)

Buggy submission (verdict: Runtime Error):
#ABC 100 B - Ringo's favorite number
A = [int(el) for el in input().split(' ')]
if N != 100:
    print(100**A[0] * A[1])
else:
    print(100**A[0] * 101)
Problem p03545 (python)

Fixed submission:
N = [int(el) for el in list(input())]

def result(N):
    if N[0]+N[1]+N[2]+N[3] ==7:
        print('{}+{}+{}+{}=7'.format(N[0],N[1],N[2],N[3]))
        return
    if N[0]-N[1]+N[2]+N[3]==7:
        print('{}-{}+{}+{}=7'.format(N[0],N[1],N[2],N[3]))
        return
    if N[0]+N[1]-N[2]+N[3]==7:
        print('{}+{}-{}+{}=7'.format(N[0],N[1],N[2],N[3]))
        return
    if N[0]+N[1]+N[2]-N[3]==7:
        print('{}+{}+{}-{}=7'.format(N[0],N[1],N[2],N[3]))
        return
    if N[0]-N[1]-N[2]+N[3]==7:
        print('{}-{}-{}+{}=7'.format(N[0],N[1],N[2],N[3]))
        return
    if N[0]-N[1]+N[2]-N[3]==7:
        print('{}-{}+{}-{}=7'.format(N[0],N[1],N[2],N[3]))
        return
    if N[0]+N[1]-N[2]-N[3]==7:
        print('{}+{}-{}-{}=7'.format(N[0],N[1],N[2],N[3]))
        return
    if N[0]-N[1]-N[2]-N[3]==7:
        print('{}-{}-{}-{}=7'.format(N[0],N[1],N[2],N[3]))
        return
result(N)

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

N = np.array([int(el) for el in list(input())])

A = np.array([[1,1,1,1],
             [1,-1,1,1],[1,1,-1,1],[1,1,1,-1],
             [1,-1,-1,1],[1,-1,1,-1],[1,1,-1,-1],
             [1,-1,-1,-1]])

B = np.matmul(A, N)

def result(B):
    if B[0] == 7:
        print("{}+{}+{}+{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[1] == 7:
        print("{}-{}+{}+{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[2] == 7:
        print("{}+{}-{}+{}=7".format(N[0],N[1],N[2],N[3])) 
        return
    if B[3] == 7:
        print("{}+{}-{}+{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[4] == 7:
        print("{}+{}+{}-{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[5] == 7:
        print("{}-{}-{}+{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[6] == 7:
        print("{}-{}+{}-{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[7] == 7:
        print("{}+{}-{}-{}=7".format(N[0],N[1],N[2],N[3]))
        return

result(B)

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

N = np.array([int(el) for el in list(input())])

A = np.array([[1,1,1,1],
             [1,-1,1,1],[1,1,-1,1],[1,1,1,-1],
             [1,-1,-1,1],[1,-1,1,-1],[1,1,-1,-1],
             [1,-1,-1,-1]])

B = np.matmul(A, N)

def result(B):
    if B[0] == 7:
        print("{}+{}+{}+{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[1] == 7:
        print("{}-{}+{}+{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[2] == 7:
        print("{}+{}-{}+{}=7".format(N[0],N[1],N[2],N[3])) 
        return
    if B[3] == 7:
        print("{}+{}-{}+{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[4] == 7:
        print("{}+{}+{}-{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[5] == 7:
        print("{}-{}-{}+{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[6] == 7:
        print("{}-{}+{}-{}=7".format(N[0],N[1],N[2],N[3]))
        return
    if B[7] == 7:
        print("{}+{}-{}-{}=7".format(N[0],N[1],N[2],N[3]))
        return

result(B)
Problem p03633 (python)

Fixed submission:
# ABC 70, C - multiple clock
import fractions

n = int(input())
T = []
for i in range(n):
    T.append(int(input()))

ans = T[0]
for i in range(1, n):
    ans = ans * T[i] // fractions.gcd(ans, T[i])

print(ans)

Buggy submission (verdict: Runtime Error):
# ABC 70, C - multiple clock
import math

n = int(input())
T = []
for i in range(n):
    T.append(int(input()))

ans = T[0]
for i in range(1, n):
    ans = ans * T[i] // math.gcd(ans, T[i])

print(ans)
Problem p03043 (python)

Fixed submission:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# 初項s, 交差dのn個の数列の和
def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    N, K = map(int, input().split())
    ans = 0.0
    for i in range(1, N + 1):
        if i < K:
            num = 0
            while i < K:
                i *= 2
                num += 1
            ans += (1 / (2**num)) * (1 / N)

        else:
            ans += 1 / N

    print("{0:.10f}".format(ans))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# 初項s, 交差dのn個の数列の和
def sum_of_arithmetic_progression(s, d, n):
    return n * (2 * s + (n - 1) * d) // 2


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    N, K = map(int, input().split())
    ans = 0.0
    for i in range(1, N + 1):
        if i < K:
            num = 0
            while i < K:
                i *= 2
                num += 1
            ans += (1 / (2**num)) * (1 / N)

        else:
            ans += 1 / N

    print(f"{ans:.10f}")


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

Fixed submission:
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    N = int(input())

    ans = 0
    for _ in range(N):
        x, u = input().split()
        x = float(x)
        if u == "JPY":
            ans += x
        else:
            ans += x * 380000

    print(ans)


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float("inf")
YES, Yes, yes, NO, No, no = "YES", "Yes", "yes", "NO", "No", "no"
dy4, dx4 = [0, 1, 0, -1], [1, 0, -1, 0]
dy8, dx8 = [0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1]


def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W


def ceil(a, b):
    return (a + b - 1) // b


# aとbの最大公約数
def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)


# aとbの最小公倍数
def lcm(a, b):
    g = gcd(a, b)
    return a / g * b


def main():
    N = int(input())

    ans = 0
    for _ in range(N):
        x, u = input().split()
        x = float(x)
        if u == "JPY":
            ans += x
        else:
            ans += x * 380000

    print(f"{ans:6f}")


if __name__ == '__main__':
    main()