qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import math

input1 = input().split()
A = int(input1[0])
B = int(input1[1])
N = int(input1[2])

x = 0
result = 0
if N >= B-1:
    x = B-1
    result = (A*(x%B) - (A*x)%B)/B
elif N < B-1:
    x = N
    result = (A*(x%B) - (A*x)%B)/B

print(result)

Fixed code:
import math

input1 = input().split()
A = int(input1[0])
B = int(input1[1])
N = int(input1[2])

x = 0
result = 0
if N >= B-1:
    x = B-1
    result = (A*(x%B) - (A*x)%B)/B
elif N < B-1:
    x = N
    result = (A*(x%B) - (A*x)%B)/B

print(int(result))
Buggy code:
a, b, n = map(int(input().split()))
x = min(b-1, n)
print(floor(a*x/b) - a * floor(x/b))

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

x = min(n,b-1)
ans = a*x//b - a*(x//b) 
print(ans)
Buggy code:

def resolve():
    def f(x):
        res = (A*x)//B - A*(x//B)
        return res

    A, B, N = map(int, input().split())
    x = min(B-1, N)
    print(f(x))

if __name__ == "__main__":
    resolve():

Fixed code:

def resolve():
    def f(x):
        res = (A*x)//B - A*(x//B)
        return res

    A, B, N = map(int, input().split())
    x = min(B-1, N)
    print(f(x))

if __name__ == "__main__":
    resolve()
Buggy code:
import math

A, B, N= (int(x) for x in input().split())
#x = B * math.floor(N/B) - 1
x =  B - 1
if N < B
    x = N
a = math.floor(A * x / B) - A * math.floor(x / B)
b = math.floor(A * N / B) - A * math.floor(N / B)

if a > b:
    print(a)
else:
    print(b)

Fixed code:
import math

A, B, N= (int(x) for x in input().split())
#x = B * math.floor(N/B) - 1
x =  B - 1
if N < B:
    x = N
a = math.floor(A * x / B) - A * math.floor(x / B)
# b = math.floor(A * N / B) - A * math.floor(N / B)
print(a)
Buggy code:
a,b,n= map(int,input().split())
if n>b/2:
	print(int(a*(b-1)/b))
else:
    print(int(a*(b-2)/b))

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

if(b > n):
    ans = (a*n)//b - a * (n//b)
else:
    ans = (a*(b-1))//b - a * ((b-1)//b)

print(ans)
Buggy code:
a,b,n = map(int, input().split())

if n < b:
    print(math.floor(a*n/b) - a*math.floor(n/b))
else:
    print(math.floor(a * (b-1) / b) - a * math.floor((b-1) / b))


Fixed code:
import math

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

if n < b:
    print(math.floor(a*n/b) - a*math.floor(n/b))
else:
    print(math.floor(a * (b-1) / b) - a * math.floor((b-1) / b))
Buggy code:
a, b, n = map(int, input().split())

cnt = 1
buf = []
buf.append(int(a * n / b) - a * (int(n / b)))

while True:
    if n / b > 10 ** 6:
        break
    x = cnt * b - 1
    if n < x :
        break
    calc = int(a * x / b) - a * (int(x / b))
    if calc > max(buf):
        buf.append(calc)
    cnt += 1
    
buf.append(int(a * (b - 1) / b) - a * (int((b - 1) / b)))

ans = max(buf)
print(ans)

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

cnt = 1
buf = []
if n < b:
    buf.append(int(a * n / b) - a * (int(n / b)))
else:
    buf.append(int(a * (b - 1) / b) - a * (int((b - 1) / b)))
    

while True:
    if n / b > 10 ** 6:
        break
    x = cnt * b - 1
    if n < x :
        break
    calc = int(a * x / b) - a * (int(x / b))
    if calc > max(buf):
        buf.append(calc)
    cnt += 1
    
if n / b > 10 ** 6 and n >= b:
    buf.append(int(a * (b - 1) / b) - a * (int((b - 1) / b)))

ans = max(buf)
print(ans)
Buggy code:
A,B,N = map(int,input().split())

