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

Fixed submission:
A,B,K=map(int,input().split())
for i in range(K):
    if i%2==0:
        if A%2==1:
            A-=1
        B+=int(A/2)
        A=int(A/2)
    else:
        if B%2==1:
            B-=1
        A+=int(B/2)
        B=int(B/2)
print(A,B)

Buggy submission (verdict: Runtime Error):
A,B,K=map(int,input().split())
for i in range(K):
    if i%2==0:
        if A%2==1:
            A-=1
        B+=int(A/2)
        A=int(A/2)
    else:
        if B%2==1:
            B-=1
        A+=int(B/2)
        B=int(B/2)
print(A+" "+B)
Problem p03246 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
v0=[]
v1=[]
m=int(n/2)
for i in range(m):
    v0.append(v[i*2])
    v1.append(v[i*2+1])
v0.sort()
v1.sort()
mv0=[0,0]
mv1=[0,0]
jmv0=[0,0]
jmv1=[0,0]
c0=[0,0]
c1=[0,0]
for i in range(m):
    if c0[0]==v0[i]:
        c0[1]+=1
    else:
        if mv0[1]<=c0[1]:
            jmv0=mv0
            mv0=c0
        elif jmv0[1]<=c0[1]:
            jmv0=c0
        c0=[v0[i],1]

    if c1[0]==v1[i]:
        c1[1]+=1
    else:
        if mv1[1]<=c1[1]:
            jmv1=mv1
            mv1=c1
        elif jmv1[1]<=c1[1]:
            jmv1=c1
        c1=[v1[i],1]

if mv0[1]<=c0[1]:
            jmv0=mv0
            mv0=c0
elif jmv0[1]<=c0[1]:
            jmv0=c0

if mv1[1]<=c1[1]:
            jmv1=mv1
            mv1=c1
elif jmv1[1]<=c1[1]:
            jmv1=c1

if mv0[0]!=mv1[0]:
    print(n-mv0[1]-mv1[1])
else:
    print(min(n-mv0[1]-jmv1[1],n-jmv0[1]-mv1[1]))

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
v0=[]
v1=[]
m=int(n/2)
for i in range(m):
    v0.append(v[i*2])
    v1.append(v[i*2+1])
v0.sort()
v1.sort()
mv0=[0,0]
mv1=[0,0]
jmv0=[0,0]
jmv1=[0,0]
c0=[0,0]
c1=[0,0]
for i in range(m):
    if c0[0]==v0[i]:
        c0[1]+=1
    else:
        if mv0[1]<=c0[1]:
            jmv0=mv0
            mv0=c0
        elif jmv0<=c0[1]:
            jmv0=c0
        c0=[v0[i],1]

    if c1[0]==v1[i]:
        c1[1]+=1
    else:
        if mv1[1]<=c1[1]:
            jmv1=mv1
            mv1=c1
        elif jmv1<=c1[1]:
            jmv1=c1
        c1=[v1[i],1]

if mv0[1]<=c0[1]:
            jmv0=mv0
            mv0=c0
elif jmv0<=c0[1]:
            jmv0=c0

if mv1[1]<=c1[1]:
            jmv1=mv1
            mv1=c1
elif jmv1<=c1[1]:
            jmv1=c1

if mv0[0]!=mv1[0]:
    print(n-mv0[1]-mv1[1])
else:
    print(min(n-mv0[1]-jmv1[1],n-jmv0[1]-mv1[1]))
Problem p03378 (python)

Fixed submission:
n,m,x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
ans=0
for i in range(m):
  ans=ans+1 if a[i]<x else ans
print(min(ans,m-ans))

Buggy submission (verdict: Runtime Error):
n,m,x=[int(i) for i in input().split()]
a=[int(i) for i in input().split()]
ans=0
for i in range(m):
  ans+=1 if a[i]<x
print(min(ans,m-ans))
Problem p03386 (python)

