qyliang/CodeNanoFix huggingface dataset:
Buggy code:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b,n=map(int,input().split())
cnt=0

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

Fixed code:
import sys
import itertools
if sys.platform =='ios':
    sys.stdin=open('input_file.txt')
    
a,b,n=map(int,input().split())
cnt=0

if n//b>0:
	print(a*(b-1)//b-a*((b-1)//b))
else:
	print(a*(n)//b-a*((n)//b))
Buggy code:
import math

def func(A, B, x):
    return math.floor(A*x/B)-A*math.floor(x/B)

A, B, N = list(map(int, input().split()))

i = 1
max_x = -9999999
max = -9999999
while (i <= N):
    ans =func(A, B, i) 
    if (ans > max):
        max = ans
        max_x = i

print(max)

Fixed code:
import math

def func(A, B, x):
    return math.floor(A*x/B)-A*math.floor(x/B)

A, B, N = list(map(int, input().split()))

"""
i = 1
max_x = -9999999
max = -9999999
while (i <= N):
    ans =func(A, B, i) 
    if (ans > max):
        max = ans
        max_x = i
    i += 1

print(max)
"""

print(func(A, B, min(B-1, N)))
Buggy code:
def main():
    a,b,n = map(int,input().split())
    if b>n:
        print(int(a*(n/b-n//b)))
    else:
        print(int(a*((b-1)/b))


if __name__ == "__main__":
    main()

Fixed code:
def main():
    a,b,n = map(int,input().split())
    if b>n:
        print(int(a*(n/b-n//b)))
    else:
        print(int(a*((b-1)/b)))


if __name__ == "__main__":
    main()
Buggy code:
a, b, n = [int(i) for i in input().split()]

m = n - n % b if n >= b else 1

print((a * m // b) - a * (m // b))


Fixed code:
a, b, n = [int(i) for i in input().split()]
m = b - 1 if n >= b else n

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

mx = 0

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

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

if N < B:
    print((A * N)//B)
else:
    x = (N // B) * B - 1
    print((A*x)//B - A*(x//B))
Buggy code:
def main():
    A, B, N = map(int, input().split(" "))
    max_score = -float("inf")

    if B <= N:
        x = B-1 
    else:
        x = N
    score = math.floor((A*x)/B) - A*math.floor(x/B)
    print(score)

if __name__ == "__main__":
    main()

Fixed code:
import math

def main():
    A, B, N = map(int, input().split(" "))
    max_score = -float("inf")

    if B <= N:
        x = B-1 
    else:
        x = N
    score = math.floor((A*x)/B) - A*math.floor(x/B)
    print(score)

if __name__ == "__main__":
    main()
Buggy code:
import math
A,B,N=map(int,input().split())
D=int(A*B/math.gcd(A,B))
maxi=0
if B-1<=N:
  print((B-1)%B*A/B-(A*(B-1))%B/B)
else:
  print(N%B*A/B-(A*N)%B/B)

Fixed code:
import math
A,B,N=map(int,input().split())
D=int(A*B/math.gcd(A,B))
maxi=0
if B-1<=N:
  print(int((B-1)%B*A/B-(A*(B-1))%B/B))
else:
  print(int(N%B*A/B-(A*N)%B/B))
Buggy code:
import math
A,B,N = map(int, input().split())
if (B-1)<=N:
    print(math.floor(A*(B-1)/B)-math.floor((B-1)/B)*A)
else:
    print(0)
    


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

if __name__ == '__main__':
    a, b, n = list(map(lambda x: int(x), sys.stdin.readline().split(' ')))
    old = 0
    x = b - 1
    print(math.floor(a*x/b)-a*math.floor(x/b))

Fixed code:
import sys
import math

if __name__ == '__main__':
    a, b, n = list(map(lambda x: int(x), sys.stdin.readline().split(' ')))
    old = 0
    if 0 <= b-1 and b-1 <= n:
        x = b - 1
        print(math.floor(a*x/b)-a*math.floor(x/b))
    else:
        x = n
        print(math.floor(a*x/b)-a*math.floor(x/b))
Buggy code:
A, B, N = map(int, input().split())

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

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

print(int(A * min(B-1, N) / B // 1))
Buggy code:
import math


def main():
    a,b,n = map(int,input().split())
    m = math.floor(a * 0 /b) - a * math.floor(0/b)
    for i in range(1,b):
        if m < math.floor(a * i / b) - a * math.floor(i/b):

            m = math.floor(a * i / b) - a * math.floor(i/b)
    print(m)
if __name__ == "__main__":
    main()


Fixed code:
import math


def main():
    a,b,n = map(int,input().split())
    # m = math.floor(a * 0 /b) - a * math.floor(0/b)
    # for i in range(1,min(b-1,n)+1):
    #     if m < math.floor(a * i / b) - a * math.floor(i/b):
    #         m = math.floor(a * i / b) - a * math.floor(i/b)
    i = min(b-1,n)
    m = a*i//b - a*(i//b)
    
    print(m)
if __name__ == "__main__":
    main()
Buggy code:

a, b, n = [int(i) for i in input().split()]

if n > b-1+((b-a)/a):
  ans = (a*(b-1+((b-a)/a)))//b - a*((b-1+((b-a)/a))//b)
  print(ans)
  quit()

ans = (a*n)//b - a*(n//b)

print(ans)

Fixed code:
a, b, n = [int(i) for i in input().split()]

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

ans = (a*n)//b - a*(n//b)

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

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

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

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

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

Fixed code:
a,b,n = map(int, input().split())
x = min(b-1,n)
print(int(a*x/b))
Buggy code:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

a,b,n=n1()
import math
if b<=n:
    i=b-1
else:
    i=n
m=math.floor((a*i)/b)-a*math.floor(i//b)
print(i,m)

Fixed code:
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

a,b,n=n1()

if b<=n:
    i=b-1
else:
    i=n
m=(a*i)//b-a*(i//b)
print(m)
Buggy code:
a,b,n = list(map(int, input().split()))
def f(x):
    return a*x//b - a*(x//b)

left=1
right=n
for _ in range(100):
    delta=(right-left)/3
    midl=left+delta
    midr=midl+delta
#    print(f'left={left} midl={midl} midr={midr} right={right}')
    if f(midl)>f(midr):
        right=midr
    else:
        left=midl
print(max(f(int(midl)),f(min(int(midl)+1),n)))

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

left=1
right=n
for _ in range(100):
    delta=(right-left)/3
    midl=left+delta
    midr=midl+delta
#    print(f'left={left} midl={midl} midr={midr} right={right}')
    if f(midl)>f(midr):
        right=midr
    else:
        left=midl
print(max(f(int(midl)),f(min(int(midl)+1,n))))
Buggy code:
a, b, n = map(int, input().split())

c = min(b - 1, n)
#logging.debug(c)

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

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

c = min(b - 1, n)
#logging.debug(c)
print(int(((a * c) / b) // 1 - (a * ((c / b) // 1))))
Buggy code:
import math
a,b,n = map(int,input().split())
c = n // b * b - 1
ans = max(math.floor(a * c / b) - a * math.floor(c / b), math.floor(a * n / b) - a * math.floor(n / b))

print(ans)

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

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


Fixed code:
#ABC165d
import math

a, b, n = map(int,input().split())
x = min(b-1,n)

print(math.floor(a*x/b))
Buggy code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    a,b,n = LI()
    if 2*b >= n:
        ans = 0
        for x in range(n-1,0,-b):
            ans = max(ans,(a*x)//b-a*(x//b))
        print(ans)
        return
    ans = 0
    for x in range(max(0,b*((n//b)-1)),n+1):
        ans = max(ans,(a*x)//b-a*(x//b))
    print(ans)
    return

#Solve
if __name__ == "__main__":
    solve()


Fixed code:
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    a,b,n = LI()
    if b <= n+1:
        print((a*(b-1))//b)
        return
    print((a*n)//b-a*(n//b))
    return

#Solve
if __name__ == "__main__":
    solve()
Buggy code:
import math
A, B, N = map(int, input().split())

X = min(B-1, N)
# ans = A * math.floor(X/B) - math.floor((A*X)/B)
ans = A * ((X/B) %1) - (A*X/B)%1
print(int(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)
# ans = A * ((X/B) %1) - (A*X/B)%1
print(int(ans))
Buggy code:

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

x = min(B - 1, N)
ans = int(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:
import math

a, b, n = (int(x) for x in input().split())

if b > n:
    print(math.floor(b * 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 = (int(x) for x in input().split())

if b > 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:
import sys
import os

def file_input():
    f = open('../Beginner_Contest_165/input.txt', 'r')
    sys.stdin = f

def main():
    #file_input()
    # input()
    A,B,N=map(int, input().split())

    max=0
    # for x in range(N+1):
    #     # ans=int(A*x/B)-A*int(x/B)
    #     min,_=math.modf(x/B)
    #     # ans=int(A*min)
    #     # print(min)
    #     if x==0:
    #         max=min
    #     elif min > max:
    #         max=min
    #     else:
    #         break

    max=0
    max_x=0
    reg=[0]*B+1

    for x in range(N+1):
        rem = x%B
        if reg[rem]==1:
            break
        else:
            reg[rem]=1
        if rem > max:
            max=rem
            max_x=x

    # min,_=math.modf(max_x/B)

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

if __name__ == '__main__':
    main()


Fixed code:
import sys
import os

def file_input():
    f = open('../Beginner_Contest_165/input.txt', 'r')
    sys.stdin = f

def main():
   # file_input()
    # input()
    A,B,N=map(int, input().split())

    max=0
    # for x in range(N+1):
    #     # ans=int(A*x/B)-A*int(x/B)
    #     min,_=math.modf(x/B)
    #     # ans=int(A*min)
    #     # print(min)
    #     if x==0:
    #         max=min
    #     elif min > max:
    #         max=min
    #     else:
    #         break

    # max=0
    # max_x=0
    # first=0
    #
    # for x in range(N+1):
    #     rem = x%B
    #     if x == 0:
    #         first=rem
    #     elif rem == first:
    #         break
    #     if rem > max:
    #         max=rem
    #         max_x=x

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

    # min,_=math.modf(max_x/B)

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

if __name__ == '__main__':
    main()
Buggy code:
A,B,N = map(int,input().split())
x = min(B-1,N)
print((A*x)//b-A*(x//b))


Fixed code:
A,B,N = list(map(int, input().split()))
x = min(B-1, N)
print(int(A*x/B)-A*int(x/B))
Buggy code:
import math
A,B,N = map(int,input().split())
siki = 0
k = math.floor(N/B)
m = k*B
if (B-1) <= N:
    siki = math.floor((A*(B-1))/B)-A*math.floor((B-1)/B)
elif B>N:
    siki = math.floor((A*N)/B)-A*math.floor((N/B))

Fixed code:
import math
A,B,N = map(int,input().split())
siki = 0
k = math.floor(N/B)
m = k*B
if (B-1) <= N:
    siki = math.floor((A*(B-1))/B)-A*math.floor((B-1)/B)
elif B>N:
    siki = math.floor((A*N)/B)-A*math.floor((N/B))

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

y = b-1
if x < n:
  x = y
else:
  x = n

print(math.floor(a*x/b))

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

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

Fixed code:
a,b,n = map(int,input().split())
i = min(b-1,n)
ans = a*i//b - a*(i//b)
print(ans)
Buggy code:
import sys
input = sys.stdin.readline

def main():
    a,b,n = map(int,input().split())
    l = gcd(a,b)
    print(a*min(n,(b-1))//b-a*(min(b-1,n)//b))

if __name__ == "__main__":
    main()

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

def main():
    a,b,n = map(int,input().split())
    print(a*min(n,(b-1))//b-a*(min(b-1,n)//b))

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

Fixed code:
A,B,N=map(int,input().split())
if N<B:
    x=N
elif N==B:
    x=N-1
else:
    x=(N//B)*B-1
ans=(A*x/B)//1-A*(x//B)
print(int(ans))
Buggy code:
# a,b,n=map(int,input().split())
# max=0
# for i in range(1,n+1):
#     if a%b*i%b<i%b:
#         ans=a*i//b -a*(i//b)
#         if max<ans:
#             max=ans

# print(max)

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

if b>=n:
    x=n
    ans=int(a*x/b) -int(a*x/b)

else:
    x=b-1
    ans=int(a*x/b)-int(a*x/b)

print(ans)
    

Fixed code:
# a,b,n=map(int,input().split())
# max=0
# for i in range(1,n+1):
#     if a%b*i%b<i%b:
#         ans=a*i//b -a*(i//b)
#         if max<ans:
#             max=ans

# print(max)

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

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

else:
    x=b-1
    ans=(a*x)//b -a*(x//b)

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

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

if b<=n:
    if a%b!=0
        print(a-a//b -1)
    else:
        print(a-a//b)
else:
    print(int(n*a/b))

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

if b<=n:
    if a%b!=0:
        print(a-a//b -1)
    else:
        print(a-a//b)
else:
    print(int(n*a/b))
Buggy code:
import math

def floor(A, B, x):
    return math.floor(A * x / B) - A * math.floor(x/B) 

A, B, N = map(int, input().split(' '))

print(max(floor(A,B,N), floor(A,B,B-1)))

Fixed code:
import math

def floor(A, B, x):
    return math.floor(A * x / B) - A * math.floor(x/B) 

A, B, N = map(int, input().split(' '))
x = min(N, B-1)
print(floor(A,B,x))
Buggy code:
def d():
    import math
    a, b, n = map(int, input().split())
    # x <= n
    x = min(b, n) - 1
    print(math.floor(a*x/b) - a * math.floor(x/b))


##########
if __name__ == "__main__":
    d()


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


##########
if __name__ == "__main__":
    d()
Buggy code:
# D - Floor Function
A,B,N = map(int,input().split())
x = max(B-1,N)
print(int(A*x/B))

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

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

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

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

print(ans)
Buggy code:
import math
import collections
def f(a,b,x):
    return math.floor((a*x)/b) - a*math.floor(x/b)
a,b,n=map(int, input().split())
dd = collections.defaultdict(int)

print(f(a,b,min(b-1,x)))


Fixed code:
import math
import collections
def f(a,b,x):
    return math.floor((a*x)/b) - a*math.floor(x/b)
a,b,n=map(int, input().split())
dd = collections.defaultdict(int)

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

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

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

if B - 1 <= N:
    x = B - 1
else:
    x = N
    print('h')

ans = math.floor(A * x / B) - A * math.floor(x / B)
print(ans)



Fixed code:
import math

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

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

ans = math.floor(A * x / B) - A * math.floor(x / B)
print(ans)
Buggy code:
import sys
from math import sqrt, floor

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def main():
    a, b, n = MI()

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


if __name__ == "__main__":
    main()


Fixed code:
import sys
from math import sqrt, floor

input = sys.stdin.readline
sys.setrecursionlimit(10 ** 6)


def I():
    return int(input())


def MI():
    return map(int, input().split())


def main():
    a, b, n = MI()

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


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

# floor( Ar / B ) : r = 0..min(B-1,N%B)

r = N if N < B else r = B-1

print( A*r // B )

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

# floor( Ar / B ) : r = 0..min(B-1,N%B)

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

print( A*r // B )
Buggy code:
import math
a,b,n = map(int, input().split())

def floor(t):
  return math.floor(t)

x = b - 1

max = floor(a * x / b) - a * floor(x / b)
print(max)


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

def floor(t):
  return math.floor(t)

x = b - 1
if x > n:
  x = n

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

          
          

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


Fixed code:
A,B,N=map(int,input().split())
x=min(B-1,N)
print(int(A*x/B))
Buggy code:
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

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

m = -1

for x in range(1, N+1):
    res = math.floor(A * x / B) - A * math.floor(x / B)
    print(res)
    if res >= m:
        m = res
    elif res == 0:
        break
    else:
        break

print(m)


Fixed code:
import sys
import math
import fractions
from collections import deque
from collections import defaultdict
sys.setrecursionlimit(10**7)

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

# m = -1

# for x in range(1, N+1):
#     res = math.floor(A * x / B) - A * math.floor(x / B)
#     print(res)

if B > N:
    x = N
    res = math.floor(A * x / B) - A * math.floor(x / B)
    print(res)
else:
    x = B - 1
    res = math.floor(A * x / B) - A * math.floor(x / B)
    print(res)
Buggy code:
A,B,N=map(int,input().split())
min(int(A*(B-1)/B)-A*int((B-1)/B),int(A*N/B)-A*int(N/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())
if b==0:
  print(0)
else:
  print(int(a*(b-1)/b)-a*int((b-1)/b))

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

if n<=b-1:
  print(int(a*n/b)-a*int(n/b))
else:
  print(int(a*(b-1)/b)-a*int((b-1)/b))
Buggy code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a,b,n = map(int,input().split())
if b-1 >= n:
  x = b-1
else:
  x = n
print((a*x//b)-(a*(x//b)))

Fixed code:
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

a,b,n = map(int,input().split())
if b-1 <= n:
  x = b-1
else:
  x = n
print((a*x//b)-(a*(x//b)))
Buggy code:
import numpy as np

def fLOOR(a,b,x):
    return np.floor(a * x / b) - a * np.floor(x / b)
"""
def fLOOR1(a,b,x):
    return np.floor(a * x / b)

def fLOOR2(a,b,x):
    return np.floor(x / b)
"""
def main():
    a,b,n = map(int, input().split(" "))
    
    """
    for x in range(n):
        x += 1
        val = fLOOR(a,b,x)
        val1 = fLOOR1(a,b,x)
        val2 = fLOOR2(a,b,x)
        print(val)
    """
    if b <= n:
        ans = fLOOR(a,b,b-1)
    else:
        ans = fLOOR(a,b,n)
    print(ans)

if __name__ == '__main__':
    main()

Fixed code:
import numpy as np

def fLOOR(a,b,x):
    return np.floor(a * x / b) - a * np.floor(x / b)
"""
def fLOOR1(a,b,x):
    return np.floor(a * x / b)

def fLOOR2(a,b,x):
    return np.floor(x / b)
"""
def main():
    a,b,n = map(int, input().split(" "))
    
    """
    for x in range(n):
        x += 1
        val = fLOOR(a,b,x)
        val1 = fLOOR1(a,b,x)
        val2 = fLOOR2(a,b,x)
        print(val)
    """
    if b <= n:
        ans = fLOOR(a,b,b-1)
    else:
        ans = fLOOR(a,b,n)
    print(int(ans))

if __name__ == '__main__':
    main()
Buggy code:
a,b,n=map(int,input().split())
a1=int((a*n)/b)-a*int(n/b)
i=int((n+1)/b)
if i!=0:
    a2=int((a*(i*b-1))/b)-a*int((i*b-1)/b)
    a3=int((a*b-1)/b)-a*int((b-1)/b)
    print(max(a1,a2,a3))
else:
    print(a1)

Fixed code:
a,b,n=map(int,input().split())
a1=a*n//b
i=(n+1)//b
if i!=0:
    a2=a*(b-1)//b
    print(a2)
else:
    print(a1)
Buggy code:
A, B, N = map(int, input().split())

def f(x):
    return int(A*x/B)-A*int(x/B)

X = N
Y = min(B-1,N)

print(min(f(X),f(Y))

Fixed code:


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

def f(x):
    return int(A*x/B)-A*int(x/B)

X = N
Y = min(B-1,N)

print(f(Y))
Buggy code:
a,b,n=map(int,input().split())
x=[]
x.append(int(a*n/b)-a*int(n/b))
if n>=b:
  t=int(n/b)
  x.append(int(a*(t*b-1)/b)-a*int((t*b-1)/b))
x.append(int(a*(b-1)/b)-a*int((b-1)/b))
print(max(x))

Fixed code:
a,b,n=map(int,input().split())
x=[]
if n>=b:
  x.append(int(a*(b-1)/b))
else:
  x.append(int(a*n/b))
print(max(x))
Buggy code:
arr = input().split(" ")
a, b, n = int(arr[0]), int(arr[1]), int(arr[2])
if b<=n:
  k = a
else:
  k = (a*((n-1))//b
print(k)

Fixed code:
arr = input().split(" ")
a, b, n = int(arr[0]), int(arr[1]), int(arr[2])
if b<=n:
   k = int((a*(b-1))/b)
else:
   k = int((a*n)/b)
print(k)
Buggy code:

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

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


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

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