Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    
    n,k = map(int, input().split())
    
    p_list = list(map(int, input().split()))

    #p_list.sort(reverse=True)
    #print(p_list)

    ans = 0
    if k == 1:
        p_list.sort(reverse=True)
        ans = (p_list[0]+1)*0.5
    else:
        for j in range(n-(k-1)):
            ans_tmp = 0
            for i in range(k):
                ans_tmp += (p_list[i+j]+1)*0.5
            if ans_tmp >= ans:
                ans = ans_tmp

    print(ans)

    

if __name__ == '__main__':
    main()



Fixed submission:
def main():
    
    n,k = map(int, input().split())
    
    p_list = list(map(int, input().split()))
 
    #p_list.sort(reverse=True)
    #print(p_list)
 
    ans = 0
    if k == 1:
        p_list.sort(reverse=True)
        ans = (p_list[0]+1)*0.5
    else:
        for j in range(n-(k-1)):
            if j == 0:
                ans_tmp = 0
                for i in range(k):
                    ans_tmp += (p_list[i+j]+1)*0.5
            else:
                ans_tmp -= (p_list[(j-1)]+1)*0.5
                ans_tmp += (p_list[k+(j-1)]+1)*0.5
            
            
            if ans_tmp >= ans:
                ans = ans_tmp
 
    print(ans)
 
    
 
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):

