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):
a,b,n = map(int,input().split())

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

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

Solution (Python):
A, B, N = [int(s) for s in input().split()]
if N >= B - 1:
    x = B - 1
else:
    x = N
ans = A * x // B - A * (x // B)
print(ans)

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

Solution (Python):
import numpy as np
a,b,n = map(int,input().split())
ans = 0
if b == 1:
    print(0)
    exit()
else:
    for k in range(1,int(n/b)+1+1):
        if k*b -1 <= n :
        
            ans = max(ans, np.floor(a*(k*b-1)/b) - a * (k-1))
        else:
        
            ans = max(ans, np.floor(a*n/b) - a*(k-1))
        
print(int(ans))

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

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

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

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

Solution (Python):
a,b,N = map(int,input().split())
x =b-1
if x<N:
        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())
result = 0
x = min(N,B -1)
a = (A*x)//B
b = A*(x//B)
result = max(result,a-b)
print(result)

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

Solution (Python):


import sys
import math
import collections
import itertools
INF = 10 ** 13
MOD = 10 ** 9 + 7
def input() : return sys.stdin.readline().strip()
def lcm(x, y) : return (x * y) // math.gcd(x, y)
def I() : return int(input())
def LI() : return [int(x) for x in input().split()]
def RI(N) : return [int(input()) for _ in range(N)]
def LRI(N) : return [[int(x) for x in input().split()] for _ in range(N)]
def LS() : return input().split()
def RS(N) : return [input() for _ in range(N)]
def LRS(N) : return [input().split() for _ in range(N)]
def PL(L) : print(*L, sep="\n")
def YesNo(B) : print("Yes" if B else "No")
def YESNO(B) : print("YES" if B else "NO")

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





A, B, N = LI()







if N < B:
    print(F(A, B, N))
else:
    print(F(A, B, B-1))

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

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

Solution (Python):
from math import floor

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

if a == 1 or b == 1:
    print(0)
elif n < b:
    print(floor(a*n/b))
else:
    print(floor(a*(b-1)/b))

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

n = min(n, b-1)

print(math.floor(a * n / b) - a * math.floor(n / b))

Solution (Python):
import math

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

Solution (Python):
A, B, N = input().split()
A = float(A)
B = float(B)
N = float(N)
import math
value = math.floor(A*(B-1)/B)
a = int(math.floor(A*N/B)-A*math.floor(N/B))
if N < B-1:
  print(a)
else:
  print(value)

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

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

if A%B==0:
    print(0)
elif N<B:
    print((A*N)//B)
else:
    print((A*(B-1)//B-A*((B-1)//B)))

Solution (Python):
a,b,N = [int(x) for x in input().split()]
print(a * min(b-1,N) // b)

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

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

if b > n:
    print(int((a * n) / b))
else:
    print(int((a * (b - 1)) / 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))
    exit()

else:
    print(math.floor(A*(N)/B)-A*math.floor((N)/B))
    exit()

Solution (Python):


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

f1 = 0
f2 = 0
if N >=B:
    f1 = int(A*(B-1)/B)
    f2 = A*int((B-1)/B)
else:
    f1 = int(A*N/B)
    f2 = A*int(N/B)

ans = f1-f2
print(ans)

Solution (Python):
import math
A, B, N = [int(x) for x in input().split(" ")]

def func(A, B, x):
    return math.floor(A*x/B) - A * math.floor(x/B)
    
if B > N:
    print(func(A, B, N))
elif B == N:
    print(func(A, B, N - 1))
else:
    print(func(A, B, B - 1))

Solution (Python):


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

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

    
    if B > N:
        print(f(N))
    else:
        print(f(B-1))



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

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

    
    left, right = 1, N
    cnt = 500
    ans = 0
    while cnt > 0:
        cnt -= 1
        c1, c2 = (2*left+right)//3, (left+2*right)//3

        ret1, ret2 = f(c1), f(c2)

        if ret1 > ret2:
            ans = max(ans, ret1)
            right = c2
            continue
        elif ret1 < ret2:
            ans = max(ans, ret2)
            left = c1
            continue

    print(ans)




if __name__ == "__main__":
    solve()

Solution (Python):
import sys

stdin = sys.stdin
inf = 1 << 60
mod = 1000000007

ni      = lambda: int(ns())
nin     = lambda y: [ni() for _ in range(y)]
na      = lambda: list(map(int, stdin.readline().split()))
nan     = lambda y: [na() for _ in range(y)]
nf      = lambda: float(ns())
nfn     = lambda y: [nf() for _ in range(y)]
nfa     = lambda: list(map(float, stdin.readline().split()))
nfan    = lambda y: [nfa() for _ in range(y)]
ns      = lambda: stdin.readline().rstrip()
nsn     = lambda y: [ns() for _ in range(y)]
ncl     = lambda y: [list(ns()) for _ in range(y)]
nas     = lambda: stdin.readline().split()

from math import floor

a, b, n = na()

x = min(b - 1, n)

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

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

m=0

x=min(n,b-1)
r=x//b
d=x/b-r

print(int(a*d))

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

max_n = min([N,B-1])
ans = (A*max_n)//B - A*(max_n//B)

print(ans)

Solution (Python):
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())
if a <= b:
    if n >= b:
        ans=(a*(b-1))//b
    else:
        ans=(a*n)//b - a*(n//b)
else:
    if n >= b:
        ans=(a*(b-1))//b
    else:
        ans=(a*n)//b - a*(n//b)
print(ans)

Solution (Python):
a, b, n = list(map(int, input().split(' ')))
x = 0








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

if b == 1:
    ans = 0

print(ans)

Solution (Python):
import math
A, B, N = list(map(int, input().split()))
ans = 0
if B+1 < N:
    C = B+1
else:
    C = N
if B//A == 0:
    D = 1
elif B//A > 1:
  	D = B//A-1
else:
    D = B//A
for i in range(1, C+1, D):
    val = math.floor(A*i/B) - A*math.floor(i/B)
    
    ans = max(ans, val)

print(ans)

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

Solution (Python):
from math import floor

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

A=min(b-1,n)
print(floor(a*(A)//b))

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









if N < B:
    if N % B == 0:
        x = N-1
    else:
        x = N
        
else:
    x = (N//B)*B-1

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

Solution (Python):
A, B, N = [int(i) for i in input().split()]
if B == 1:
    max = 0
elif B > N:
    x = N
    max = ((A * x) // B) - A * (x // B)
else:
    x = N
    maxn = ((A * x) // B) - A * (x // B)
    x = B * (N // B) - 1
    maxx = ((A * x) // B) - A * (x // B)
    if maxx > maxn:
        max = maxx
    else:
        max = maxn

print(max)

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

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

Solution (Python):
from sys import stdin,stdout
input=stdin.buffer.readline

ip=[int(x) for x in input().split()]
a=ip[0]
b=ip[1]
n=ip[2]
if n<b:
	print(((a*n)//b)-a*(n//b))
else:
	x=n-(n%b)-1
	a1=((a*n)//b)-a*(n//b)
	a2=((a*x)//b)-a*(x//b)
	print(max(a1,a2))

Solution (Python):
a, b, n = map(int, input().split())
 
tmp = 0
for x in (range(1, b+1, b-2) if b<=n else range(1, n+1, n-1)):

    calc = a*x//b - a*(x//b)
    if calc > tmp:
        tmp = calc
 
print(tmp)

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

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

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

else:
    answer = (A*(B-1)/B)//1 - A*(((B-1)/B)//1)

print(int(answer))

Solution (Python):

import sys
import math
import numpy as np
import itertools


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









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

print(m)

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

  
print(int(m*k))

Solution (Python):
from collections import  *
def io():
    return map(int,input().split())
def op():
    return list(map(int,input().split()))
a,b,c=io()
def cal(a,b,x):
    print(((a * x) // b) - (a * (x//b)))
if c>b:
    x=c-(c%b)-1
    cal(a,b,x)
elif b==c:
    cal(a,b,b-1)
else:
    cal(a,b,c)

Solution (Python):
import math
tmp = input().split()
A = int(tmp[0])
B = int(tmp[1])
N = int(tmp[2])
Mmax = 0

if N%B == 0:
    ANS = math.floor(A*(B-1)/B)
elif N > B:
    ANS = math.floor(A*(B-1)/B)
else:
    ANS = math.floor(A*N/B)

print(int(ANS))

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


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

Solution (Python):
from math import floor
from typing import NoReturn


def calc_equation(a: int, b: int, x:int) -> int:
    return floor(a * x / b) - a * floor(x / b)


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

    if b > n:
        print(calc_equation(a, b, n))
    else:
        print(calc_equation(a, b, b - 1))


if __name__ == '__main__':
    main()

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

Solution (Python):
import math
A, B, N = [int(s) for s in input().split()]

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

Solution (Python):
def main():
    import sys
    import math
    sys.setrecursionlimit(10 ** 6)
    input = sys.stdin.readline
    A, B, N = [int(x) for x in input().strip().split()]
    ans = 0
    for x in range(min(N, B), max(min(N, B)-A-1, -1), -1):
        ans = max(ans, math.floor((A*x)/B)-A*math.floor(x/B), 0)
    
    print(ans)


if __name__ == '__main__':
    main()

Solution (Python):
inputs = input().split(' ')
a = int(inputs[0])
b = int(inputs[1])
n = int(inputs[2]) + 1

x = (n if n < b else b) - 1
output = (a*x//b)

print(output)

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



m=0
if B<=N:
    m=int(A * (B-1) / B)
    print(m)

else:
    m=int(A * N / B)
    print(m)

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

Solution (Python):
import math
import sys
def input():
    return sys.stdin.readline().rstrip('\n')

def calc(A, B, N):
    x = min(B - 1, N)
    return math.floor(A * x / B)

(A, B, N) = tuple([int(s) for s in input().split()])
print(calc(A, B, N))

Solution (Python):

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

mx = 0

nn = n//b

mm = (a*n)//b - a*(nn)

if nn > 0:
    x = b*nn-1
    mx = (a*x)//b - a*(nn-1)
    mm = max(mm, mx)
    
print(mm)

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

Solution (Python):

"""
@author: H_Hoshigi
"""
import math
A, B, N = map(int, input().split())

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

def main():
    print(f(min(N, B-1)))

if __name__ == "__main__":
    main()

Solution (Python):
import math

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

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

if b==1:
    print(0)
elif b-1 <= n:
    print(a-math.ceil(a/b))
else:
    print(calc(a,b,n))

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

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

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

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

print(ans)

Solution (Python):
A, B, N = [int(_) for _ in input().split()]
x = min(B - 1, N)
print((A * x) // B - A * (x // B))

Solution (Python):

import sys
from math import floor
import itertools
import collections

def solve(A,B,N):
    if(B > N):
        x = N
    else:
        x = B - 1
    return floor((A*x)/B) - A * floor(x/B)








def main():
    A,B,N = map(int,input().split())
    
    print(solve(A,B,N))
    
if __name__ == '__main__':
   main()

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

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

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

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

print(ans)

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

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

Solution (Python):
a,b,n=map(int,input().split())
i=b-1
ans=(min(n,b-1)*a)//b;
while(i<=n):
    if((i*a)//b-a*(i//b)<=ans):
        break;
    ans=max(ans,(i*a)//b-a*(i//b));
    print(ans+"\n")
    i+=b;
print(ans);

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 math
from sys import stdin


def get_result(data):
    A, B, N = data
    if B == 1:
        return 0
    length = N//B+1
    x = [B*(i+1)-1 for i in range(length)]
    ans = []
    for val in x:
        if val > N:
            val = N
        ans.append(math.floor(A*val/B) - A*math.floor(val/B))
    return max(ans)


if __name__ == '__main__':
    data = list(map(int, stdin.readline().rstrip().split(' ')))
    result = get_result(data)
    print(result)

Solution (Python):
import math
A,B,N = list(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))

Solution (Python):
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce
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()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B, N = MAP()

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

if N < B:
	print(f(N))
else:
	k = (N-B+1)//B
	print(f(B-1+k*B))

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

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

Solution (Python):
import sys
import math
sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


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

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


if __name__ == '__main__':
    resolve()

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

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

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

Solution (Python):
from math import *
A,B,N=[int(i) for i in input().split()]
f = lambda k:floor(A*k/B)
if B-1 < N:
    print(f(B-1))
else:
    print(f(N))

Solution (Python):
import sys
import math  
import bisect  
import queue  


def input():
    return sys.stdin.readline().rstrip()


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

    if N < B:
        res = (A * N) // B
        return print(res)

    x = (N // B) * B - 1
    res = (A * x) // B - A * (x // B)
    print(res)


if __name__ == '__main__':
    main()

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

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

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

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

print(ret)

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

Solution (Python):


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

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

Solution (Python):
def f(a, b, n):
    return ((a*n) // b) - a*(n//b)


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

Solution (Python):
a, b, n = map(int, input().split())
ans = 0
e = min(n+1,b)
s = max(int(b/a),e-1000)
for i in range(s, e):
  x = (int(a*i/b)-a*int(i/b))
  if ans < x:
    ans = x
print(ans)

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

temp = a * b // math.gcd(a, b) - 1
temp1 = n - (n % b + 1) if n%b != n else n
temp = min(temp, temp1)

ans = (a * temp)//b - a * (temp//b)
print(ans)

Solution (Python):


import sys
import pprint

sys.setrecursionlimit(10 ** 6)

class Logger:
	def __init__(self, debug):
		self.debug = debug
	def print(self, *args):
		if self.debug:
			pprint.pprint(args)


def main():
	log = Logger(1)
	a, b, n = map(int, sys.stdin.readline().split())
	if n < b:
		print(int((n/b - int(n/b))*a))
	else:
		print(int(((b-1)/b - int((b-1)/b))*a))

	


main()

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

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

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

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

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

Solution (Python):
import math

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

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

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

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

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

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

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

c = 0
ans = 0

if N < 1000001:
  for i in range(1,N+1):
    c = int(A*i/B) - A*int(i/B)
    if ans < c:
      ans = c

elif N < B:
  ans = int(A*N/B) - A*int(N/B)
      
else:
  count = B-1
  for i in range(10000):
    c = int(A*count/B) - A*int(count/B)
    if ans < c:
      ans = c
    count += B
    
print(int(ans))

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

if(n>=b):
  if((n+1)%b == 0):
    q = (n+1)/b - (n+1)//b
  else:
    tmp = (n//b)*b - 1
    q = tmp/b -tmp//b
else:
  q = n/b

print(int(a*q))

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

Solution (Python):

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

Solution (Python):
def calc(x):
    if x >= 0:
        return (A*x)//B-A*(x//B)
    else:
        return 0


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

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

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

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


floor_num=[]

if N >=B:
    floor_num.append(int(A*(B-1)/B))
else:  

        floor_num.append(int(A*N/B))


print(max(floor_num))

Solution (Python):
import math
a,b,n=map(int,input().split())
checklist=[]


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

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

c = min(n, b - 1)
for i in range(c, max(c-a-1, -1), -1):
    v = (a * i // b) - a * (i // b)
    max_v = max(max_v, v)
print(max_v)

Solution (Python):
import math

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

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

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

Solution (Python):
import math
A, B, N = map(int, input().split())
x = N // 2
def floor(t):
    return math.floor(t)
li = []
if B < N:
    print(floor((A*(B - 1)) / B) - A * floor((B - 1)/B))
elif B == N:
    print(floor((A*(N - 1)) / B) - A * floor((N - 1)/B))
else:
    print(floor((A*(N)) / B) - A * floor((N)/B))

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

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






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

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













    







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

Solution (Python):
import math
A,B,N=map(int,input().split())
if(N<B):
    x = N
else:
    x =B-1    

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

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

Solution (Python):
import math

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

    if n >= b:
        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))

main()

Solution (Python):
import math
a, b, n = map(int, input().split())
for i in range(a-1, -1, -1):
    if math.floor(b * i / a) + 1 < (i + 1) * b / a:
        if math.floor(b * i / a) + 1<=n:
            print(i)
            exit()
print(0)

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

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

Solution (Python):

import sys


def solve(A: int, B: int, N: int):
    if B > N:
        x = N
    else:
        x = B - 1
    print(A * x // 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())
ans=0
t=min(B+1,N+1)

for x in range(t-2,t):
    a=int(A*x/B)
    b=A * int(x/B)
    ans=max(ans,a-b)

print(ans)

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

Solution (Python):


from math import floor

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

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










print(mx)

Solution (Python):
import math


def task(a, b, n):
    x = min(b - 1, n)
    print(math.floor(a * x / b) - a * math.floor(x / b))


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

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

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

Solution (Python):
import math

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

x = min(B-1 , N)

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

print(result)

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

m = 0
num = math.ceil(b/a)
for i in range(1, b+1, num):
    if n < i:
        break
    a_part = int(a * i / b)
    b_part = a * int(i/b)

    result = a_part - b_part
    if m <= result:
        m = result
    else:
        break

print(m)

Solution (Python):
A, B, N = map(int,input().split())
mmax=0
N_max = N if B > N else B
for n in reversed(range(N_max - A, N_max + 1)):
    _max = int(A*n/B)-(A*int(n/B))
    if mmax < _max:
        mmax=_max

print(mmax)

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

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

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

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

Solution (Python):
a,b,n = map(int,input().split())
ans = 0
ans = max(int(a*n/b) - a*int(n/b),ans)
if b == 1:
    print(0)
else:
    for k in range(1,n//(b-1)+1):
        ans = max(int(a*(k*b-1)/b) - a*int((k*b-1)/b),ans)
        if ans == a:
            print(ans)
            break
    if ans != a:
        print(ans)

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

N = min(t, B-1)
x = int(A * N / B)
y = A * int(N / B)
print(x-y)

Solution (Python):
import math


nums = [int(e) for e in input().split()]

a = nums[0]
b = nums[1]
n = nums[2]

max_score = -1
score = -1








if b > n:
    max_score = math.floor(a*n/b)
else:
    max_score = math.floor(a*(b-1)/b)

print(max_score)

Solution (Python):
a,b,n = map(int,input().split())
import math
def f(x):
    return math.floor(a*x/b)-a*math.floor(x/b)

if a<= 2 and  b <= 2:
    print(0)
elif a <= b and n >=b:
    print(f(b-1))
elif a<= b and n < b:
    print(f(n))
elif a>b and n >= b:
    print(f(b-1))
elif a>b and n < b:
    print(f(n))

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

if N < B:
    ans = ((A*N)//B) - A*(N//B)
elif B <= N < 2*B:
    ans = max((((A*N)//B) - A*(N//B)), (((A*(B-1))//B) - A*((B-1)//B)))
elif 2*B <= N:
    ans = max((((A*(B-1))//B) - A*((B-1)//B)), (((A*(2*B-1))//B) - A*((2*B-1)//B)), (((A*(3*B-1))//B) - A*((3*B-1)//B)))

print(ans)

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())
x = 0
ans = 0
if b > n:
    x = n
    ans = math.floor(a*n/b) - a*math.floor(n/b)
else:
    n = b-1
    ans = math.floor(a*n/b) - a*math.floor(n/b)
print(ans)

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

a,b,x=MAP()

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

if b<=x:
    print(f(b-1))
else:
    print(f(x))

Solution (Python):


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

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())
ans=0
if n//b>0:
  print((b-1)*a//b)
else:
  print(n*a//b)

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

import math

def main():
    a,b,n = 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) - a*math.floor((b-1)/b))

if __name__ == '__main__':
    main()

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