Fixed submission:
a,b,k=[int(i)for i in input().split()]
if 2*k<b-a+1:
    for i in range(k):
        print(a+i)
    for i in range(k):
        print(b-k+i+1)
else:
    for i in range(b-a+1):
        print(a+i)

Buggy submission (verdict: Runtime Error):
a=int(input())
b=int(input())
k=int(input())
if 2*k<b-a+1:
    for i in range(k):
        print(a+i)
    for i in range(k):
        print(b-k+i+1)
else:
    for i in range(b-a+1):
        print(a+i)
Problem p03609 (python)

Fixed submission:
x,t=[int(i) for i in input().split()]
print(max(0,x-t))

Buggy submission (verdict: Runtime Error):
x,t=[int(i) for i in input().split()]
print(max(0,x-t)
Problem p03635 (python)

Fixed submission:
n,m=[int(i) for i in input().split()]
print((n-1)*(m-1))

Buggy submission (verdict: Runtime Error):
    s=input()
    print(s[0]+str(len(s-2))+s[-1])
Problem p03636 (python)

Fixed submission:
s=input()
print(s[0]+str(len(s)-2)+s[-1])

Buggy submission (verdict: Runtime Error):
s=input()
print(s[0]+str(len(s-2))+s[-1])

Buggy submission (verdict: Runtime Error):
s=input()
print(s[0]+int(len(s-2))+s[-1])

Buggy submission (verdict: Runtime Error):
s=input()
print(s[0]+int(len(s-2))+s[-1])
Problem p03695 (python)

Fixed submission:
n=int(input())
a=[int(i) for i in input().split()]
iro=[0 for i in range(8)]
tyi=0
for i in range(n):
  if a[i]<3200:
    iro[int(a[i]/400)]=1
  else:
    tyi+=1
print(max(iro.count(1),1),iro.count(1)+tyi)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(i) for i in input().split()]
iro=[0 for i in range(8)]
tyi=0
for i in range(n):
  if a<3200:
    iro[int(a/400)]=1
  else:
    tyi+=1
print(min(iro.count(1)+tyi,8))
Problem p03711 (python)

Fixed submission:
x,y=[int(i) for i in input().split()]
a=[[1,3,5,7,8,10,12],[4,6,9,11]]
ans="No"
for i in [0,1]:
  if a[i].count(x) and a[i].count(y):
    ans="Yes"
print(ans)

Buggy submission (verdict: Runtime Error):
x,y=[int(i) for in input().split()]
a=[[1,3,5,7,8,10,12],[4,6,9,11]]
ans="No"
for i in [0,1]:
  if a[i].count(x) and a[i].count(y):
    ans="Yes"
print(ans)
Problem p03719 (python)

Fixed submission:
a,b,c=[int(i) for i in input().split()]
print(["No","Yes"][a<=c and c<=b])

Buggy submission (verdict: Runtime Error):
a,b,c=[int(i) for i in input().split()]
print(["No" "Yes"][a<=c and c<=b])
Problem p03729 (python)

Fixed submission:
a,b,c=list(map(str,input().split()))

if a[-1]==b[0] and b[-1]==c[0]:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
N,W=list(map(int,input().split()))
v=[[],[],[],[]]
kosu=[0,0,0,0]
kr=list(map(int,input().split()))
v[0].append(kr[1])
w0=kr[0]
for i in range(1,N):
    kr=list(map(int,input().split()))
    v[kr[0]-w0].append(kr[1])
for i in range(4):
    v[i].sort()
    v[i].reverse()
