Problem:
 Score : 400 points    Problem Statement Given are integers A , B , and N .  Find the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N .  Here floor(t) denotes the greatest integer not greater than the real number t .      Constraints  1 ≤ A ≤ 10^{6}  1 ≤ B ≤ 10^{12}  1 ≤ N ≤ 10^{12}  All values in input are integers.         Input Input is given from Standard Input in the following format:  A  B  N       Output Print the maximum possible value of floor(Ax/B) - A × floor(x/B) for a non-negative integer x not greater than N , as an integer.        Sample Input 1 5 7 4      Sample Output 1 2  When x=3 , floor(Ax/B)-A×floor(x/B) = floor(15/7) - 5×floor(3/7) = 2 . This is the maximum value possible.       Sample Input 2 11 10 9      Sample Output 2 9

Solution (Python):
from sys import stdin
from sys import setrecursionlimit
from collections import Counter, deque, defaultdict
from math import floor
from bisect import bisect_left
setrecursionlimit(1000000)

INF = int(1e10)
MOD = int(1e9 + 7)

def input():
    return stdin.readline()[:-1]

def main():
    from builtins import int, map
    A, B, N = map(int, input().split())
    m = min(B - 1, N)
    ans = floor(A * m / B) - A * floor(m / B)
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
from math import floor

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

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

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

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