print((min(N,B)-1)*A//B)

Fixed code:
A, B, N = map(int, input().split())

i = min (B-1,N)
print(int(A*i/B) - A*int(i/B))
Buggy code:
a,b,n=map(int,input().split())

def f(a,b,x):
    return (a*x)//b - a*(x//b)

print(f(min(b-1,n)))

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

def f(x):
    return (a*x)//b - a*(x//b)

print(f(min(b-1,n)))
Buggy code:
import math

A, B, N = map(int, input().split())
max = 0
temp = 0
bk_temp = 0

for i in range(1, N + 1):
    temp = math.floor(A*i/B) - (A * math.floor(i/B))
    print(str(i) + ' ' + str(temp))
    if bk_temp > temp:
        max = bk_temp
        break
    if max < temp:
        max = temp
    bk_temp = temp

print(max)

Fixed code:
import math

A, B, N = map(int, input().split())
max = 0
temp = 0
bk_temp = 0

if B <= N:
    max = math.floor(A * (B - 1) / B) - (A * math.floor((B - 1) / B))
else:
    # for i in range(1, N + 1):
    #     temp = math.floor(A*i/B) - (A * math.floor(i/B))
    #     print(str(i) + ' ' + str(temp))
    #     if bk_temp > temp:
    #         max = bk_temp
    #         break
    #     if max < temp:
    #         max = temp
    #     bk_temp = temp
    max = math.floor(A * N / B) - (A * math.floor((N) / B))

print(max)
Buggy code:
a,b,n=map(int,input().split())
f=lambda x:(a*x)//b-a*(x//b)
print(max(f(b-1),f(n)))

Fixed code:
a,b,n=map(int,input().split())
f=lambda x:(a*x)//b-a*(x//b)
print(f(min(b-1,n)))
Buggy code:
A,B,N  = map(int, input().split())
ans = 0

if B >= N:
  ans = (A*(B-1))//B
else:
  ans = (A*(N))//B

print(ans)

Fixed code:
A,B,N  = map(int, input().split())
ans = 0

if B <= N:
  ans = (A*(B-1))//B
else:
  ans = (A*(N))//B

print(ans)
Buggy code:
import sys
input = sys.stdin.readline
A, B, N = 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
ps = make_divisors(B - 1)
res = 0
for i in ps:
  if N < i: continue
  for j in range(1, 10 ** 6 + 1):
    x = i * j
    res = max(res, (A * x) // B - A * (x // B))
for x in range(1, min(N, 10 ** 6)):
  res = max(res, (A * x) // B - A * (x // B))
print(res)

Fixed code:
import sys
input = sys.stdin.readline
A, B, N = 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
ps = make_divisors(B - 1)
res = (A * N) // B - A * (N // B)
for i in ps:
  if N < i: continue
  for j in range(1, 10 ** 4 + 1):
    x = i * j
    if N < x: continue
    res = max(res, (A * x) // B - A * (x // B))
for x in range(1, min(N, 10 ** 4)):
  res = max(res, (A * x) // B - A * (x // B))
print(res)
Buggy code:
a,b,n = map(int,input().split()) 

x=max(n,b-1)

ans = (int(a*x/b) - a * int(x/b))

print(ans)


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

x=min(n,b-1)

ans = (int(a*x/b) - a * int(x/b))

print(ans)
Buggy code:
a,b,n=map(int,input().split())

if n<b:
  ans=int(a*n/b)-a*int(n/b)
else :
  ans=int(a*(n-1)/b)-a*int((n-1)/b)


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

if n<b:
  ans=int(a*n/b)-a*int(n/b)
else:
  ans=int(a*(b-1)/b)-a*int((b-1)/b)
print(ans)
Buggy code:
a,b,n = map(int,input().split())

x = max(b,n-1)
ans = a*x//b - a*(x//b)

print(ans)

Fixed code:
a, b, n = map(int,input().split())
x = min(b -1, n)
ans = int(a * x/ b)
print(ans)
Buggy code:
a , b , n = map(int,input().split())
x = n - 1
print(int((a*x)/b)-a*(x/b))

Fixed code:
a,b,n=map(int,input().split())
x=min(b-1,n)
print((a*x)//b-a*(x//b))
Buggy code:
import math

A, B, N = map(int, input().split())
x = max(B-1, N)
print(math.floor((A*x)/B)-A*(x//B)

Fixed code:
import math

A, B, N = map(int, input().split())
x = min(B-1, N)
print(math.floor((A*x)/B)-A*(x//B))
Buggy code:
import math
A,B,N = map(int,input().split())
if B-1>N:
    print(math.floor((A*N)/B)-A*math.floor(N/B))
else:
    print(math.floor((A*B-1)/B)-A*math.floor(B-1/B))

Fixed code:
import math
A,B,N = map(int,input().split())
if B-1>N:
    print(math.floor((A*N)/B)-A*math.floor(N/B))
else:
    print(math.floor((A*(B-1))/B)-A*math.floor((B-1)/B))
Buggy code:
def i():
    return int(input())
def i2():
    return map(int,input().split())
def s():
    return str(input())
def l():
    return list(input())
def intl():
    return list(int(k) for k in input().split())

a,b,n=i2()
print( a*(b-1)//b )

Fixed code:
def i():
    return int(input())
def i2():
    return map(int,input().split())
def s():
    return str(input())
def l():
    return list(input())
def intl():
    return list(int(k) for k in input().split())

a,b,n=i2()
if b<=n:
	print( a*(b-1)//b )
else:
	print( a*n//b )
Buggy code:
a,b,n=map(int,input().split())
m=min(n,b)
tmp=(a*//b)-(((m-1)//b)*a)    
print(tmp)

Fixed code:
a,b,n=map(int,input().split())
m=min(n,b-1)
tmp=(a*m//b)-((m//b)*a)    
print(tmp)
Buggy code:
a, b, n = map(int, input().split())
if n >= b - 1:
    print(int(a - a / b))
else:
    print(a * n // b - a * n // b)

Fixed code:
a, b, n = map(int, input().split())
if n >= b - 1:
    print(a - (a + b - 1) // b)
else:
    print((a * n) // b)
Buggy code:
a,b,n=map(int,input().split())
score=0
if (n<b):
    print( int(a*n/b))
elif(b＝＝１):
    print(0)
else:
    c = int(n/b)
    score = 0
    for i in range(1,c+1):
        n_ = b*i-1
        t = int(a*n_/b)-a*int(n_/b)
        score = max(score,t)
    t = int(a*n/b)-a*int(n/b)
    score = max(score,t)
    print(score)

Fixed code:
a,b,n=map(int,input().split())
score=0
if (n<b):
    print( int(a*n/b))
elif(b==1):
    print(0)
else:
    c = int(n/b)
    score = 0
    for i in range(1,c+1):
        n_ = b*i-1
        t = int(a*n_/b)-a*int(n_/b)
        score = max(score,t)
    t = int(a*n/b)-a*int(n/b)
    score = max(score,t)
    print(score)
Buggy code:
a, b, n = map(int, input().split())
print(math.floor(a * min((b - 1), n) / b))

Fixed code:
import math
a, b, n = map(int, input().split())
print(math.floor(a * min((b - 1), n) / b))
Buggy code:
A, B, N = map(int, input().split())
x = B-1 if B > N else N-1
print(A*x//B-A*(x//B))

Fixed code:
A, B, N = map(int, input().split())
x = N if B-1 > N else B-1
print(A*x//B-A*(x//B))
Buggy code:
from math import floor
A, B, N = map(int,input().split())

x=max(N,B-1)
print(floor(A*x/B)-A*floor(x/B))

Fixed code:
from math import floor
A, B, N = map(int,input().split())

x=min(N,B-1)
print(floor(A*x/B)-A*floor(x/B))
Buggy code:
a,b,n = map(int,input().split())

x = math.floor(a*n/b)-( a*math.floor(n/b))
y = math.floor(a*b/b)-( a*math.floor(b/b))
z = math.floor(a*(b-1)/b)-( a*math.floor((b-1)/b))

if b == 1:
    print(0)
elif n < b:
    print(x)
else:
    print(z)

Fixed code:
import math
a,b,n = map(int,input().split())

x = math.floor(a*n/b)-( a*math.floor(n/b))
y = math.floor(a*b/b)-( a*math.floor(b/b))
z = math.floor(a*(b-1)/b)-( a*math.floor((b-1)/b))

if b == 1:
    print(0)
elif n < b:
    print(x)
else:
    print(z)
Buggy code:
import math
a, b, n = list(map(int,input().split()))
if b > n:
    print(math.floor(a*n/b))
elif n < 2*b - 1:
    print(max(math.floor(a*n/b)-a,math.floor(a*(b-1)/b))
else:
    print(a+math.floor((-1)*a/b))

Fixed code:
import math
a, b, n = list(map(int,input().split()))
if b > n:
    print(math.floor(a*n/b))
elif n < 2*b - 1:
    print(max(math.floor(a*n/b)-a,math.floor(a*(b-1)/b)))
else:
    print(a+math.floor((-1)*a/b))
Buggy code:
import math
a, b, n = map(int, input().split())
if n < b:
    x = n
else b < n:
    x = b-1
new = math.floor(a*x/b) - a * math.floor(x/b)
print(new)


Fixed code:
import math
a, b, n = map(int, input().split())
x = n

if b <= n:
    x = b-1

new = math.floor(a*x/b) - a * math.floor(x/b)
print(new)
Buggy code:
list=input().split(" ")
A=int(list[0])
B=int(list[1])
N=int(list[2])

if B>N:
    B=N-1

print(int(A*B/N) - int(B/N)*A)

Fixed code:
list=input().split(" ")
A=int(list[0])
B=int(list[1])
N=int(list[2])

if N>=B:
    N=B-1

print(int(A*N/B) - int(N/B)*A)
Buggy code:
a, b, n = list(map(lambda x: int(x), input().split(' ')))

print((a * (n - 1)) // b - a * ((n - 1) // b))

Fixed code:
a, b, n = list(map(lambda x: int(x), input().split(' ')))

print((a * min(n, b - 1)) // b)
Buggy code:
#!/usr/bin/env python3
import sys
import math
# from decimal import *
from fractions import *


def solve(A: int, B: int, N: int):
    def kansuu(x):
        # return math.floor(A*x/B) - A * math.floor(x/B)
        left = math.floor(Fraction(A) * Fraction(x) * Fraction(1, B))
        right = Fraction(A) * math.floor(Fraction(x, B))
        return left - right

    saidaibaisuu = (N // B) * B
    print(saidaibaisuu)
    if saidaibaisuu == 0:
        print(kansuu(N))
        exit()
    else:
        print(kansuu(saidaibaisuu-1))
        exit()

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)


if __name__ == '__main__':
    main()


Fixed code:
#!/usr/bin/env python3
import sys
import math
# from decimal import *
from fractions import *


def solve(A: int, B: int, N: int):
    def kansuu(x):
        # return math.floor(A*x/B) - A * math.floor(x/B)
        left = math.floor(Fraction(A) * Fraction(x) * Fraction(1, B))
        right = Fraction(A) * math.floor(Fraction(x, B))
        return left - right

    saidaibaisuu = (N // B) * B
    if saidaibaisuu == 0:
        print(kansuu(N))
        exit()
    else:
        print(kansuu(saidaibaisuu-1))
        exit()

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)


if __name__ == '__main__':
    main()
Buggy code:
a, b, n = map(int, input().split())

x = 0
ans = 0
if n < b:
    x = n
    ans = math.floor(a*x/b) - a * math.floor(x/b)
else:
    x = n - 1
    ans = math.floor(a*x/b) - a * math.floor(x/b)
print(ans)

Fixed code:
import math
a, b, n = map(int, input().split())

x = 0
ans = 0
if n < b:
    x = n
    ans = math.floor(a*x/b) - a * math.floor(x/b)
else:
    x = b - 1
    ans = math.floor(a*x/b) - a * math.floor(x/b)
print(ans)
Buggy code:
A, B, N = map(int,input().split())
 
if (N > 1):
	if (N < B):
	    print((A*N)/B - A*(N/B))
	else:
	    print((A*(N-1))/B - A*((N-1)/B))
else:
	print((A*N)/B - A*(N/B))

Fixed code:
A, B, N = map(int, input().split())
if N >= B:
    print(A*(B-1)//B)
else:
    print(A*(N)//B)
Buggy code:
A,B,N=map(int,input().split())
if N>B:
  print((A*N)//B-A*(N//B))
else:
  print((A*(B-1)//B-A*((B-1)//B)))

Fixed code:
A, B, N = map(int, input().split())

if B > N: x = N
else:
    x = B - 1
print(int(A * x / B) - A * int(x / B))
Buggy code:
A,B,N = map(int,input().split())
def f(x):
  f = int(A*x/B)-A*int(x/B)
  return f
if(f(B-1)< f(N)):
  print(f(N))
else:
  print(f(B-1))

Fixed code:
A,B,N = map(int,input().split())
def f(x):
  f = int((A*x)/B)-A*int(x/B)
  return f
if(B-1 < N):
  print(f(B-1))
else:
  print(f(N))
Buggy code:

A, B, N=list(map(int, input().split()))
if B > N:
    X = N
else:
    X = B-1

Ans = math.floor(A*X/B) - A * math.floor(X/B)
print(Ans)


Fixed code:
import math
A, B, N=list(map(int, input().split()))
if B > N:
    X = N
else:
    X = B-1

Ans = math.floor(A*X/B) - A * math.floor(X/B)
print(Ans)
Buggy code:
a, b, n = map(int, input().split())


if  b>=n:
    print(a*(n-1)//b - a*((n-1)//b))
else:
    print(a*((n//b)*b-1)//b - a*(((n//b)*b-1)//b))


Fixed code:
a,b,n = map(int,input().split())
if(b<=n):
  print(int((a*(b-1)/b)//1))
else:
  print(int((a*n/b)//1))
Buggy code:
import math
a,b,n = map(int, input().split())
if b > n:
    c = n-1
else:
    c = b-1
ans = math.floor(a * c /b) - a * math.floor(c/b)

print(ans)

Fixed code:
import math
a,b,n = map(int, input().split())
if b > n:
    c = n
else:
    c = b-1
ans = math.floor(a * c /b) - a * math.floor(c/b)

print(ans)
Buggy code:
A,N,B=map(int, input().split())

if N < B:
  x = N
else:
  x = B-1

print(int(A*x/B) - A*int(x/B))

Fixed code:
A,B,N = map(int,input().split())

if N<= B-1:
    ans = (N*A)//B
else:
    ans = ((B-1)*A)//B
    
print(ans)
Buggy code:
A, B, N = map(int,input().split())

max - int(a*min(B-1,N)/B)
print(max)
~             

Fixed code:
A, B, N = map(int,input().split())

max = int(A*min(B-1,N)/B)
print(max)
Buggy code:
a. b. x = map(int, input().split())
def f(x):
  return (a*x)//b - a*(x//b)

print(f(min(b-1, n))

Fixed code:
a, b, n = map(int, input().split())
def f(x):
  return (a*x)//b - a*(x//b)
 
print(f(min(b-1, n)))
Buggy code:
a, b, n = map(int, input().split())
print(a * (b-1) // b))

Fixed code:
a, b, n = map(int, input().split())
print(a * min((b-1), n) // b)
Buggy code:
A,B,N = map(int,input().split())
S = 0
n = N // B
r = N % B
if B > N:
    S = (A*N)//B
else:
    if  r == 0:
        S = (A*(N-1))//B - A * ((N-1）//B))
    elif r == B - 1:
        S = (A*N)//B - A * (N//B)
    else:
        S = (A*(n*B-1))//B - A * ((n*B-1)//B)

print(S)


Fixed code:
A,B,N = map(int,input().split())
S = 0
n = N // B
r = N % B
if B > N:
    S = (A*N)//B
else:
    if  r == 0:
        S = (A*(N-1))//B - A * ((N-1)//B)
    elif r == B - 1:
        S = (A*N)//B - A * (N//B)
    else:
        S = (A*(n*B-1))//B - A * ((n*B-1)//B)

print(S)
Buggy code:
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]

def a(A,B,x): return (A*x//B)-A*(x//B)

def main():
    A,B,N = MI()
    max = 0
    for x in range(0, B+1):
        if max < a(A,B,x):
            max = a(A,B,x)
    
    print(max)



    


if __name__ == "__main__":
	main()

Fixed code:
import sys
input = sys.stdin.readline
input = sys.stdin.buffer.readline

def RD(): return sys.stdin.read()
def II(): return int(input())
def MI(): return map(int,input().split())
def LI(): return list(map(int,input().split()))
def TI(): return tuple(map(int,input().split()))
def RN(N): return [input().strip() for i in range(N)]

def a(A,B,x): return (A*x//B)-A*(x//B)

def main():
    A,B,N = MI()
    """
    max = 0
    m = 0
    for x in range(0, N+1):
        ai = a(A,B,x)
        if max < ai :
            max = ai
        elif ai<0 and m == 0:
            max = ai
            m +=1

        print(x,a(A,B,x))
    """
    if N >= B:
        x = (N//B)*B-1
    elif N == B:
        x = N-1
    elif N < B:
        x = N
    print(a(A,B,x))

    



    


if __name__ == "__main__":
	main()
Buggy code:
A, B, N = map(int, input().split())

def calc(x):
  return (A*x)//B - A*(x//B)

print(max(calc(B-1), calc(N)))

Fixed code:
A, B, N = map(int, input().split())

def calc(x):
  return (A*x)//B - A*(x//B)

print(calc(min(N,B-1)))
Buggy code:
a, b, n = map(int, input().split())

if b == 1 or a == 1:
    print(0)
else:
    r = min(b-1, n) 
    s = (a * r) // b - a * (r // b)
    print(r)

Fixed code:
a, b, n = map(int, input().split()) 
if b == 1 or a == 1: 
    print(0) 
else: 
    r = min(b-1, n) 
    s = (a * r) // b - a * (r // b)    
    print(s)
Buggy code:
A, B, N = map(int, input().split())
if B == 1:
    result = 0
elif B-1 >= N:
    result = min(A, B)-1
else:
    result = int(A*N/B) - A*int(N/B)
    
print(result)

Fixed code:
A, B, N = map(int, input().split())
if B == 1:
    result = 0
elif N >= B - 1:
    result = int(A*(B-1)/B) - A*int((B-1)/B)
else:
    result = int(A*N/B) - A*int(N/B)
    
print(result)
Buggy code:
import math
A,B,N=list(map(int,input().split()))
maxi=max(B-1,N)
print(math.floor((A*maxi)/B)-A*math.floor(maxi/B))

Fixed code:
import math
A,B,N=list(map(int,input().split()))
maxi=min(B-1,N)
print(math.floor((A*maxi)/B)-A*math.floor(maxi/B))
Buggy code:
import math
A,B,N = map(int,input().split())
C = N - N%B
D = A*(C-1)
ans = math.floor(D/B)　-　A * math.floor((C-1)/B)
if B > N:
    ans = math.floor(A*N/B) - A*math.floor(N/B)
print(ans)

Fixed code:
import math
A,B,N = map(int,input().split())
C = N - N%B
ans = A*(C-1) // B - A*math.floor((C-1)/B)
if B > N:
    ans = A*N // B - A*math.floor(N/B)
print(ans)
Buggy code:
a,b,n = map(int,input().split())


x = b-1

if b > n:
  res = int(a/b)

else :
  res = int((a/b)*(b-1))
  
print(res)


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


x = b-1

if b > n:
  res = int((a/b)*n)

else :
  res = int((a/b)*(b-1))
  
print(res)
Buggy code:
a, b, n = map(int, input().split())

if a==1:
  print(0)
else:
  c = max(b-1, n)
  print((a*c)//b)


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

if a==1:
  print(0)
else:
  c = min(b-1, n)
  print((a*c)//b)
Buggy code:
a,b,n = map(int, input().split())
def f(x):
    return int(a*x/b) - a*int(x/b)
Max = max(f(b-1),f(n))
print(Max)

Fixed code:
a,b,n = map(int, input().split())
def f(x):
    return int(a*x/b) - a*int(x/b)
Max = f(min(b-1,n))
print(Max)
Buggy code:
import math
A,B,N=map(int,input().split())
x=min(B-1,N)
ans=math.ceil(A*x/B)-math.ceil(x/B)*A
print(ans)



Fixed code:
import math
A,B,N=map(int,input().split())
x=min(B-1,N)
ans=math.floor(A*x/B)-A*math.floor(x/B)
print(int(ans))
Buggy code:
#n=int(input())
a,b,n=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(q)]

#for i in range(n+1):
#    print(i,(a*i/b)//1,a*((i/b)//1),(a*i/b)//1-a*((i/b)//1))
print(int((a*(b-1)/b)//1-a*(((b-1)/b)//1)))


Fixed code:
#n=int(input())
a,b,n=map(int,input().split())
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(q)]

#for i in range(n+1):
#    print(i,(a*i/b)//1,a*((i/b)//1),(a*i/b)//1-a*((i/b)//1))
i=min(b-1,n)
print(int((a*i/b)//1-a*((i/b)//1)))
Buggy code:
import sys
input = sys.stdin.readline

def main():
    a, b, n = map(int, input().split())
    x = min(n + 1, b - 1)
    X = (a * x) // b
    Y = a * (x // b)
    print(X - Y)
if __name__ == '__main__':
    main()


Fixed code:
import sys
input = sys.stdin.readline

def main():
    a, b, n = map(int, input().split())
    x = min(n, b - 1)
    X = (a * x) // b
    Y = a * (x // b)
    print(X - Y)
if __name__ == '__main__':
    main()
Buggy code:
a,b,n=map(int,input().split())
c=max(0,a//b)
d=min(b,n)
def floor(x):
    return int((a*x)/b)-a*(int(x/b))
if n<=b:
    print(floor(n))
else:
    if b<a:
        print(floor(b-1))
    elif b=a:
        print(floor(b))
    else:
        e=max(b-1,a//b)
        print(floor(e))



Fixed code:
a,b,n=map(int,input().split())
c=max(0,a//b)
d=min(b,n)
def floor(x):
    return int((a*x)/b)-a*(int(x/b))
if n<b:
    print(floor(n))
elif n==b:
    print(floor(b-1))
else:
    if b<a:
        print(floor(b-1))
    elif b==a:
        print(floor(b))
    else:
        e=max(b-1,a//b)
        print(floor(e))
Buggy code:
import math

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

k = n//b

ans = math.floor(a*(k*b-1)/b) - a*(k-1)

print(ans)

Fixed code:
import math

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

ans = math.floor(a*min(b-1, n)/b)

print(ans)
Buggy code:
A,B,N = map(int, input().split())

def f(a, b, n):
    fl1 = (a * (n + 1)) // b
    fl2 = (n + 1) // b
    fl = fl1 - a * fl2
    return fl

print(f(a, b, b-1) if n >= b-1 else f(a, b, n))

Fixed code:
A,B,N = map(int, input().split())

def f(a, b, n):
   # fl1 = (a * (n + 1)) // b
    #fl2 = (n + 1) // b
    #fl = fl1 - a * fl2
    #return fl
   return int(a * n / b) - a * int(n / b)

print(f(A, B, B-1) if N >= B-1 else f(A, B, N))
Buggy code:
A,B,N=map(int,input().split())
def f(x):
  return int(A*x/B)-A*int(x/B)

print(f(max(N,B-1)))

Fixed code:
A,B,N=map(int,input().split())
def f(x):
  return int(A*x/B)-A*int(x/B)

print(f(min(N,B-1)))
Buggy code:
a,b,n=map(int,input().split())
import math
print(math.floor(a*(b-1)/b))

Fixed code:
a,b,n=map(int,input().split())
import math
print(math.floor(a*(min(n,(b-1)))/b))
Buggy code:
import math
A, B, N = list(map(int, input().split(" ")))
if B > N:
    print(math.floor(A*i/B) - A * math.floor(i/B))
else:
    print(math.floor(A*(B-1)/B))

Fixed code:
import math
A, B, N = list(map(int, input().split(" ")))
if B > N:
    print(math.floor(A*N/B) - A * math.floor(N/B))
else:
    print(math.floor(A*(B-1)/B))