kos=[len(v[0]),len(v[1]),len(v[2]),len(v[3])]
kk=[-1]*((kos[0]+1)*(kos[1]+1)*(kos[2]+1)*(kos[3]+1))
def toru(a,b,c,d,nw):
    global kk
    if kk[a+(kos[0]+1)*(b+((kos[1]+1)*(c+(kos[2]+1)*d)))]!=-1:
        return kk[a+(kos[0]+1)*(b+((kos[1]+1)*(c+(kos[2]+1)*d)))]
    max=0
    if a<kos[0] and W>=nw+w0 and max<toru(a+1,b,c,d,nw+w0)+v[0][a]:
        max=toru(a+1,b,c,d,nw+w0)+v[0][a]
    if b<kos[1] and W>=nw+w0+1 and max<toru(a,b+1,c,d,nw+w0+1)+v[1][b]:
        max=toru(a,b+1,c,d,nw+w0+1)+v[1][b]
    if c<kos[2] and W>=nw+w0+2 and max<toru(a,b,c+1,d,nw+w0+2)+v[2][c]:
        max=toru(a,b,c+1,d,nw+w0+2)+v[2][c]
    if d<kos[3] and W>=nw+w0+3 and max<toru(a,b,c,d+1,nw+w0+3)+v[3][d]:
        max=toru(a+1,b,c,d+1,nw+w0+3)+v[3][d]
    kk[a+(kos[0]+1)*(b+((kos[1]+1)*(c+(kos[2]+1)*d)))]=max
    return max


maxv=toru(0,0,0,0,0)

print(maxv)
Problem p03759 (python)

Fixed submission:
a,b,c=[int(i)for i in input().split()]
if a-b==b-c:
    print("YES")
else:
    print("NO")

Buggy submission (verdict: Runtime Error):
o=list(input())
e=list(input())
p=""
for i in range(len(e)):
    p+=o[i]
    p+=e[i]
if len(o)-i==2:
    p+=o[i+1]
print(p)
Problem p03818 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
a.sort()
kjn=0
b=0
mi=0
mi2=0
for i in range(0,n):
    if a[i]==kjn:
        b=3-b
    else:
        if b==2:
            mi2+=1
        b=1
        kjn=a[i]
        mi+=1
if b==2:
    mi2+=1
print(mi-mi2%2)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
sn=[0]*n
mi2=0
mi=0
for i in range(0,n):
    if sn[a[i]]==1:
        mi2=1-mi2
    else:
        sn[a[i]]=1
        mi+=1
print(mi-mi2)
Problem p03826 (python)

Fixed submission:
a,b,c,d=[int(i) for i in input().split()]
print(max(a*b,c*d))

Buggy submission (verdict: Runtime Error):
print(max(int(input())*int(input()) for i in [1,1]))
Problem p04011 (python)

Fixed submission:
n,k,x,y=[int(input()) for i in range(4)]
print(min(n,k)*x+max(0,n-k)*y)

Buggy submission (verdict: Runtime Error):
n,k,x,y=[int(i) for i in input().split()]
print(min(n,k)*x+max(0,n-k)*y)
Problem p02898 (python)

Fixed submission:
N,K = map(int,input().split())
height_list = list(map(int,input().split()))
print(sum([1 for i in height_list if i >= K]))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
height_list = list(map(int,input().split()))
print(sum(1 for i in height_list if i >= K]))

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
height_list = list(map(int,input().split()))
print(sum(1 for i in h if i >= K]))

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
counter = 0
for i in range(int(N)):
    temp = int(input())
    if temp >= int(K) :
       counter = counter + 1
print(counter)

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
counter = 0
for i in range(int(N)):
    if int(input()) >= int(K) :
       counter = counter + 1
print(counter)

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
counter = 0
for i in range(int(N))
    if int(input()) >= int(K) :
       counter++
print(counter)

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
counter = 0
for i in range(N)
    if input() >= K :
       counter++
print(counter)

Buggy submission (verdict: Runtime Error):
N = input()
K = input()
for i in N
    if input() >= K :
       counter++
print(counter)
Problem p02995 (python)

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