print((a*x)//b)

Solution (Python):
A,B,N = map(int,input().split())
x = max(0,N//B*B-1)
cur1 = A*x/B//1 - A*(x/B//1)
cur2 = A*N/B//1 - A*(N/B//1)
print(int(max(cur1,cur2)))

Solution (Python):
import math

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


if N>=B-1:
    x=B-1
    ans=math.floor(x*A/B)-math.floor(x/B)
    print(ans)
elif N<B-1:
    x=N
    ans=math.floor(x*A/B)-math.floor(x/B)
    print(ans)

Solution (Python):
a,b,n = map(int,input().split())
if n%b==0:n-=1
x = max((n//b)*b-1,n%b)
print(((a*x)//b)-(a*(x//b)))

Solution (Python):
a,b,n = map(int, input().split())
m = min(n,b-1)
print(int(a*m/b)-a*int(m/b))

Solution (Python):
import math
A,B,N = map(int,input().split())
l= min(N,B-1)
print(math.floor(A*l/B))

Solution (Python):
import math
A, B, N = map(int, input().split())


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


if B == 1 or A == 1:
    print(0)
else:
    print(f(B-1) if N >= B else f(N))

Solution (Python):
import math
A, B, N = list(map(int, input().split()))

ans = 0
if(B > N):
    ans = math.floor(A * N / B) - A * math.floor(N / B)

else:
    ans = math.floor(A * (B-1) / B) - A * math.floor((B-1)/B)

print(ans)

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

res = 0
if N < B:
    res = (A * N) // B
else:
    left = B - 1
    right = 10 ** 15
    while right - left > 1:
        mid = (right + left) // 2
        a = ((A * mid) // B) - (A * (mid // B))
        if res > a:
            right = mid
        else:
            res = a
            left = mid

print(res)

Solution (Python):
A,B,N = map(int, input().split())
p = min(N,B)

if p%B == 0:
    print(int(A*(p-1)//B))
else :
    print(int(A*(p)//B))

Solution (Python):


a, b, n = [0] * 3

def format_input(filename = None):
	global a, b, n
	if filename == None:
		a, b, n = list(map(int, input().split()))

	elif filename == '__random__':
		from random import randint as rng
		a = rng(1, 10**6)
		b = rng(1, 10**12)
		n = rng(1, 10**12)
		print(a, b, n)

def get_answer():
	answer = (a * min(b-1, n)) // b
	return answer

if __name__ == '__main__':
	format_input()

	ans = get_answer()
	print(ans)

Solution (Python):
from math import floor

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


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

answer = floor(A * x / B) - A * floor(x / B)

print(answer)

Solution (Python):
A,B,N = map(int,input().split())
m = 0
if B-1 >=N:
    print(int(A*N/B)-A*int(N/B))
else:
    print(int(A*(B-1)/B)-A*int((B-1)/B))

Solution (Python):
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()

Solution (Python):
import math

arr = input().split(" ")

a=int(arr[0])
b=int(arr[1])
n=int(arr[2])

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

print(a * x // b)

Solution (Python):
from math import floor

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


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

answer = floor(A * x / B) - A * floor(x / B)

print(answer)

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

if(B <= N):
  M = B - 1
else:
  M = N

print((A * M)//B)

Solution (Python):
from math import floor


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


def main():
    a, b, n = map(int, input().split())
    if n < min(a, b):
        print(f(n, a, b))
    elif min(a, b) <= n < max(a, b):
        print(max(f(min(a, b) - 1, a, b), f(n, a, b)))
    else:
        print(max(f(max(a, b) - 1, a, b), f(min(a, b) - 1, a, b)))


if __name__ == '__main__':
    main()

Solution (Python):
def val(a, b, x):
	return (a * x) // b - a * (x // b)

def naive(a, b, n):
	ans = 0
	for i in range(1, n + 1):
		ans = max(ans, val(a, b, i))
	return ans

def main(a, b, n):
		return max(val(a, b, n), val(a, b, max((n // b) * b - 1, 1)), val(a, b, max(n - 1, 0)))







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

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

l = 0
r = N
ans = 0


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


for i in range(10000):

    if r - l < 10:
        for x in range(max(0, l - 10), min(N + 1, r + 10)):

            
            ans = max(ans, ((A * x) // B) - (A * (x // B)))
        break

    mid = (l + r) // 2
    mid2 = (l + mid) // 2
    if calc(l) <= calc(mid2) and calc(mid2) <= calc(mid):
        l = mid
    elif calc(l) >= calc(mid2) and calc(mid2) <= calc(mid):
        r = mid
    else:
        if calc(mid2) >= calc(mid):
            r = mid

print(ans)

Solution (Python):
def main():
    a,b,n = map(int,input().split(" "))
    p = a//b
    q = a%b

    if n < b:
        print(p*n+int(q*n/b))
    else:
        print(p*(b-1)+int(q*(b-1)/b))
main()

Solution (Python):
import sys
input = sys.stdin.readline




'''
A=[]
B=[]
for i in range():
    a, b = map(int, input().split())
    A.append(a)
    B.append(b)'''


a, b, n = map(int, input().split())
x=0
score=0
cnt=0
print(max(int(a*(min(b, n)-1)/b)-a*int((min(b, n)-1)/b),
      int(a*(min(b, n))/b)-a*int((min(b, n))/b)))

Solution (Python):
from math import floor
a,b,n = map(int,input().strip().split())
ans = floor((a*n)/b)-a*floor(n/b)
if n>b:
    ans = floor((a*(b-1))/b) - a*floor((b-1)/b)
elif n==b:
    ans = floor((a*(b-1))/b) - a*floor((b-1)/b)
print(ans)

Solution (Python):

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


if __name__ == "__main__":
    solve()

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

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

Solution (Python):
from math import floor
a, b, n = [int(i) for i in input().split()]
x = min(n, b-1)
print(floor((a * x) / b) - a * floor(x / b))

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

import math

x = min([B - 1, N])
print(math.floor(A*x/B) - A*math.floor(x/B))

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

print(ans)

Solution (Python):
a,b,n = map(int,input().split())
if n < b:
  print(int((n/b - int(n/b))*a))
else:
  x = n-(n%b+1)
  print(int((x/b - int(x/b))*a))

Solution (Python):
import math

a, b, n = 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)

Solution (Python):
def main():
  A, B, N = (int(_) for _ in input().split())
  k = A * N // B
  m = int(A - A/B)
  if k >= m: print(m)
  else:
    print(k)
  return

if __name__ == '__main__':
  main()

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

x = min(b - 1, n)

print(int(a * x / b))

Solution (Python):
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))

Solution (Python):
a, b, n = map(int, input().split())
t = n // b

if t == 0:
    ans = int(a * n / b) - a * int(n / b)
else:
    ans = 0
    for i in range(t):
        x = b * i + (b - 1)
        if x > n:
            x = n
        else:
            pass
        
        tmp = int(a * x / b) - a * int(x / b)
        
        if tmp > ans:
            ans = tmp
        else:
            break

print(ans)

Solution (Python):

import sys
import math

def solve(A: int, B: int, N: int):
    print(math.floor(A*min(B-1, N)/B) - A * math.floor(min(B-1, N)/B))
    return



def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    N = int(next(tokens))  
    solve(A, B, N)

if __name__ == '__main__':
    main()

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

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

print((a * x) // b)

Solution (Python):
import math
A, B, N = map(int, input().split())
ans = math.floor(A*min(N, B-1)/B) - A*math.floor(min(N, B-1)/B)
print(ans)

Solution (Python):

def main():
    A, B, N = map(int, input().split())
    max = ((A*N)//B) - (A * (N//B))

    if B<=N:
        temp = ((A*(B-1))//B) - (A * ((B-1)//B))
        if max < temp:
            max = temp

    print(max)




if __name__ == '__main__':
    main()

Solution (Python):
a,b,n=map(int,input().split())
s=n//b
nmax = (a*n)//b - a*(n//b)









if s>0:
    x = b*s-1
    t = (a*x)//b - a*(s-1)
    if t > nmax:
        nmax = t
print(nmax)

Solution (Python):
import math
import itertools
a,b,n = map(int,input().split())
pnt = 0
maxi = 0
if n>b:
    x = b-1
elif n ==b:
    x = n-1
else:
    x = n


pnt = math.floor(a*x/b) - a*math.floor(x/b)
print(pnt)

Solution (Python):
A,B,N=list(map(int,input().split()))
list_ans=[]
minimum=min(B-1,N)
print(int(A*minimum/B)-A*int(minimum/B))

Solution (Python):
def main():
    a, b, n = map(int, input().split())

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

if __name__ == '__main__':
    main()

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

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

answer = (a*n)//b - a*(n//b)
answer_x = 0

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

answer = max(answer, answer_x)


print(answer)

Solution (Python):
def input_int():
    return map(int, input().split())

def one_int():
    return int(input())

def one_str():
    return input()

def many_int():
    return list(map(int, input().split()))

from decimal import Decimal

A, B, N = input_int()



X = B-1 if N >=B-1 else N

print(int(Decimal(A)*Decimal(X)/Decimal(B)))

Solution (Python):
a,b,n = map(int,input().split())
c = 0
if n >=b:
    i = b-1
else:
    i =n
ans = int(a*i/b)-a*int(i/b)
print(ans)

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


def f(n):
    return (A*n) // B - A * (n//B)


if B > N:
    print(f(N))
else:
    ans = f(N)
    N = N // B * B - 1
    ans = max(ans, f(N))
    print(ans)

Solution (Python):
def main():
    a,b,n = map(int,input().split())

    x = min(n,b-1)
    print(int(a*x/b)-a*int(x/b))


if __name__ == '__main__':
    main()

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

import math


x = min(N, B - 1)
ans = math.floor(A*x/B) - A * math.floor(x/B)
print(ans)

Solution (Python):
import math
A,B,N=input().split()
A=int(A)
B=int(B)
N=int(N)
if (1<=A<=10**6)and(1<=B<=10**12)and(1<=N<=10**12):
    if N<B:
        a=A*N/B
        a=math.floor(a)
        print(a)
    if N>=B:
        c=A-(A/B)
        c=math.floor(c)
        print(c)

Solution (Python):
import numpy as np
str = input()
lst = str.split()
a = int(lst[0])
b = int(lst[1])
c = int(lst[2])
if b > c:
    print(int(a*c/b)-int(c/b)*a)
else:
    d = int(c/b)
    if d > 100:
      d = 100
    lst = np.zeros(d)
    for i in range(d):
        k = b*(i+1)-1
        lst[i] = int(a*k/b)-int(k/b)*a
    print(int(np.max(lst)))

Solution (Python):
A,B,N = map(int,input().split())
ans = 0
if B > N:
    ans = A * N // B - A * (N // B) 

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

Solution (Python):
A,B,N = map(int, input().split(' '))
p = min(N,B)
if p%B == 0:
    print(int(A*(p-1)/B))
else :
    print(int(A*(p)/B))

Solution (Python):
A,B,N=map(int,input().split())
maxi=-10**9

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

Solution (Python):
from math import floor
def main():
    A,B,N=map(int,input().split())
    print(floor(A*min(N,(B-1))/B))
main()

Solution (Python):
line = input().split(" ")
A = int(line[0])
B = int(line[1])
N = int(line[2])
max = 0
if B<N:
    K = B
    for i in range(-1, 2):
       if max< (int(A * (K + i) / B) - A * int((K + i) / B)):
           max = int(A * (K + i) / B) - A * int((K + i) / B)
else:
    K = N
    for i in range(-1, 1):
        if max< (int(A * (K + i) / B) - A * int((K + i) / B)):
            max = int(A * (K + i) / B) - A * int((K + i) / B)
print(max)

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

if b > n:
    x = n
else:
    x = n // b * b - 1
answer = max(0, (a*x)//b - a*(x//b))

print(answer)

Solution (Python):
a,b,c=map(int,input().split())
ans=0
i=1
if b-1>c:
    print(a*c//b-a*(c//b))
else:
    print(a*(b-1)//b-a*((b-1)//b))

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

Solution (Python):
a, b, n = map(int, input().split())
 
cand = []
 
def calc(n):
  return int(a*n/b)-a*int(n/b)
 
cand.append(calc(0))
cand.append(calc(1))
cand.append(calc(n))
cand.append(calc(max(0, n-1)))
cand.append(calc(max(0, b*(n//b) - 1)))
cand.append(calc(min(n, max(0, b-1))))

if b == 1:
  print(0)
else:
  print(max(cand))

Solution (Python):
from math import floor
a,b,n = map(int,input().split())
ans = 0
if n <= b:
    for i in range(max(0,n-9),n+1):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
else:
    for i in range(max(0,b-10),min(n,b+10)):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans)

Solution (Python):
A, B, N = map(int, input().split())
answer = 0

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

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

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

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

if b == 1:
    print(0);exit()

l = 0
r = n
while r - l > 100:
    rr = (l + 2*r)//3
    ll = (2*l + r)//3
    if f(ll) > f(rr):
        r = rr
    elif f(ll) < f(rr):
        l = ll
    else:
        l = ll

ans = -100
for i in range(l,r+1):
    ans = max(ans,f(i))
print(ans)

Solution (Python):
import numpy


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

x = min(N, B - 1)
s1 = int(numpy.floor(A * x / B))
s2 = A * int(numpy.floor(x / B))
print(s1 - s2)

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

Solution (Python):
a,b,n=map(int,input().split())
if b>n:
    x=n
else:
    x=b-1

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

Solution (Python):

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

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

Solution (Python):
import math
a, b, n = map(int, input().split())
if b <= n:
    print(math.floor((a * (b-1)) / b) - a * math.floor((b-1) / b))
elif b > n:
    print(math.floor((a * (n)) / b) - a * math.floor((n) / b))

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

Solution (Python):
import sys
sys.setrecursionlimit(100000000)


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

    
    print(int(a * min((b-1), n) / b))


main()

Solution (Python):
import math

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

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

Solution (Python):
import math

A,B,N = map(int,input().split())
if B>N:
  print( math.floor(A*N/B) - A * math.floor(N/B))
  exit()
print( math.floor(A*(B-1)/B) - A * math.floor((B-1)/B))

Solution (Python):
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))

Solution (Python):

A,B,N=map(int,input().split())
b=[]
if N>=B:
    b.append((N//B)*B-1)
b.append(N)
a=0
for x in b:
    p=(A*x)//B-A*(x//B)
    if p>a:
        a=p
print(a)

Solution (Python):
def f(x):
    global A, B
    return (A*x) // B - A * (x // B)

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

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

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

print(int(a*x/b) - a*int(x/b))

Solution (Python):
from math import floor


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

Solution (Python):
a, b, n = map(int, input().split())
def f(x):
    return int(a*x/b) - a*int(x/b)
if b-1 <= n:
    print(f(b-1))
else:
    print(f(n))

Solution (Python):
import sys
import math
A,B,N=map(int, sys.stdin.readline().split())

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

if B-1<=N:
    print func(B-1)
else:
    print func(N)

Solution (Python):
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
MOD = 10**9 + 7

A, B, N = MAP()

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

Solution (Python):
a,b,n = map(int,input().split())
x = min(b-1,n)
print((a*x)//b+a*(x//b))

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

Solution (Python):
import numpy as np

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

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

print(ans)

Solution (Python):
import math
A, B, N = list(map(int,input().split()))

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

if B > N:
    print(keisan(A, B, N))
else:
    print(keisan(A, B, B-1))

Solution (Python):
import math
A, B, N = map(int, input().split())

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

if B > N:
    ans = calc(N)
else:
    ans = calc(B-1)
print(ans)

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

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

ans = (A*x)//B
if B == 1:
    ans = 0

print(ans)

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

if B<=A:
    ans = 0
    for x in range(min(B, N+1)):
        ans = max(ans, A*x//B-x//B*A)
else:
    x = min(N, B-1)
    ans = A*x//B

print(ans)

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

tmp = min(b-1, n)
print(int(a*tmp/b)-a*int(tmp/b))

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

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

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

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

Solution (Python):
def main():
    a,b,n=map(int,input().split())
    if n>=b-1:
        print((a*(b-1))//b)
    else:
        print((a*n)//b)
    
if __name__=='__main__':
    main()

Solution (Python):
A, B, N = map(int, input().split())
result = 0

if N >= B - 1:
    x = B - 1
else:
    x = N
for a in range(1, A):
    if int(x/B + a/A) - int(x/B) != 0:
        result += 1

print(result)

Solution (Python):
from math import floor
a,b,n = map(int, input().split())
if n >= b:
    x = b-1
else:
    x = n
print(floor(x*a/b) - a*floor(x/b))

Solution (Python):
import math
A,B,N = map(int,input().split())

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

Solution (Python):
import math

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

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

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

Solution (Python):
import math

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

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

if n < b:
    print(math.floor(a * n / b))
    exit(0)
print(f(a, b, b - 1))

Solution (Python):


import math
inp = input().split(' ')
A, B, N = int(inp[0]), int(inp[1]), int(inp[2])

alpha, beta = math.floor(A/B), A%B
if B-1 < N:
    x = B-1
else:
    x = N
    
print(math.floor(A*x/B) - A * math.floor(x/B))

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

res = 0
if N < B:
    res = int((A * N) / B)
else:
    res = int((A * (B - 1)) / B)

print(res)

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












if N>=B:
    x = B-1
else:
    x = N
res = int(A*x/B) - A * int(x/B)

print(res)

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

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

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

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

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 8)

input = sys.stdin.readline


def main():
    A, B, N = [int(x) for x in input().split()]

    def f(m):
        return (A * m) // B - A * (m // B)

    l = f(0)
    e = f(N)

    def isOK(mid):
        if f(mid) - l >= 0:
            return True
        else:
            return False
    def isOK2(mid):
        if f(mid) - e >= 0:
            return True
        else:
            return False

    ok = 0
    ng = N + 1

    loopn = 0

    while abs(ok - ng) > 1:
        loopn += 1
        if loopn >= 10 ** 6:
            break
        mid = (ok + ng) // 2
        if isOK(mid):
            ok = mid
        else:
            ng = mid

    ans = max(l, e, f(ok))
    for i in range(max(0, ok - 10000), min(N + 1, ok + 10000)):
        ans = max(ans, f(i))
    for i in range(max(0, ng - 10000), min(N + 1, ng + 10000)):
        ans = max(ans, f(i))

    ok = N
    ng = 0

    loopn = 0

    while abs(ok - ng) > 1:
        loopn += 1
        if loopn >= 10 ** 6:
            break
        mid = (ok + ng) // 2
        if isOK2(mid):
            ok = mid
        else:
            ng = mid

    ans = max(ans, l, e, f(ok))
    for i in range(max(0, ok - 10000), min(N + 1, ok + 10000)):
        ans = max(ans, f(i))
    for i in range(max(0, ng - 10000), min(N + 1, ng + 10000)):
        ans = max(ans, f(i))

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


if __name__ == '__main__':
    main()

Solution (Python):
from math import floor
a,b,n = map(int,input().split())
ans = 0
if n <= b:
    for i in range(max(0,n-9),n+1):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
else:
    for i in range(max(0,b-10),min(n,b+10)):
        ans = max(ans,floor(a*i/b) - a*floor(i/b))
print(ans)

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

max = 0
if b - 1 > n:
    x = n
else:
    x = b - 1

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

print(max)

Solution (Python):
A,B,N=map(int, input().split())
answer=0
import math
if N < B:
    print(int(math.modf(N/B)[0]*A))
else:
    apple=min(B,N)
    startnum = B-1 if B>1 else 1
    for i in range(startnum,apple+1):
        newans=math.modf(i/B)[0]*A
        newans//=1
        answer=newans if newans>answer else answer
    print(int(answer))

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

Solution (Python):

import math



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

x = 1

num = math.floor(n/b)

if num == 0:
    x = n
    print(math.floor(a*x/b)-a*math.floor(x/b))
    exit()
if num >= 100000:
    print(b-1)
    exit()
else:
    ans = 0
    for i in range(1,num+1):
        x = b*i-1
        ans = max(ans,math.floor(a*x/b)-a*math.floor(x/b))
print(ans)

Solution (Python):
import sys
import math

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

floor = math.floor

def f(x):
    global A, B
    return floor(A*x/B) - A*floor(x/B)

def l(x):
    global A, B
    return floor(A*x/B)

def r(x):
    global A, B
    return A*floor(x/B)

def main():
    global A, B
    A, B, N = map(int, readline().split())
    
    
    if B == 1:
        ans = 0
    elif N >= B:
        x = B - 1
        ans = f(x)
    else:
        x = N
        ans = f(x)
    print(ans)


if __name__ == "__main__":
    main()

Solution (Python):
A,B,N=map(int,input().split())
if N>=B:
	x=(N//B)*B-1
	t=B-1
	ans=max((A*x)//B-A*(x//B),(A*t)//B-A*(t//B))
	print(ans)
else:
	print((A*N)//B-A*(N//B))

Solution (Python):
import math
A,B,N=map(int,input().split())
def D_func(x):
    return math.floor(A*x/B)-A*math.floor(x/B)
print(D_func(min(B-1,N)))

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

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

Solution (Python):
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))

Solution (Python):
def abc165_d():
  a, b, n = map(int, input().split())

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

  if n >= b-1:
    ans = F(b-1)
  else:
    ans = F(n)

  print(ans)

abc165_d()

Solution (Python):
a,b,n = map(int,input().split())
def floor(c,d):
    return c//d
e = 0
if n >= b:
    e = b-1
else:
    e = n
ans = floor(e*a,b) - a * (floor(e,b))
print(ans)

Solution (Python):
a, b, n = map(int, input().split())
import math
ans = 0
if b - 1 <= n:
    x = b - 1
    ans = math.floor(a * x / b)
else:
    x = n
    ans = math.floor(a * x / b) - a * math.floor(x / b)
    
print(ans)

Solution (Python):
import math
a, b , n = map(int, input().split())
score = 0
max_score = 0
if b-1 <= n:
  score = math.floor(a*(b-1)/b) - a*math.floor((b-1)/b)
  if score > max_score:
    max_score = score
else:
  score = math.floor(a*n/b) - a*math.floor(n/b)
  if score > max_score:
    max_score = score

print(max_score)

Solution (Python):
import math

def calc(a,b,x):
    return math.floor(a*x/b) - a*math.floor(x/b)
    
def main():
    A,B,N = [int(x) for x in input().split()]
    if N < B:
        print(calc(A,B,N))
    else:
        print(calc(A,B,B-1))

if __name__ == '__main__':
    main()

Solution (Python):
from math import floor,ceil
import fractions
import collections
import itertools
from collections import deque
A,B,N=map(int,input().split())

piv=B/A  








cnt=0

if A<=B:
    if N>=B-1:
        print(A-1)
    else:
        if ceil(piv)*(B%A)>N:
            print(floor(N/ceil(piv)))
        else:
            N=N-ceil(piv)*(B%A)
            
            cnt=(B%A)
            print(cnt+N//floor(piv))
else:  
    l=[0]
    for i in range(1,B):
        l.append(max(l[i-1],floor(A*i/B)-A*floor(i/B)))
    
    if N>=len(l):
        print(l[len(l)-1])
    else:
        print(l[N])

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

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

Solution (Python):
a,b,n=map(int,input().split())
l=[]
m=a//b
if b==1:
    print(0)
    exit()
if n>=b:
    for x in range(b-1,n+1,b):
        y=a*x//b-a*(x//b)
        
        m=max(m,y)
    x=n
    y=a*x//b-a*(x//b)
    m=max(m,y)
else:
    x=n
    y=a*x//b-a*(x//b)
    
    xx=n-1
    yy=a*xx//b-a*(xx//b)
    m=max(y,yy)


print(m)

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

if b > n:
    x = n
else:

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

print(ans)

Solution (Python):
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))

Solution (Python):
import sys


def solve(A: int, B: int, N: int):

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

    m = (A*x // B) - A * (x // B)

    print(m)

    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    A = int(next(tokens))  
    B = int(next(tokens))  
    N = int(next(tokens))  
    solve(A, B, N)

if __name__ == '__main__':
    main()

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

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

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

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

Solution (Python):
import sys
sys.setrecursionlimit(300000)

def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LMI(): return list(map(int, sys.stdin.readline().split()))
MOD = 10 ** 9 + 7
INF = float('inf')



A, B, N = MI()

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

Solution (Python):




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


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


print(ans)

Solution (Python):
a,b,n=[int(i) for i in input().split()]
p=a//b
q=a%b
mu=min(b-1,n)

print(p*mu+q*mu//b)

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

if N < B:
    print((A*N)//B)
else:
    qa, ra = divmod(A, B)
    rx = B-1
    print(qa*rx + (ra*rx)//B)

Solution (Python):
a, b, n = [int(i) for i in input().split()]
max = 0
if n >= b:
	x = b-1
else:
	x = n
max = a*x//b - a*(x//b)
print(max)

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

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

print(ans)

Solution (Python):
a, b, n = map(int, input().split())
import math
c = math.floor(a*n/b)
d = math.floor(n/b)
e = a*d
f = math.floor(a*(b-1)/b)
g = math.floor((b-1)/b)
h = a*g
if n < b:
  print(c - e)
else:
  print(f - h)