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

Fixed submission:
X = int(input())

num_list = [0]*(100001 + 105)
num_list[0] = 1

for i in range(100001 + 105):
    if i == X:
        print(num_list[X])
        exit()

    for j in [100, 101, 102, 103, 104, 105]:
        if num_list[i]:
            num_list[i+j] = 1

print(0)

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

num_list = [0]*100001
num_list[0] = 1

for i in range(100001 + 1 + 105):
    if i == X:
        print(num_list[X])
        exit()

    for j in [100, 101, 102, 103, 104, 105]:
        if num_list[i]:
            num_list[i+j] = 1

print(0)

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

num_list = [0]*100000
num_list[0] = 1

for i in range(100001 + 105):
    if i == X:
        print(num_list[X])
        exit()

    for j in [100, 101, 102, 103, 104, 105]:
        if num_list[i]:
            num_list[i+j] = 1

print(0)

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

num_list = [0]*100000
num_list[0] = 1

for i in range(100001 + 105):
    if i == X:
        print(num_list[X])
        exit()

    for j in [100, 101, 102, 103, 104, 105]:
        if num_list[i]:
            num_list[i+j] = 1
Problem p02924 (python)

Fixed submission:
n = int(input())
print(n * (n-1)//2)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 1:
    print(0)
else:
    print(sum(list(range(1, n))))
Problem p03035 (python)

Fixed submission:
a, b= map(int,open(0).read().split())

if (a >=13):
    print (b)
elif(a<=12 and a>=6):
    print(b // 2)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
a, b= map(int,open(0).read().split())

if (a >=13):
    print (b)
else if(a<=12 and a>=6):
    print(b //2)
else:
    print(0)
Problem p03076 (python)

Fixed submission:
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i % 10 != 0 ],default=0)
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
if(df == 0):
        print(sum)
else:
        print(sum-df)

Buggy submission (verdict: Runtime Error):
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i % 10 != 0 ])
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
if(len(df) == 0):
        print(sum)
else:
        print(sum-df)

Buggy submission (verdict: Runtime Error):
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i % 10 != 0 ])
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
if(df == 0):
        print(sum)
else:
        print(sum-df)

Buggy submission (verdict: Runtime Error):
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i%10!=0 ])
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
print(sum-df)

Buggy submission (verdict: Runtime Error):
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i%10!=0 ])
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
print(sum+df-10)

Buggy submission (verdict: Runtime Error):
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i%10!=0 ])
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
print(sum-10+df)

Buggy submission (verdict: Runtime Error):
import math
menu = []
for i in range(0, 5):
        menu.append(int(input()))