def main():
    
    h,a = map(int, input().split())

    if h%a== 0:
        print(h//a)
    else:
        prinbt(h%a+1)


if __name__ == '__main__':
    main()



Fixed submission:

def main():
    
    h,a = map(int, input().split())

    if h <= a:
        print(1)

    elif h%a== 0:
        print(h//a)
    else:
        print(h//a+1)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):

def main():
    
    n = int(input())
    p_list = list(map(int, input().split()))
    
    ans = 0
    for i in range(n):
        #print(p_list[:(i+1)])
        if min(p_list[:(i+1)]) >= p_list[i]:
            ans += 1
    
    print(ans)


if __name__ == '__main__':
    main()



Fixed submission:

def main():
    
    n = int(input())
    p_list = list(map(int, input().split()))
    
    ans = 1
    tmp = p_list[0]
    for i in range(n-1):
        if tmp >= p_list[i+1]:
            ans += 1
            tmp = p_list[i+1]
    
    print(ans)


if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import math

def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def main():
    
    a,b = map(int, input().split())
    
    print(lcm(a, b))

if __name__ == '__main__':
    main()



Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def main():
    
    a,b = map(int, input().split())
    
    ans = lcm(a,b)
    print(ans)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Runtime Error):
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)

def main():
    
    a,b = map(int, input().split())
    
    print(lcm(a, b))

if __name__ == '__main__':
    main()



Fixed submission:
import fractions

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def main():
    
    a,b = map(int, input().split())
    
    ans = lcm(a,b)
    print(ans)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy

n, m = map(int, input().split())
a_list = list(map(int, input().split()))

tmp_list = copy.copy(a_list)

ticket_list = np.zeros(n)

for i in range(m):
    max_value = max(tmp_list)
    max_index = tmp_list.index(max_value)
    ticket_list[max_index] += 1
    tmp_list[max_index] = a_list[max_index]//(2**(ticket_list[max_index]))

print(str(int(sum(tmp_list))))

#ans = 0
#for j in range(n):
#    ans += a_list[j] // (2**(ticket_list[j]))

#print(str(int(ans)))

Fixed submission:
#import numpy as np
import copy
import heapq

n, m = map(int, input().split())
a_list = list(map(int, input().split()))

tmp_list = list(map(lambda x: x*(-1), a_list))
#print(tmp_list)
heapq.heapify(tmp_list)

#ticket_list = np.zeros(n)

for i in range(m):
    max_value = heapq.heappop(tmp_list)*(-1)
    heapq.heappush(tmp_list, (-1)*(max_value//2))

print(-sum(tmp_list))

#ans = 0
#for j in range(n):
#    ans += a_list[j] // (2**(ticket_list[j]))

#print(str(int(ans)))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy

n, m = map(int, input().split())
a_list = list(map(int, input().split()))

tmp_list = copy.copy(a_list)

ticket_list = np.zeros(n)

for i in range(m):
    max_value = max(tmp_list)
    max_index = tmp_list.index(max_value)
    ticket_list[max_index] += 1
    tmp_list[max_index] = a_list[max_index]//(2**(ticket_list[max_index]))

#print(ticket_list)

ans = 0
for j in range(n):
    ans += a_list[j] // (2**(ticket_list[j]))

print(str(int(ans)))

Fixed submission:
#import numpy as np
import copy
import heapq

n, m = map(int, input().split())
a_list = list(map(int, input().split()))

tmp_list = list(map(lambda x: x*(-1), a_list))
#print(tmp_list)
heapq.heapify(tmp_list)

#ticket_list = np.zeros(n)

for i in range(m):
    max_value = heapq.heappop(tmp_list)*(-1)
    heapq.heappush(tmp_list, (-1)*(max_value//2))

print(-sum(tmp_list))

#ans = 0
#for j in range(n):
#    ans += a_list[j] // (2**(ticket_list[j]))

#print(str(int(ans)))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy
def main():
    n = int(input())
    
    ans_list = []
    for i in range(n):
        a = int(input())
        ans_list.append(a)

    for j in range(n):
        tmp_list = copy.deepcopy(ans_list)
        tmp_list[j] = 0
    
        print(np.max(tmp_list))



    
    
if __name__ == '__main__':
    main()



Fixed submission:
import numpy as np
import copy
def main():
    n = int(input())
    
    max_num = 0
    max_second = 0
    for i in range(n):
        a = int(input())
        if a > max_num:
            max_num = a
            max_index = i
        elif a > max_second:
            max_second = a

    for j in range(n):
        if j == max_index:
            print(max_second)
        else:
            print(max_num)



    
    
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
import numpy as np
import copy

def main():
    l, r = map(int, input().split())
    
    ans_tmp = 2019
    if r-l >= 2019:
        ans_tmp = 0
    else:
        for j in range(r-l):
            for k in range(r-l-1):
                ans = ((l+j)*(l+(k+1)))% 2019
                if ans == 0:
                    ans_tmp = 0
                    break
                elif ans < ans_tmp:
                    ans_tmp = ans
                
        
    print(ans_tmp)

if __name__ == '__main__':
    main()



Fixed submission:
import numpy as np
import copy

def main():
    l, r = map(int, input().split())
    
    ans_tmp = 2019
    if r-l >= 2019:
        ans_tmp = 0
    else:
        for j in range(r-l):
            for k in range(j,r-l):
                ans = ((l+j)*(l+(k+1)))% 2019
                if ans == 0:
                    ans_tmp = 0
                    break
                elif ans < ans_tmp:
                    ans_tmp = ans
                
        
    print(ans_tmp)

if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
import copy

def main():
    l, r = map(int, input().split())
    
    ans_tmp = 2019
    for j in range(r-l):
        for k in range(r-l):
            ans = ((l+j)*(l+(k+1)))% 2019
            if ans < ans_tmp:
                ans_tmp = ans
                if ans == 0:
                    break
        
    print(ans_tmp)

if __name__ == '__main__':
    main()



Fixed submission:
import numpy as np
import copy

def main():
    l, r = map(int, input().split())
    
    ans_tmp = 2019
    if r-l >= 2019:
        ans_tmp = 0
    else:
        for j in range(r-l):
            for k in range(j,r-l):
                ans = ((l+j)*(l+(k+1)))% 2019
                if ans == 0:
                    ans_tmp = 0
                    break
                elif ans < ans_tmp:
                    ans_tmp = ans
                
        
    print(ans_tmp)

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
n, x = map(int, input().split())

l_list = list(map(int, input().split()))

tmp = 0
for i in range(100):
    tmp += l_list[i]
    if tmp > x:
        break

if tmp =< x:
    print(101)
else:
    print(i+1)


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

l_list = list(map(int, input().split()))

tmp = 0
for i in range(n):
    tmp += l_list[i]
    if tmp > x:
        break

if tmp <= x:
    print(101)
else:
    print(i+1)

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

l_list = list(map(int, input().split()))

tmp = 0
for i in range(100000):
    tmp += l_list[i]
    if tmp > x:
        break

print(i+1)


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

l_list = list(map(int, input().split()))

tmp = 0
for i in range(n):
    tmp += l_list[i]
    if tmp > x:
        break

if tmp <= x:
    print(101)
else:
    print(i+1)
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n, m = map(int, input().split())


card_list = np.zeros(n)

for i in range(m):
    l, r = map(int, input().split())
    card_list[l-1:r] += 1

print(np.count_nonzero(card_list == m))




Fixed submission:
import numpy as np
n, m = map(int, input().split())


#card_list = np.zeros(n)

under = 1
top = n

for i in range(m):
    l, r = map(int, input().split())
    if under < l:
        under = l
    if top > r:
        top = r

#print(under, top)
if top-under+1 < 0:
    print(0)
else:
    print(top-under+1)
Buggy python submission (verdict: Runtime Error):

s = str(input())

mm_f = 0
mm_e = 0

if 0 < int(s[0:2]) <= 12:
    mm_f = 1
if 0 < int(s[2:]) <= 12:
    mm_e = 1

if mm_f == 1 and mm_e == 1:
    print('AMBIGUOUS')
elif mm_f == 1 and mm == 0:
    print('MMYY')
elif mm_f == 0 and mm_e == 1:
    print('YYMM')
else:
    print('NA')

Fixed submission:

s = str(input())

mm_f = 0
mm_e = 0

if 0 < int(s[0:2]) <= 12:
    mm_f = 1
if 0 < int(s[2:]) <= 12:
    mm_e = 1

if mm_f == 1 and mm_e == 1:
    print('AMBIGUOUS')
elif mm_f == 1 and mm_e == 0:
    print('MMYY')
elif mm_f == 0 and mm_e == 1:
    print('YYMM')
else:
    print('NA')
Buggy python submission (verdict: Time Limit Exceeded):
import fractions
from functools import reduce
import copy

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

n = int(input())
a_list = list(map(int, input().split()))

ans_list = []
for i in range(n):
    tmp_list = copy.copy(a_list)
    if i == 0:
        tmp = gcd(*tmp_list[1:])
    
    elif i == n-1:
        tmp = gcd(*tmp_list[:-1])
    
    else:
        tmp_l = gcd(*tmp_list[0:i])
        tmp_r = gcd(*tmp_list[i+1:])
        tmp = gcd(tmp_l, tmp_r)
    
    ans_list.append(tmp)

print(max(ans_list))


Fixed submission:
from fractions import gcd
import copy

n = int(input())
a_list = list(map(int, input().split()))

ans_list = []
l_list = [0]*(n+1)
r_list = [0]*(n+1)

for i in range(n):
    l_list[i+1] = gcd(l_list[i], a_list[i])
    r_list[n-i-1] = gcd(r_list[n-i], a_list[n-i-1])

ans_list = []
for j in range(n):
    ans_list.append(gcd(l_list[j], r_list[j+1]))

#print(ans_list)

print(max(ans_list))

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

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

n = int(input())
a_list = list(map(int, input().split()))

ans = 0
for i in range(n-1):
    tmp_list = copy.copy(a_list)
    tmp_list.pop(i)
    #print(tmp_list)
    tmp = gcd(*tmp_list)
    #print(tmp)
    if tmp > ans:
        ans = tmp
    
print(ans)


Fixed submission:
from fractions import gcd
import copy

n = int(input())
a_list = list(map(int, input().split()))

ans_list = []
l_list = [0]*(n+1)
r_list = [0]*(n+1)

for i in range(n):
    l_list[i+1] = gcd(l_list[i], a_list[i])
    r_list[n-i-1] = gcd(r_list[n-i], a_list[n-i-1])

ans_list = []
for j in range(n):
    ans_list.append(gcd(l_list[j], r_list[j+1]))

#print(ans_list)

print(max(ans_list))

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

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors

def primes(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

if N == 2:
    print(max(A))

else:
    pn = primes(max(A))
    ans_num = 0
    ans = 1
    for i in pn:
        count = 0
        for j in range(N):
            if A[j] % i != 0:
                count += 1
        
        if count < N-1:
            ans *= i


    print(str(ans))

Fixed submission:
from fractions import gcd
import copy

n = int(input())
a_list = list(map(int, input().split()))

ans_list = []
l_list = [0]*(n+1)
r_list = [0]*(n+1)

for i in range(n):
    l_list[i+1] = gcd(l_list[i], a_list[i])
    r_list[n-i-1] = gcd(r_list[n-i], a_list[n-i-1])

ans_list = []
for j in range(n):
    ans_list.append(gcd(l_list[j], r_list[j+1]))

#print(ans_list)

print(max(ans_list))
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = input().split()
N = int(n[0])
M = int(n[1])


num_list = []
pr_list = []

for i in range(N):
    a = input().split()
    
    num_list.append(int(a[1]))
    pr_list.append(int(a[0]))

x = np.argsort(np.array(pr_list))

tmp = 0
for i in range(100000):
    key = np.array(num_list)[x[i]]
    if M - key > 0:
        tmp += int(pr_list[x[i]])*key
        M -= key
    elif M - key < 0:
        tmp += int(pr_list[x[i]])*M
        break
    else:
        if i == 0:
            tmp = int(pr_list[x[i]])*M
            break
        else:
            break

print(str(tmp))



Fixed submission:
import numpy as np
n = input().split()
N = int(n[0])
M = int(n[1])

num_list = []
pr_list = []
for i in range(N):
    a = input().split()
    num_list.append(int(a[1]))
    pr_list.append(int(a[0]))

x = np.argsort(np.array(pr_list))

tmp = 0
for i in range(100000):
    key = int(num_list[x[i]])
    if M - key > 0:
        tmp += int(pr_list[x[i]])*key
        M -= key
    else:
        if i == 0:
            tmp = int(pr_list[x[i]])*M
            break
        tmp += int(pr_list[x[i]])*M
        break

print(str(tmp))

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
n = input().split()
N = int(n[0])
M = int(n[1])


num_list = []
pr_list = []

for i in range(N):
    a = input().split()
    
    num_list.append(int(a[1]))
    pr_list.append(int(a[0]))

x = np.argsort(np.array(pr_list))

tmp = 0
for i in range(1000):
    if M - np.array(num_list)[x[i]] > 0:
        tmp += int(pr_list[x[i]])*np.array(num_list)[x[i]]
        M -= np.array(num_list)[x[i]]
    elif M - np.array(num_list)[x[i]] < 0:
        tmp += int(pr_list[x[i]])*M
        break
    else:
        if i == 0:
            tmp = int(pr_list[x[i]])*M
            break
        else:
            break

print(str(tmp))



Fixed submission:
import numpy as np
n = input().split()
N = int(n[0])
M = int(n[1])

num_list = []
pr_list = []
for i in range(N):
    a = input().split()
    num_list.append(int(a[1]))
    pr_list.append(int(a[0]))

x = np.argsort(np.array(pr_list))

tmp = 0
for i in range(100000):
    key = int(num_list[x[i]])
    if M - key > 0:
        tmp += int(pr_list[x[i]])*key
        M -= key
    else:
        if i == 0:
            tmp = int(pr_list[x[i]])*M
            break
        tmp += int(pr_list[x[i]])*M
        break

print(str(tmp))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)

a = 0
while a == 0:
    S = S.replace("0110", "")
    S = S.replace("1001", "")
    S = S.replace("01", "")
    S = S.replace("10", "")
    if "01" in S or "10" in S:
        a = 0
    else:
        a = 1

print(str(N - len(S)))

Fixed submission:
S = input()
N = len(S)
c0 = S.count("0")
c1 = S.count("1")
 
print(2*min(c0, c1))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)

a = 0
while a == 0:
    S = S.replace("01", "")
    S = S.replace("10", "")
    if "01" in S or "10" in S:
        a = 0
    else:
        a = 1

print(str(N - len(S)))

Fixed submission:
S = input()
N = len(S)
c0 = S.count("0")
c1 = S.count("1")
 
print(2*min(c0, c1))

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)

while a == 0:
    S.strip("01")
    S.strip("10")
    if "01" in S & "10" in S:
        a = 0
    else:
        a = 1

print(str(N - len(S))

Fixed submission:
S = input()
N = len(S)
c0 = S.count("0")
c1 = S.count("1")
 
print(2*min(c0, c1))

Buggy python submission (verdict: Time Limit Exceeded):
S = input()
N = len(S)

tmp = S
a = 0
b = 0
c = 0
count = 0
if len(tmp)-1 == b:
    a = 1

while a == 0:
    if tmp[b] != tmp[b+1]:
        count += 1
        #print('取り除くもの')
        #print(tmp[b:b+2])
        tmp = tmp[:b] + tmp[b+2:]
        #print('取り除いた後')
        #print(tmp)
        b = 0
        c += 1
        if len(tmp)-1 == b or len(tmp) == 0: 
            a = 1

    else:
        b += 1
        if len(tmp)-1 == b or len(tmp) == 0: 
            a = 1

print(str(count*2))

Fixed submission:
S = input()
N = len(S)
c0 = S.count("0")
c1 = S.count("1")
 
print(2*min(c0, c1))

Buggy python submission (verdict: Runtime Error):
S = input()
N = len(S)

tmp = S
a = 0
b = 0
c = 0
count = 0
if len(tmp)-1 == b:
    a = 1
while a == 0:
    if tmp[b] != tmp[b+1]:
        if len(tmp) == 2:
            tmp = ''
            break
        else:
            count += 1
            tmp = tmp[:b] + tmp[b+2:]
            b = 0
            c += 1
    else:
        b += 1
        if len(tmp)-1 == b:
            a = 1

print(str(count*2))


Fixed submission:
S = input()
N = len(S)
c0 = S.count("0")
c1 = S.count("1")
 
print(2*min(c0, c1))
Buggy python submission (verdict: Runtime Error):
n = input().split()
N = int(n[0])
A = int(n[1])
B = int(n[2])

if A > B or A == B:
    a = A
    b = B
elif B < A:
    a = B
    b = A

if a != b:
    if a+b < N:
        print(str(b) + ' ' + str(0))
    elif a+b > N:
        print(str(b) + ' ' + str(a - (N-b)))
elif a < N//2:
    print(str(a) + ' ' + str(0))
elif a > N//2:
    print(str(a) + ' ' + str(a-(N-b)))


Fixed submission:
n = input().split()
N = int(n[0])
A = int(n[1])
B = int(n[2])

if A > B:
    a = A
    b = B
elif A < B:
    a = B
    b = A
elif A == B:
    a = A
    b = B

if a != b:
    if a+b <= N:
        print(str(b) + ' ' + str(0))
    elif a+b > N:
        print(str(b) + ' ' + str(a - (N-b)))
elif a+b <= N:
    print(str(a) + ' ' + str(0))
elif a+b > N:
    print(str(a) + ' ' + str(a-(N-b)))
Buggy python submission (verdict: Time Limit Exceeded):
import math

n = input()
a = input().split()
N = int(n)

ans_list = []
ann = []
ana = 1
for j in range(N):
    ana = ana * int(a[j])
ana = ana -1
for i in range(N):

    ans = 0
    for k in range(i+1):
        ans += int(ana % int(a[k]))
    ans_list.append(ans)

ans_list.sort()
ans_list.reverse()
print(str(ans_list[0]))







Fixed submission:
import math

n = input()
a = input().split()
N = int(n)

ans_list = []
ann = []
ana = 1
for j in range(N):
    ana = ana * int(a[j])
ana = ana -1
ans = 0
for k in range(N):
    ans += int(ana % int(a[k]))
ans_list.append(ans)

ans_list.sort()
ans_list.reverse()
print(str(ans_list[0]))

Buggy python submission (verdict: Time Limit Exceeded):
import math

n = input()
a = input().split()
N = int(n)

ans_list = []
ann = []
for i in range(N):
    ana = 1
    ans = 0
    for j in range(i+1):
        ana = ana * int(a[j])
    ana = ana -1
    for k in range(i+1):
        ans += int(ana % int(a[k]))
    ans_list.append(ans)

ans_list.sort()
ans_list.reverse()
print(str(ans_list[0]))



Fixed submission:
import math

n = input()
a = input().split()
N = int(n)

ans_list = []
ann = []
ana = 1
for j in range(N):
    ana = ana * int(a[j])
ana = ana -1
ans = 0
for k in range(N):
    ans += int(ana % int(a[k]))
ans_list.append(ans)

ans_list.sort()
ans_list.reverse()
print(str(ans_list[0]))

Buggy python submission (verdict: Time Limit Exceeded):
import math

n = input()
a = input().split()
N = int(n)

ans_list = []
ann = []
for i in range(N):
    ana = 1
    ans = 0
    for j in range(i+1):
        ana = ana * int(a[j])
    ana = ana -1
    for k in range(N):
        ans += int(ana % int(a[k]))
    ans_list.append(ans)

ans_list.sort()
ans_list.reverse()
print(str(ans_list[0]))







Fixed submission:
import math

n = input()
a = input().split()
N = int(n)

ans_list = []
ann = []
ana = 1
for j in range(N):
    ana = ana * int(a[j])
ana = ana -1
ans = 0
for k in range(N):
    ans += int(ana % int(a[k]))
ans_list.append(ans)

ans_list.sort()
ans_list.reverse()
print(str(ans_list[0]))

Buggy python submission (verdict: Time Limit Exceeded):
import math

n = input()
a = input().split()
N = int(n)

ann = []
for i in range(N):
    ana = 1
    for j in range(i+1):
        ana = ana * int(a[j])
    ann.append(ana-1)

ans_list = []
for i in ann:
    ans = 0
    for j in range(N):
        ans += int(i % int(a[j]))
    ans_list.append(ans)

ans_list.sort()
ans_list.reverse()
print(str(ans_list[0]))





Fixed submission:
import math

n = input()
a = input().split()
N = int(n)

ans_list = []
ann = []
ana = 1
for j in range(N):
    ana = ana * int(a[j])
ana = ana -1
ans = 0
for k in range(N):
    ans += int(ana % int(a[k]))
ans_list.append(ans)

ans_list.sort()
ans_list.reverse()
print(str(ans_list[0]))
Buggy python submission (verdict: Runtime Error):
N = input().split()

n = float(N[0])
m = float(N[1])
d = float(N[2])

max_point = m-1
total = n**m
total_point = 0.
#point_sub = 0
#point_m = m-d
#point_m_sub = m
#for i in range(point_m):
#    point_sub += point_m_sub*(n-i)
#    point_m_sub -= 1

#print(str(point_sub/total))
if d == 0:
    ans = (m-1)/n
    print(str(ans))
else:
    ans = 2*(m-1)*(n-d)/n**2
    print(str(ans))


#for i in range(int(max_point)):
#    total_point += (n-d-i)*(m-i)

#print(str(total_point/total))

Fixed submission:
N = input().split()

n = float(N[0])
m = float(N[1])
d = float(N[2])

#max_point = m-1
#total = n**m
#total_point = 0.
#point_sub = 0
#point_m = m-d
#point_m_sub = m
#for i in range(point_m):
#    point_sub += point_m_sub*(n-i)
#    point_m_sub -= 1

#print(str(point_sub/total))
if d == 0:
    ans = (m-1)/n
    print(str(ans))
else:
    ans = 2*(m-1)*(n-d)/n**2
    print(str(ans))


#for i in range(int(max_point)):
#    total_point += (n-d-i)*(m-i)

#print(str(total_point/total))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = [int(Ai) for Ai in input().split()]

count = 0
for i, Ai in enumerate(A):
    found = False
    for j, Aj in enumerate(A):
        if i != j and Ai % Aj == 0:
            found = True
            break
    if not found:
        count += 1

print(count)


Fixed submission:
from collections import Counter

N = int(input())
A = [int(Ai) for Ai in input().split()]

counter = Counter(A)

dp = [1] * (max(A) + 1)
for Ai in A:
    for j in range(Ai * 2, len(dp), Ai):
        dp[j] = 0

print(sum([dp[Ai] == 1 and counter[Ai] == 1 for Ai in A]))
Buggy python submission (verdict: Time Limit Exceeded):
import math

N = int(input())
A = [int(Ai) for Ai in input().split()]

product = math.prod(A)
if product <= 10 ** 18:
    print(product)
else:
    print(-1)


Fixed submission:
N = int(input())
A = [int(Ai) for Ai in input().split()]

if 0 in A:
    print(0)
else:
    product = 1
    for Ai in A:
        product *= Ai
        if product > 10 ** 18:
            print(-1)
            exit()

    print(product)