A, B, C, D = list(map(int, input().split()))
_all = B - A + 1
lcm = int(C * D / gcd(C, D))
x = (A-1) - ((A-1) // C) - ((A-1) // D) + ((A-1) // lcm)
y = B - (B // C) - (B // D) + (B // lcm)
print(y - x)

Buggy submission (verdict: Runtime Error):
import math
A, B, C, D = list(map(int, input().split()))
_all = B - A + 1
lcm = int(C * D / math.gcd(C, D))
x = (A-1) - ((A-1) // C) - ((A-1) // D) + ((A-1) // lcm)
y = B - (B // C) - (B // D) + (B // lcm)
print(y - x)
Problem p03613 (python)

Fixed submission:
if __name__ == '__main__':
    N = int(input())
    a = input()
    a = a.split(' ')
    a = list(map(int, a))

    min_a = min(a)
    max_a = max(a)

    num = []

    for i in range(max_a+1):
        num.append(0)

    for i in a:
        if i-2 >= 0:
            num[i-2] += 1
        if i-1 >= 0:
            num[i-1] += 1
        num[i] += 1

    c = max(num)
    print(c)

Buggy submission (verdict: Runtime Error):
if __name__ == '__main__':
    N = int(input())
    a = input()
    a = a.split(' ')
    a = list(map(int, a))

    min_a = min(a)
    max_a = max(a)

    num = []

    for i in range(max_a+1):
        num.append(0)

    for i in a:
        num[i-2] += 1
        num[i-1] += 1
        num[i] += 1

    c = max(num)
    print(c)
Problem p03964 (python)

Fixed submission:
import math
from decimal import Decimal
n = int(input())
i = 0
list = []
while i < n:
   list.append(input().split())
   i += 1
h = 0
th = 1
ah = 1
while h < n:
     listh = list[h]
     x = int(listh[0])
     y = int(listh[1])
     m = max(math.ceil(th/x),math.ceil(ah/y))
     th = Decimal(m*x)
     ah = Decimal(m*y)
     h += 1
print(th+ah)

Buggy submission (verdict: Runtime Error):
import math
n = int(input())
i = 0
list = []
while i < n:
   list.append(input().split())
   i += 1
h = 0
th = 1.0
ah = 1.0
while h < n:
     listh = list[h]
     x = int(listh[0])
     y = int(listh[1])
     m = max(math.ceil(th/x)),math.ceil(ah/y)))
     th = m*x
     ah = m*y
     h += 1
print(long(th+ah))
Problem p02780 (python)

Fixed submission:
from functools import reduce
n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
tmp_max = sum([i / 2 + 0.5 for i in p[0:k]])
tmp = tmp_max
idx = 0
for i in range(1, len(p) - k + 1):
	tmp -= p[i - 1] / 2 + 0.5
	if i + k - 1 < len(p):
		tmp += p[i + k - 1] / 2 + 0.5
	tmp_max = max(tmp_max, tmp)
print(tmp_max)

Buggy submission (verdict: Runtime Error):
from functools import reduce
n, k = [int(i) for i in input().split()]
p = [int(i) for i in input().split()]
max = sum(p[0:k])
tmp = max
idx = 0
for i in range(1, len(p) - k + 1):
	tmp -= p[i - 1]
	if i + k - 1 < len(p):
	    tmp += p[i + k - 1]
	if tmp > max:
		max = tmp
		idx = i
lst = p[idx:idx+k]

total_tasu = 0
total_kake = reduce(lambda a, b: a*b, lst)
for i, v in enumerate(lst):
	kake = total_kake / v
	total_tasu += sum([k for k in range(1, v + 1)]) * kake
print(total_tasu/total_kake)
Problem p03087 (python)

Fixed submission:
n, q = [int(i) for i in input().split()]
st = input() + '-'
table = []
cnt = 0
for i, v in enumerate(st):
	if st[i: i+2] == 'AC':
		cnt += 1
	table.append(cnt)
table = [0] + table

for j in range(q):
	l, r = list(map(int, input().split()))
	print (table[r-1] - table[l-1])

Buggy submission (verdict: Runtime Error):
n, q = [int(i) for i in input().split()]
s = input()
for j in range(n):
	l, r = [int(k) for k in input().split()]
	tmp = s[l-1: r]
	print (tmp.count('AC'))
Problem p03495 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""arc086_a"""

import sys
import pprint
import re

from collections import Counter

from functools import reduce

import itertools
pp = pprint.PrettyPrinter(indent=2)


def main():
    """Main function."""
    n, k = list(map(int, input().split(' ')))
    as_ = list(map(int, input().split(' ')))

    counter = Counter(as_)

    occ_list = sorted(counter.most_common(), key=lambda t: t[1], reverse=True)
    if len(occ_list) <= k:
        print(0)
    elif len(occ_list) == k + 1:
        print(occ_list[-1][1])
    else:
        print(reduce(lambda t1, t2: (0, t1[1] + t2[1]), occ_list[k:])[1])



if __name__ == '__main__':
    sys.exit(main())

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""arc086_a"""

import sys
import pprint
import re

from collections import Counter

from functools import reduce

import itertools
pp = pprint.PrettyPrinter(indent=2)


def main():
    """Main function."""
    n, k = list(map(int, input().split(' ')))
    as_ = list(map(int, input().split(' ')))

    counter = Counter(as_)

    occ_list = sorted(counter.most_common(), key=lambda t: t[1], reverse=True)
    if len(occ_list) <= k:
        print(0)
    elif len(occ_list) == k + 1:
        print(occ_list[-1][1])
    else:
        print(reduce(lambda t1, t2: t1[1] + t2[1], occ_list[k:]))



if __name__ == '__main__':
    sys.exit(main())
Problem p03569 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""code-fes-2017-qual-c-c"""


import sys

OP_NUM = 0

def solve(s):
    """Solve."""
    global OP_NUM

    if len(s) == 0:
        return ""
    if len(s) == 1:
        return ""

    if s[0] == 'x':
        if s[-1] == 'x':
            return s[1:-1]
        OP_NUM += 1
        return s[1:]

    if s[0] == s[-1]:
        return s[1:-1]
    if 'x' == s[-1]:
        OP_NUM += 1
        return s[:-1]

    return None


def main():
    """Main function."""
    s = input()

    while s:
        s = solve(s)
        if s is None:
            print(-1)
            sys.exit(0)

    print(OP_NUM)

if __name__ == '__main__':
    sys.exit(main())

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""code-fes-2017-qual-c-c"""


import sys

OP_NUM = 0

def solve(s):
    """Solve."""
    global OP_NUM

    if len(s) == 0:
        return ""
    if len(s) == 1:
        return ""

    if s[0] == 'x':
        if s[-1] == 'x':
            return solve(s[1:-1])
        OP_NUM += 1
        return solve(s[1:])

    if s[0] == s[-1]:
        return solve(s[1:-1])
    if 'x' == s[-1]:
        OP_NUM += 1
        return solve(s[:-1])

    return None


def main():
    """Main function."""
    s = input()

    forward = solve(s)
    if forward is None:
        print(-1)
    else:
        print(OP_NUM)


if __name__ == '__main__':
    sys.exit(main())
Problem p04045 (python)

Fixed submission:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""042-c"""

import sys


def solve(dislike_digits_table, first_like_digit, N):
    """Solve."""
    for i, _ in enumerate(N):
        c = N[i]
        while dislike_digits_table[int(c)]:
            if c == '9':
                if i == 0:
                    return solve(dislike_digits_table,
                                 first_like_digit,
                                 '1' + '0' * len(N))
                else:
                    return solve(dislike_digits_table,
                                 first_like_digit,
                                 str(int(N[0:i+1]) + 1)
                                    + '0' * len(N[i+1:]))
            else:
                c = chr(ord(c) + 1)
            N = N[0:i] + c + '0' * len(N[i+1:])

    return N


def main():
    """Main function."""
    dislike_digits_table = [False for _ in range(10)]

    N, _ = sys.stdin.readline().split(' ')
    digits = map(int, sys.stdin.readline().split(' '))

    for digit in digits:
        dislike_digits_table[digit] = True

    first_like_digit = str(next(i for i, v
                                in enumerate(dislike_digits_table)
                                if not v))

    print(solve(dislike_digits_table, first_like_digit, N))


if __name__ == '__main__':
    sys.exit(main())

Buggy submission (verdict: Runtime Error):
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""042-c"""

import sys

ZERO_UNICODE = 48


def solve(dislike_digits_table, first_like_digit, number):
    """Solve."""
    if dislike_digits_table[int(number[0])]:
        while dislike_digits_table[int(number[0])]:
            number = "{0}{1}".format(chr(ord(number[0]) + 1), number[1:])
        number = number.replace(number[1:], first_like_digit * (len(number) - 1))

    return number


def main():
    """Main function."""
    dislike_digits_table = [False for _ in range(10)]

    N, _ = sys.stdin.readline().split(' ')
    digits = map(int, sys.stdin.readline().split(' '))

    for digit in digits:
        dislike_digits_table[digit] = True

    first_like_digit = str(next(i for i, v
                            in enumerate(dislike_digits_table)
                            if not v))

    for i, d in enumerate(N):
        if dislike_digits_table[int(d)]:
            N = N.replace(N[i:], solve(dislike_digits_table, first_like_digit, N[i:]))
            break

    print(N)


if __name__ == '__main__':
    sys.exit(main())
Problem p02995 (python)

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


def main():
    A, B, C, D = map(int, input().split())

    num_C = B // C - (A - 1) // C
    num_D = B // D - (A - 1) // D
    lcm = C * D // fractions.gcd(C, D)
    num_CD = B // lcm - (A - 1) // lcm

    ans = (B - A + 1) - num_C - num_D + num_CD
    print(ans)


if __name__ == '__main__':
    main()

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


def main():
    A, B, C, D = map(int, input().split())

    num_C = B // C - (A - 1) // C
    num_D = B // D - (A - 1) // D
    lcm = C * D // math.gcd(C, D)
    num_CD = B // lcm - (A - 1) // lcm

    ans = (B - A + 1) - num_C - num_D + num_CD
    print(ans)


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

Fixed submission:
import fractions
# 最小公倍数
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)    
a, b, c, d = map(int, input().split())
e = lcm(c, d)
#print("e: {}".format(e))
#print("c: {} - {}".format(b // c, (a - 1) // c))
#print("d: {} - {}".format(b // d, (a - 1) // d))
#print("e: {} - {}".format(b // e, (a - 1) // e))
count_c = b // c - (a - 1) // c
count_d = b // d - (a - 1) // d
count_e = b // e - (a - 1) // e
# b - a の中から d の倍数の個数を取得
#print("count_c: {}".format(count_c))
#print("count_d: {}".format(count_d))
#print("count_e: {}".format(count_e))
print(b - a + 1 - (count_c + count_d - count_e))

Buggy submission (verdict: Runtime Error):
import math
# 最小公倍数
def lcm(x, y):
    return (x * y) // math.gcd(x, y)    
a, b, c, d = map(int, input().split())
e = lcm(c, d)
#print("e: {}".format(e))
#print("c: {} - {}".format(b // c, (a - 1) // c))
#print("d: {} - {}".format(b // d, (a - 1) // d))
#print("e: {} - {}".format(b // e, (a - 1) // e))
count_c = b // c - (a - 1) // c
count_d = b // d - (a - 1) // d
count_e = b // e - (a - 1) // e
# b - a の中から d の倍数の個数を取得
#print("count_c: {}".format(count_c))
#print("count_d: {}".format(count_d))
#print("count_e: {}".format(count_e))
print(b - a + 1 - (count_c + count_d - count_e))
Problem p03037 (python)

Fixed submission:
N, M = map(int, input().split())
maxL = 0
minM = N
for x in range(M):
    l, m = map(int, input().split())
    maxL = max(maxL, l)
    minM = min(minM, m)

print(max(minM - maxL + 1, 0))

Buggy submission (verdict: Runtime Error):
10 3
3 6
5 7
6 9
Problem p03043 (python)

Fixed submission:
import math

n, k = map(int, input().split())
limit = 1 / n
ans = 0
for x in range(1 , n + 1):
    num = math.pow(2, -1 * math.ceil(math.log(k / x, 2)))
    num = num / n
    if num > limit:
        num = limit
    ans = ans + num
    if ans >= 1:
        break
print("{:.12f}".format(ans))

Buggy submission (verdict: Runtime Error):
import math

n, k = map(int, input().split())
limit = 1 / n
ans = 0
for x in range(1 , n + 1):
    num = math.pow(2, -1 * math.ceil(math.log(k / x, 2)))
    num = num / n
    if num > limit:
        num = limit
    ans = ans + num
    if ans >= 1:
        break
print("{:.12
f}".format(ans))
Problem p02802 (python)

Fixed submission:
from collections import Counter
def counter(li, n):
    count = Counter()
    count.update(li)
    return count[n]
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
li_AC = [0]*N
count_WA = [0]*N
count_WA_total = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if li_AC[p-1] == 0:
        if S == "AC":
            li_AC[p-1] = 1
            count_WA_total += count_WA[p-1]
        if S == "WA":
            count_WA[p-1] += 1
print(counter(li_AC, 1), count_WA_total)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
li_AC = [0]*N
count_WA = [0]*N
count_WA_total = 0
for i in range(M):
    p, S = input().split()
    p = int(p)
    if li_AC[p-1] == 0:
        if S == "AC":
            li_AC[p-1] = 1
            count_WA_total += count_WA[p-1]
        if S == "WA":
            count_WA[p-1] += 1
print(counter(li_AC, 1), count_WA_total)
Problem p02934 (python)

Fixed submission:
N = int(input())
A = list(map(int,input().split()))
sum = 0
for i in A:
    sum += 1/i
print(1/sum)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split()))
for i in A:
    sum += 1/i