df = max([10 - i % 10 for i in menu if i%10!=0 ])
print(df)
sum = 0
for i in menu:
        sum += ((i + 9) // 10) * 10
print(sum-10+df)
Problem p03105 (python)

Fixed submission:
a, b, c = (int(i) for i in input().split())

if ((a * c) < b):
    print(c)
else:
    print(b//a)

Buggy submission (verdict: Runtime Error):
a, b, c = (int(i) for i in input().split())

if (a * c) ＜ b:
    print(c)
else:
    print(b//a)

Buggy submission (verdict: Runtime Error):
a, b, c = (int(i) for i in input().split())

if a * c ＜ b:
    print(c)
else:
    print(b//a)
Problem p02850 (python)

Fixed submission:
import sys
sys.setrecursionlimit(10**9)

n=int(input())
# n=100000
tree=[set() for i in range(n)]
edges=[tuple(map(int,input().split())) for i in range(n-1)]
edge_color={}
for a,b in edges:
    a-=1
    b-=1
    tree[a].add(b)
    tree[b].add(a)
k = 0
for i in range(n):
    k = max(k,len(tree[i]))

for a,b in edges:
    edge_color[(a-1,b-1)] = 0

def colorize(u,v,c,init=False):
    if not init:
        edge_color[(min(u,v),max(u,v))] = c
    cc = c+1
    if cc > k:
        cc = 1
    for x in tree[u]:
        if edge_color[(min(x,u),max(x,u))] == 0:
            colorize(x,u,cc)
            cc += 1
            if cc > k:
                cc = 1

colorize(0,1,1,True)
print(k)
for a,b in edges:
    print(edge_color[(a-1,b-1)])

Buggy submission (verdict: Runtime Error):
import sys
sys.setrecursionlimit(10**9)

n=int(input())
# n=100000
tree=[set() for i in range(n)]
edges=[tuple(map(int,input().split())) for i in range(n-1)]
edge_color={}
for a,b in edges:
    a-=1
    b-=1
    tree[a].add(b)
    tree[b].add(a)
k = 0
for i in range(n):
    k = max(k,len(tree[i]))

for e in edges:
    edge_color[e] = 0

def colorize(u,v,c):
    edge_color[(min(u,v),max(u,v))] = c
    cc = c+1
    if cc > k:
        cc = 1
    for x in tree[u]:
        if edge_color[(min(x,u),max(x,u))] == 0:
            colorize(x,u,cc)
            cc += 1
            if cc > k:
                cc = 1

colorize(0,1,1)
print(k)
for e in edges:
    print(edge_color[e])
Problem p02898 (python)

Fixed submission:
n,k=map(int,input().split())
h=list(map(int,input().split()))
c=0
for x in h:
  c += x>=k
print(c)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
h=list(map(int,input().split()))
c=0
for x in h:
  c += x>=h
print(c)
Problem p02971 (python)

Fixed submission:
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
b=a.copy()
ma=max(a)
a.remove(ma)
ma2 = max(a)
for i in range(n):
    if b[i]==ma:
        print(ma2)
    else:
        print(ma)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[]
for i in range(n):
    a.append(int(input()))
b=a.copy()
ma=max(a)
a.remove(ma)
ma2 = max(a)
for i in range(n):
    if b[i]==ma:
        print(ma2)
    else:
        print(ma)
Problem p02981 (python)

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

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

Fixed submission:
l,r=map(int,input().split())
if r>l+4040:
    r=l+4040
dif=r-l
minimum=1000000000
for i in range(l%2019,l%2019 + dif+1):
    for j in range(i+1,l%2019 +dif +1):
        minimum=min(minimum,((i*j)%2019))
print(minimum)

Buggy submission (verdict: Runtime Error):
l,r=map(int,input().split())
minimum=1000000000
for i in range(l, r+1):
    for j in range(i+1,r+1):
        minimum=min(minimum,((i*j)%2019))
        if minimum==0:
            break
    if miminum ==0:
        break
print(minimum)
Problem p03014 (python)

Fixed submission:
h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko_map=[[0 for i in range(w)] for j in range(h)]
tate_map=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    p=0
    s_=s[i]
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            yoko_map[i][p]=num
            p+=1
        p+=1
for i in range(w):
    p=0
    s_=''.join([s__[i] for s__ in s])
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            tate_map[p][i]=num
            p+=1
        p+=1
m=0
for i in range(h):
    yoko_=yoko_map[i]
    tate_=tate_map[i]
    for j in range(w):
        m=max(m,tate_[j]+yoko_[j])
print(max(0,m-1))

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
s=[input() for _ in range(h)]
yoko_map=[[0 for i in range(w)] for j in range(h)]
tate_map=[[0 for i in range(w)] for j in range(h)]
for i in range(h):
    p=0
    s_=s[i]
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            yoko_map[i][p]=num
            p+=1
        p+=1
for i in range(h):
    p=0
    s_=''.join([s__[i] for s__ in s])
    s_=s_.split('#')
    for x in s_:
        num=len(x)
        for j in range(num):
            tate_map[p][i]=num
            p+=1
        p+=1
m=0
for i in range(h):
    yoko_=yoko_map[i]
    tate_=tate_map[i]
    for j in range(w):
        m=max(m,tate_[j]+yoko_[j])
print(m-1)
Problem p03032 (python)

Fixed submission:
n,k=map(int,input().split())
v=list(map(int,input().split()))
ma=0
for i in range(k//2+1):
     pick=min(k-i,n)
     for j in range(pick+1):
          if j==0:
               l=v[:pick]
               al=l
          elif j==pick:
               r=v[-pick:]
               al=r
          else:
               l=v[:pick-j]
               r=v[-j:]
               al=l+r
          for rem in range(i):
               if len(al)>0:
                    mi=min(al)
                    if mi<0:
                         al.remove(mi)
                    else:
                         break
               else:
                    break
          if len(al)>0:
               ma=max(ma,sum(al))
print(ma)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
v=list(map(int,input().split()))
ma=0
for i in range(k//2+1):
     pick=min(k-i,n)
     for j in range(pick+1):
          if j==0:
               l=v[:pick]
               al=l
          elif j==pick:
               r=v[-pick:]
               al=r
          else:
               l=v[:pick-j]
               r=v[-j:]
               al=l+r
          for rem in range(i):
               al.remove(min(al))
          ma=max(ma,sum(al))
print(ma)

Buggy submission (verdict: Runtime Error):
n,k=map(int,input().split())
v=list(map(int,input().split()))
a=[[v[:k],[]]]
for i in range(1,min(n,k)):
     l=v[:k-i]
     r=v[-i:][::-1]
     a.append([l,r])
a.append([[],v[-min(n,k):][::-1]])
ma=0
for a_ in a:
     l=a_[0]
     r=a_[1]
     su=sum(l)+sum(r)
     for i in range(k//2):
          if len(r)==0:
               l_=l.pop()
               su-=l_
               mi=min(l)
               l.remove(mi)
               su-=mi
               ma=max(ma,su)
          elif len(l)==0:
               r_=r.pop()
               su-=r_
               mi=min(r)
               r.remove(mi)
               su-=mi
               ma=max(ma,su)
          else:
               l_=l.pop()
               r_=r.pop()
               try:
                    l_mi=min(l)
               except:
                    l_mi=10**7+1
               try:
                    r_mi=min(r)
               except:
                    r_mi=10**7+1
               if l_mi>r_mi:
                    if r_mi<0:
                         r.remove(r_mi)
                         su-=r_mi
               else:
                    if l_mi<0:
                         l.remove(l_mi)
                         su-=l_mi
               if l_>r_:
                    l.append(l_)
                    su-=r_
               else:
                    r.append(r_)
                    su-=l_
               ma=max(ma,su)
print(ma)
Problem p03050 (python)

Fixed submission:
import math
n=int(input())
sqn=math.sqrt(n)
ch=n-sqn
nums=[]
su=0
stage=2
if n==1:
    print(0)
else:
    while(su<n):
        n_ = math.ceil(n*(stage-1)/stage)
        if n_ == su:
            nums.append(1)
            nums.append(n-su-1)
            break
        nums.append(n_-su)
        su+=n_-su
        if su>=ch:
            nums.append(n-su)
            break
        stage += 1
    ans=[]
    next_div_num = 0
    k=len(nums)
    for i in range(k):
        next_div_num += nums[k-1-i]
        if nums[k-1-i] == 1:
            continue
        sho = n//next_div_num
        d = next_div_num
        if d==0 or sho>d:
            continue
        if sho == n%d:
            ans.append(d)
        elif sho>n%d:
            d-=1
            if d==0 or sho>d:
               continue
            if sho == n%d:
                ans.append(d)
    print(sum(ans))

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
sqn=math.sqrt(n)
ch=n-sqn
nums=[]
su=0
stage=2
while(su<n):
    n_ = math.ceil(n*(stage-1)/stage)
    if n_ == su:
        nums.append(1)
        nums.append(n-su-1)
        break
    nums.append(n_-su)
    su+=n_-su
    if su>=ch:
        nums.append(n-su)
        break
    stage += 1
ans=[]
next_div_num = 0
k=len(nums)
for i in range(k):
    next_div_num += nums[k-1-i]
    if nums[k-1-i] == 1:
        continue
    sho = n//next_div_num
    d = next_div_num-1
    if d==0 or sho>d:
        continue
    if sho == n%d:
        ans.append(d)
print(sum(ans))

Buggy submission (verdict: Runtime Error):
import math
n=int(input())
sqn=math.sqrt(n)
ch=n-sqn
nums=[]
su=0
stage=2
while(su<n):
    n_ = math.ceil(n*(stage-1)/stage)
    if n_ == su:
        nums.append(1)
        nums.append(n-su-1)
        break
    nums.append(n_-su)
    su+=n_-su
    if su>=ch:
        nums.append(n-su)
        break
    stage += 1
ans=[]
next_div_num = 0
k=len(nums)
for i in range(k):
    next_div_num += nums[k-1-i]
    if nums[k-1-i] == 1:
        continue
    sho = n//next_div_num
    d = next_div_num-1
    if d==0 or sho>d:
        continue
    if sho == n%d:
        ans.append(d)
print(sum(ans))
Problem p03062 (python)

Fixed submission:
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
b=[x for x in a if x>0]
c=[x for x in a if x<=0]
if len(b)==0:
    if len(c)%2==0:
        print(sum(c)*-1)
    else:
        print(sum(c[:-1])*-1+c[-1])
elif len(c)%2==0:
    s=sum(b)
    s-=sum(c)
    print(s)
else:
    c.append(b.pop(0))
    s=sum(b)
    s-=sum(c[:-2])
    if c[-1] > c[-2]*-1:
        s+=c[-1]
        s+=c[-2]
        print(s)
    else:
        s-=c[-1]
        s-=c[-2]
        print(s)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=[int(x) for x in input().split()]
a.sort()
b=[x for x in a if x>0]
c=[x for x in a if x<=0]
if len(c)%2==0:
    s=sum(b)
    s-=sum(c)
    print(s)
else:
    c.append(b.pop(0))
    s=sum(b)
    s-=sum(c[:-2])
    if c[-1] > c[-2]*-1:
        s+=c[-1]
        s+=c[-2]
        print(s)
    else:
        s-=c[-1]
        s-=c[-2]
        print(s)
Problem p03069 (python)

Fixed submission:
n=int(input())
s=input()
cnt =s.count('#')
l =[cnt]
for i in range(n):
    if s[n-i-1] == '#':
        cnt -= 1
        l.append(cnt)
    else:
        cnt+=1
        l.append(cnt)
print(min(l))

Buggy submission (verdict: Runtime Error):
import numpy as np
n=int(input())
s=[a for a in input()]
s=[a.replace('.','0') for a in s]
s=[a.replace('#','1') for a in s]
s=[int(a) for a in s]
p=[i for i, x in enumerate(s) if x == 1]
s = np.array(s)
cnt = np.sum(s)
for i in p:
    s[-1 * (n-i):] = 1 - s[-1 * (n-i):]
    _cnt = np.sum(s)
    if cnt > _cnt:
        cnt =_cnt
print(cnt)
Problem p03126 (python)

Fixed submission:
n,m=map(int,input().split())
a=[[int(x) for x in input().split()] for _ in range(n)]
d={i:0 for i in range(m)}
for i in range(n):
    k=a[i][0]
    for j in range(k):
        d[a[i][j+1]-1] += 1
cnt=0
for key in d:
    if d[key] == n:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=[[int(x) for x in input().split()] for _ in range(n)]
d={i:0 for i in range(m)}
for i in range(n):
    k=a[i][0]
    for j in range(k):
        d[a[i][j]] += 1
cnt=0
for key in d:
    if d[key] == n:
        cnt+=1
print(cnt)
Problem p03244 (python)

Fixed submission:
n=int(input())
v=list(map(int,input().split()))
v1 = [v[2*i] for i in range(n//2)]

if len(set(v))==1:
    print(n//2)
    exit()
d1 = {}
for x in v1:
    if x in d1.keys():
        d1[x] = d1[x] + 1
    else:
        d1[x] = 1
d1 = sorted(d1.items(), key=lambda x:-x[1])

d2 = {}
v2 = [v[2*i+1] for i in range(n//2)]
ma2=0
for x in v2:
    if x in d2.keys():
        d2[x] = d2[x] + 1
    else:
        d2[x] = 1
d2 = sorted(d2.items(), key=lambda x:-x[1])
if d1[0][0] != d2[0][0]:
    print(n-d1[0][1]-d2[0][1])
else:
    if len(d1) == 1:
        print(n-d1[0][1]-d2[1][1])
    elif len(d2) == 1:
        print(n-d1[1][1]-d2[0][1])
    else:
        print(n-max(d1[0][1]+d2[1][1],d1[1][1]+d2[0][1]))

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
v1 = [v[2*i] for i in range(n//2)]

if len(set(v))==1:
    print(n//2)
    exit()
d1 = {}
for x in v1:
    if x in d1.keys():
        d1[x] = d1[x] + 1
    else:
        d1[x] = 1
d1 = sorted(d1.items(), key=lambda x:-x[0])

d2 = {}
v2 = [v[2*i+1] for i in range(n//2)]
ma2=0
for x in v2:
    if x in d2.keys():
        d2[x] = d2[x] + 1
    else:
        d2[x] = 1
d2 = sorted(d2.items(), key=lambda x:-x[0])
if d1[0][0] != d2[0][0]:
    print(n-d1[0][1]-d2[0][1])
else:
    if len(d1) == 1:
        print(n-d1[0][1]-d2[1][1])
    elif len(d2) == 1:
        print(n-d1[1][1]-d2[0][1])
    else:
        raise UnicodeError
        # print(n-max(d1[0][1]+d2[1][1],d1[1][1]+d2[0][1]))

Buggy submission (verdict: Runtime Error):
n=int(input())
v=list(map(int,input().split()))
v1 = [v[2*i] for i in range(n//2)]

if len(set(v))==1:
    print(n//2)
    exit()
d1 = {}
for x in v1:
    if x in d1.keys():
        d1[x] = d1[x] + 1
    else:
        d1[x] = 1
d1 = sorted(d1.items(), key=lambda x:-x[0])

d2 = {}
v2 = [v[2*i+1] for i in range(n//2)]
ma2=0
for x in v2:
    if x in d2.keys():
        d2[x] = d2[x] + 1
    else:
        d2[x] = 1
d2 = sorted(d2.items(), key=lambda x:-x[0])
if d1[0][0] != d2[0][0]:
    print(n-d1[0][1]-d2[0][1])
else:
    if len(d1==1):
        print(n-d1[0][1]-d2[1][1])
    elif len(d2==1):
        print(n-d1[1][1]-d2[0][1])
    else:
        print(n-max(d1[0][1]+d2[1][1],d1[1][1]+d2[0][1]))
Problem p03302 (python)

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

if(a+b ==15):
    print("+")
elif(a*b == 15):
    print("*")
else:
    print("x")

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

"""
#kuso code
start = time.time()
a = [random.randrange(n) for i in range(m)]
a = np.array(a)
b = np.abs(a[1:]-a[:-1])
cnt = np.sum(b == d)
ave = cnt

i = 0
while(time.time() - start < 10):
    a = [random.randrange(n) for i in range(m)]
    a = np.array(a)
    b = np.abs(a[1:]-a[:-1])
    cnt = np.sum(b == d)
    ave = ((i+1)*ave + cnt)/(i+2)
    i += 1
print(ave)
"""

oks*n = 2*np.max(n-2*d,0) + 2*d)
ave = oks*(m-1)/n/n
print(ave)
Problem p03304 (python)

Fixed submission:
import numpy as np

n,m,d = map(int,input().split())

"""
#kuso code
start = time.time()
a = [random.randrange(n) for i in range(m)]
a = np.array(a)
b = np.abs(a[1:]-a[:-1])
cnt = np.sum(b == d)
ave = cnt

i = 0
while(time.time() - start < 10):
    a = [random.randrange(n) for i in range(m)]
    a = np.array(a)
    b = np.abs(a[1:]-a[:-1])
    cnt = np.sum(b == d)
    ave = ((i+1)*ave + cnt)/(i+2)
    i += 1
print(ave)
"""

oks_times_n = 2*np.max(n-2*d,0) + 2*d
ave = oks_times_n/n/n*(m-1)
if (d == 0):
    ave /= 2
print(ave)

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

n,m,d = map(int,input().split())

"""
#kuso code
start = time.time()
a = [random.randrange(n) for i in range(m)]
a = np.array(a)
b = np.abs(a[1:]-a[:-1])
cnt = np.sum(b == d)
ave = cnt

i = 0
while(time.time() - start < 10):
    a = [random.randrange(n) for i in range(m)]
    a = np.array(a)
    b = np.abs(a[1:]-a[:-1])
    cnt = np.sum(b == d)
    ave = ((i+1)*ave + cnt)/(i+2)
    i += 1
print(ave)
"""

oks_times_n = 2*np.max(n-2*d,0) + 2*d
ave = oks*(m-1)/n/n
print(ave)

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

n,m,d = map(int,input().split())

"""
#kuso code
start = time.time()
a = [random.randrange(n) for i in range(m)]
a = np.array(a)
b = np.abs(a[1:]-a[:-1])
cnt = np.sum(b == d)
ave = cnt

i = 0
while(time.time() - start < 10):
    a = [random.randrange(n) for i in range(m)]
    a = np.array(a)
    b = np.abs(a[1:]-a[:-1])
    cnt = np.sum(b == d)
    ave = ((i+1)*ave + cnt)/(i+2)
    i += 1
print(ave)
"""

oks_times_n = 2*np.max(n-2*d,0) + 2*d)
ave = oks*(m-1)/n/n
print(ave)

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

n,m,d = map(int,input().split())

"""
#kuso code
start = time.time()
a = [random.randrange(n) for i in range(m)]
a = np.array(a)
b = np.abs(a[1:]-a[:-1])
cnt = np.sum(b == d)
ave = cnt

i = 0
while(time.time() - start < 10):
    a = [random.randrange(n) for i in range(m)]
    a = np.array(a)
    b = np.abs(a[1:]-a[:-1])
    cnt = np.sum(b == d)
    ave = ((i+1)*ave + cnt)/(i+2)
    i += 1
print(ave)
"""

oks*n = 2*np.max(n-2*d,0) + 2*d)
ave = oks*(m-1)/n/n
print(ave)

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

"""
#kuso code
start = time.time()
a = [random.randrange(n) for i in range(m)]
a = np.array(a)
b = np.abs(a[1:]-a[:-1])
cnt = np.sum(b == d)
ave = cnt

i = 0
while(time.time() - start < 10):
    a = [random.randrange(n) for i in range(m)]
    a = np.array(a)
    b = np.abs(a[1:]-a[:-1])
    cnt = np.sum(b == d)
    ave = ((i+1)*ave + cnt)/(i+2)
    i += 1
print(ave)
"""

oks*n = 2*np.max(n-2*d,0) + 2*d)
ave = oks*(m-1)/n/n
print(ave)
Problem p03355 (python)

Fixed submission:
s=input()
k=int(input())
x=set()
for i in range(len(s)):
     for j in range(1,min(len(s)-i+1,k+1)):
          x.add(s[i:i+j])
x=list(x)
x.sort()
print(x[k-1])

Buggy submission (verdict: Runtime Error):
s=input()
k=int(input())
x=[]
for i in range(len(s)):
     for j in range(1,len(s)-i+1):
          x.append(s[i:i+j])
x=list(set(x))
x.sort()
print(x[k-1])
Problem p03437 (python)

Fixed submission:
import fractions
x,y=map(int,input().split())
a=x*y/fractions.gcd(x,y)
a-=x
if a>0 and a<10**19:
     print(int(a))
else:
     print(-1)

Buggy submission (verdict: Runtime Error):
import math
x,y=map(int,input().split())
a=x*y/math.gcd(x,y)
a-=x
if a>0 and a<10**19:
     print(int(a))
else:
     print(-1)
Problem p03559 (python)

Fixed submission:
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
cnt=0
x=[]
i=0
b__=b.copy()
rev=0
while(b__):
     b_=b__.pop()
     while(1):
          try:
               c_=c.pop()
          except:
               rev+=cnt
               x.append(rev)
               cnt=0
               break
          if c_>b_:
               cnt+=1
          else:
               rev+=cnt
               x.append(rev)
               cnt=0
               c.append(c_)
               break
cnt=0
i=n-1
rev=0
ans=0
while(a):
     a_=a.pop()
     while(1):
          try:
               b_=b.pop()
          except:
               rev+=cnt
               ans+=rev
               cnt=0
               break
          if b_>a_:
               cnt+=x.pop(0)
          else:
               rev+=cnt
               ans+=rev
               cnt=0
               b.append(b_)
               break
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
cnt=0
x=[]
i=0
b__=b.copy()
rev=0
while(b__):
     b_=b__.pop()
     while(1):
          try:
               c_=c.pop()
          except:
               rev+=cnt
               x.append(rev)
               cnt=0
               break
          if c_>b_:
               cnt+=1
          else:
               rev+=cnt
               x.append(rev)
               cnt=0
               c.append(c_)
               break
cnt=0
i=n-1
rev=0
while(a):
     a_=a.pop()
     for i in range(1,n+1):
          idx=n-i
          b_=b[idx]
          if b_>a_:
               cnt+=x[i-1]
          else:
               break
print(cnt)
Problem p03609 (python)

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

Buggy submission (verdict: Runtime Error):
x,y = map(int,input().split())
print(max(x-t,0))
Problem p03777 (python)

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

Buggy submission (verdict: Runtime Error):
a,b = inpur().split()
if a == b:
    print("H")
else:
    print("D")