print(1/sum)
Problem p02946 (python)

Fixed submission:
K, X = map(int,input().split())
if K == 1:
    print(X)
else:
    for i in range(X-K+1, X+K-1):
        print(i," ",  end = "")
    print(i+1)

Buggy submission (verdict: Runtime Error):
K, X = map(int,input().split())
for i in range(X-K+1, X+K-1):
    print(i," ",  end = "")
print(i+1)
Problem p02995 (python)

Fixed submission:
import sys
input = sys.stdin.readline
from fractions import gcd
def lcm(a, b):
    return a*b // gcd(a, b)
def group(s, t, u):
    su = (s - 1) // u
    tu = t // u
    return  tu - su

A, B, C, D = map(int, input().split())
ABC = group(A, B, C)
ABD = group(A, B, D)
ABCD = group(A, B, lcm(C,D))
U = B - A + 1
print(U-(ABC+ABD-ABCD))

Buggy submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())
CD = math.ceil(C * D / math.gcd(C, D))
AC = math.ceil(A / C)
BC = math.ceil(B / C)
C = BC - AC + 1
AD = math.ceil(A / D)
BD = math.ceil(B / D)
D = BD - AD + 1
ACD = math.ceil(A / CD)
BCD = math.ceil(B / CD)
CD = BCD - ACD + 1
print((B-A+1) - (C + D - CD))

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


A, B, C, D = map(int, input().split())
CD = C * D // gcd(C, D)
AC = math.ceil(A / C)
BC = math.ceil(B / C)
C = math.ceilBC - AC + 1
AD = math.ceil(A / D)
BD = math.ceil(B / D)
D = BD - AD + 1
ACD = math.ceil(A / CD)
BCD = math.ceil(B / CD)
CD = BCD - ACD + 1
print((B-A+1) - (C + D - CD))