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())
fivex = 0
i = 1
ans = 0
x = 0





while x <= B:
    x = -((-1)*i*B // A)
    if x > N:
        break
    now = i - A *  int(x / B)
    if now > ans and x <= N:
        
        ans = now
    i += 1

print(ans)

Solution (Python):
import sys
import numpy as np
import re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
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(str, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
import math


A, B, N = MAP()


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


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

Solution (Python):
import math

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

m = 0
n = 1

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

while n<N:
  c = B*(math.floor((n+1)/B)+1)-1
  n = min(N, c)
  m = max(cal(n), m)
  if (A*n)%B == 0:
    break
  
print(m)

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

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

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

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

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

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

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(i) for i in input().split()]
x=min(b-1,n)
print(math.floor(a*x/b)-x*math.floor(x/b))

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
import math
input = sys.stdin.readline


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

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

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

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

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

Solution (Python):
import math

A, B, N = map(int, input().split())
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 = 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)))

Solution (Python):


A, B, N = [int(x) for x in input().split()]
best = (A * (min(N, B - 1) % B)) // B
print(best)

Solution (Python):


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

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

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


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

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

Solution (Python):
from math import floor

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

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

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

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

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

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

else:
    if N % B == 0:
        x = B-1
    else:
        x = B-1

ans = math.modf((x/B))[0]*A
print(int(ans))

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

if A == 1:
    print(0)
    exit()

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

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

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

Solution (Python):
import sys
import math
from decimal import Decimal, ROUND_HALF_UP, ROUND_HALF_EVEN
from collections import deque
def I(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI2(N): return [list(map(int, sys.stdin.readline().split())) for i in range(N)]
def S(): return sys.stdin.readline().rstrip()
def LS(): return sys.stdin.readline().split()
def LS2(N): return [sys.stdin.readline().split() for i in range(N)]
def FILL(i,h): return [i for j in range(h)]
def FILL2(i,h,w): return [FILL(i,w) for j in range(h)]
def FILL3(i,h,w,d): return [FILL2(i,w,d) for j in range(h)]
def FILL4(i,h,w,d,d2): return [FILL3(i,w,d,d2) for j in range(h)]
def sisha(num,digit): return Decimal(str(num)).quantize(Decimal(digit),rounding=ROUND_HALF_UP)

MOD = 1000000007
INF = float("inf")
sys.setrecursionlimit(10**5+10)
input = sys.stdin.readline

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

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

def floor(A,B,x):
    num=int(A*x/B)
    return num

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

f1=floor(a,b,x)
f2=a*floor(1,b,x)
print(f1-f2)

Solution (Python):
a, b, n = map(int, input().split())
r = min(n, b - 1)
upper = a
lower = 0
while upper - lower > 1:
  x = int((upper + lower) / 2)
  if x * b <= a * r:
    lower = x
  else:
    upper = x
print(lower)

Solution (Python):
import math

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

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





print(max_value)

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

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

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

  print(ans)

Solution (Python):

''':'
docker run --rm -it -v $(cd $(dirname $0) && pwd):/vo:ro pypy:3-2.4.0 \
   /bin/bash -c "pypy3 /vo/$(basename $0) < /vo/input.txt"
exit $?
'''
import sys

def _ia(): return map(int, sys.stdin.readline().strip().split())


def main():
    a, b, n = _ia()
    return (a * min(b-1, n))//b

if __name__ == "__main__":
    print(main())

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

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

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

Solution (Python):


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





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

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

def floor(x,y):
  return int(x/y)

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

Solution (Python):
A,B,N=map(int,input().split())
Z=0
if N<B:
    Z=(A*N)//B

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

print(Z)

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


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

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


if __name__ == "__main__":
    main()

Solution (Python):


import sys
import math

DEBUG = False

def read(t):
    return t(sys.stdin.readline().rstrip())


def read_list(t, sep = " "):
    return [t(s) for s in sys.stdin.readline().rstrip().split(sep)]


def dprint(*args, **kwargs):
    if DEBUG:
        print(*args, **kwargs)
    return

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

def main():
    a, b, n = read_list(int)
    if n < b:
        print(f(n, a, b))
        return
    print(f(b - 1, a, b))


if __name__ == "__main__":
    main()

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

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

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

c = N // B

ans = 0

if c != 0:
    ans = int(A*(B-1)/B)
else:
    ans = int(A * N / B)

print(ans)

Solution (Python):


def read_int():
    return int(input().strip())


def read_ints():
    return list(map(int, input().strip().split(' ')))


def solve():
    
    
    
    
    
    
    A, B, N = read_ints()
    p = min(B-1, N)
    return A*p//B


if __name__ == '__main__':
    print(solve())

Solution (Python):
import math

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

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

print(_max)

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

if n<b:
	res=f(a,b,n)
	print(res)
else:
	res=f(a,b,b-1)
	if n%b==0:
		res=max(res,f(a,b,n-1))
		print(res)
	else:
		res=max(res,f(a,b,(n//b)-1))
		print(res)

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

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

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

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 = 2

def hantei(x,a,b):
    rr = 0
    rr = int(a*x//b) - a * int(x//b)
    return rr



mx = n//b
ans = 0
ans_n = hantei(n,a,b)
ans_0 = hantei(0,a,b)

if(mx == 0):
    x = n
    ans = hantei(x,a,b)
else:
    flag = 1
    x = 2*b - 1
    ans = max(ans,hantei(x,a,b))
    

asn = max(ans,ans_n,ans_0)    
print(ans)

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

Solution (Python):
import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

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

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

print(ans)

Solution (Python):
from heapq import heappush, heappop, heapify
from collections import deque, defaultdict, Counter
import itertools
from itertools import permutations, combinations, accumulate, product
import sys
import bisect
import string
import math
import time


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


def S(): return input()


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


def MS(): return map(str, input().split())


def LI(): return [int(i) for i in input().split()]


def LI_(): return [int(i)-1 for i in input().split()]


def StoI(): return [ord(i)-97 for i in input()]


def ItoS(nn): return chr(nn+97)


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


def debug(table, *args):
    ret = []
    for name, val in table.items():
        if val in args:
            ret.append('{}: {}'.format(name, val))
    print(' | '.join(ret), file=sys.stderr)


yn = {False: 'No', True: 'Yes'}
YN = {False: 'NO', True: 'YES'}
MOD = 10**9+7
inf = float('inf')
IINF = 10**10
l_alp = string.ascii_lowercase
u_alp = string.ascii_uppercase
ts = time.time()
sys.setrecursionlimit(10**6)
nums = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10']

show_flg = False


import random


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

def main():
    A, B, N = MI()
    ans = 0
    s = set()

    x = B - 1
    

    if x >= N:
        
        x = N

    
    print(f(x, A, B))
    
    

    
    
    
    
    

    
    


if __name__ == '__main__':
    main()

Solution (Python):






"""Module docstring
"""

import functools
import heapq
import itertools
import logging
import math
import random
import string
import sys
from argparse import ArgumentParser
from collections import defaultdict, deque
from copy import deepcopy
from typing import Dict, List, Optional, Set, Tuple


def solve(a: int, b: int, n: int) -> int:
    x = min(n, b - 1)
    return (a * x) // b - a * (x // b)


def do_job():
    "Do the work"
    LOG.debug("Start working")
    
    A, B, N = list(map(int, input().split()))
    
    
    
    result = solve(A, B, N)
    print(result)


def print_output(testcase: int, result) -> None:
    "Formats and print result"
    if result is None:
        result = "IMPOSSIBLE"
    print("Case 
    
    


def configure_log() -> None:
    "Configure the log output"
    log_formatter = logging.Formatter("%(lineno)d - " "%(message)s")
    handler = logging.StreamHandler(sys.stdout)
    handler.setFormatter(log_formatter)
    LOG.addHandler(handler)


LOG = None

if not LOG:
    LOG = logging.getLogger("template")
    configure_log()


def main(argv=None):
    "Program wrapper."
    if argv is None:
        argv = sys.argv[1:]
    parser = ArgumentParser()
    parser.add_argument(
        "-v",
        "--verbose",
        dest="verbose",
        action="store_true",
        default=False,
        help="run as verbose mode",
    )
    args = parser.parse_args(argv)
    if args.verbose:
        LOG.setLevel(logging.DEBUG)
    do_job()
    return 0


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    sys.exit(main())


class memoized:
    """Decorator that caches a function's return value each time it is called.
    If called later with the same arguments, the cached value is returned, and
    not re-evaluated.
    """

    def __init__(self, func):
        self.func = func
        self.cache = {}

    def __call__(self, *args):
        try:
            return self.cache[args]
        except KeyError:
            value = self.func(*args)
            self.cache[args] = value
            return value
        except TypeError:
            
            
            return self.func(*args)

    def __repr__(self):
        """Return the function's docstring."""
        return self.func.__doc__

    def __get__(self, obj, objtype):
        """Support instance methods."""
        return functools.partial(self.__call__, obj)

Solution (Python):
a, b, n = map(int, input().split())
def val(x):
  global a, b, n
  return int((a*x)//b - a*(x//b))

if n >= b:
  print(val(b-1))
else:
  print(val(n))

Solution (Python):


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

    mod = n % b
    div = n // b

    x = n
    if div == 0:
        if mod == 0:
            x = n-1
    else:
        if mod == 0:
            x = n-1
        else:
            x = n-mod-1
    
    floor_ax_b = (a * x) // b
    floor_x_b = x // b

    ans = floor_ax_b - a * floor_x_b

    
    print(ans)

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

max_d = min(B - 1, N)
max_r = max_d / B

res = int(max_r * A)
print(res)

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

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

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

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

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

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

s1 = math.floor(a * n / b) - a * math.floor(n / b)
if n < b:
    print(s1)
    exit()

ans = 0
for i in range(b, b - 10*3, -1):
    ans = max(math.floor(a * (b-1) / b) - a * math.floor((b-1) / b), ans)
print(ans)

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

    if n < b:
        return math.floor(a*n/b) - a*math.floor(n/b)
    elif n >= b:
        return math.floor(a*(b-1)/b) - a*math.floor((b-1)/b)



print(solve())

Solution (Python):
import collections
import math
import operator as op
from functools import reduce
from collections import Counter
import numpy as np
import math
import bisect
import heapq

MOD = 1000000007


def get_inputs(cast_func=None):
    if cast_func is None:
        return input().split()
    else:
        return list(map(cast_func, input().split()))


def get_input(cast_func=None):
    if cast_func is None:
        return input()
    else:
        return cast_func(input())


def main():
    A, B, N = get_inputs(int)
    if N >= B-1:
        print(math.floor(A - A/B))
    else:
        print(math.floor(A * N / B))


if __name__ == '__main__':
    main()

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

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

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

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

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

Solution (Python):
if __name__ == "__main__":
    a, b, n = map(int, input().split())
    r = 0
    if n >= b:
        r = b - 1
    else:
        r = n

    print(a * r // b)

Solution (Python):
from math import floor
a, b, n = [int(i) for i in 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 (A*x)//B - A*(x//B) 

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

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

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

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


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

Solution (Python):
from math import floor

def main():
    a,b,n = (int(x) for x in input().split())
    if b <= n:
        ans = floor(a*(b-1)/b)
    else:
        ans = floor(a*(n)/b)
    print(ans)

if __name__ == '__main__':
    main()

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

Solution (Python):

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

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

if n < b:
	print(f(a,b,n))
else:
	print(f(a,b,b-1))

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):
import math
a,b,n=map(int,input().split())
if n>b-2:
  print(math.floor((a*(b-1))/b))
else:
  print(math.floor((a*n)/b))

Solution (Python):
input_ABN = input().split(' ')
A = int(input_ABN[0])
B = int(input_ABN[1])
N = int(input_ABN[2])

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

Solution (Python):
def solve():
    A,B,N = map(int,input().split())
    print(max(express(A,B,N), express(A,B,max(N//B*B-1,0))))

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

if __name__ == '__main__':
    solve()

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

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

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

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

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

Solution (Python):
import numpy as np
a,b,n = map(int,input().split())
xbmodlist = []
ans_list = []
if b == 1:
    print(0)
    
else:
    if n >= b-1:
        tmp = b-1
        if b!= 1:
            while tmp <= n:
                xbmodlist.append(tmp)
                tmp += b-1
            for i in xbmodlist:
                ans_list.append(np.floor(a*i/b)-a*np.floor(i/b))

            print(int(max(ans_list)))
    else:
        print(int(np.floor(a*n/b)-a*np.floor(n/b)))

Solution (Python):

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

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

Solution (Python):
from math import floor


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


def solve(a, b, n):
    return f(a, b, min(b-1, n))


if __name__ == "__main__":
    a, b, n = map(int, input().split())
    print(solve(a, b, n))

Solution (Python):
from math import floor
def seq(a, b, x):
    return int(floor((a*x)/b)) - int(a*floor(x/b))
ma = 0
a, b, n = map(int, input().split())
n = min(n, b)
low = 1
high = n
ans = 0
while low<=high:
    mid = low + (high-low)//2
    if seq(a, b, mid)>=seq(a, b, mid-1):
        low = mid+1
        ans = mid
    else:
        high = mid-1
print(seq(a, b, ans))

Solution (Python):
import math 


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

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

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


if __name__ == '__main__':
    main()

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

Solution (Python):
import math

def factor(N):
    ans = []
    for i in range(1,int(math.sqrt(N))+1):
        if N%i == 0:
            ans.append(i)
            if N//i != i:
                ans.append(N//i)
    return ans

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


print(min(N,B-1)*A//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):
import math
a, b, n = map(int, input().split())

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

Solution (Python):

a,b,n=map(int,input().split())
i=(n//b)*b
r=(a*n)//b-a*(n//b)
if i>1:
    x=b*(i+1)-1
    r1=(a*x)//b-a*(x//b)
else:
    r1=0
print(max(r,r1))

Solution (Python):
def main():

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

    def gcd(a, b):
        if a > b: a, b = b, a
        if a == 0: return b
        return gcd(b%a, a)

    g = gcd(A, B)
    p = A // g
    q = B // g
    
    return int(p * min(N, B-1) // q)



if __name__ == '__main__':
    print(main())

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

Solution (Python):
from math import floor
a, b, n = [int(x) for x in input().split()]
def e(x):
	return floor(a * x // b) - a * floor(x // b)
candidates = [a, a - 1, b-1, b, n-1, n]
print(max(*[e(x) for x in candidates if x >= 1 and x <= n]))

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

Solution (Python):
import numpy as np
nmq = input()
[a, b, n] = [int(comp) for comp in nmq.split()]


def func(x):
  global a, b
  return int(a * x // b) - a * int(x // b)


if(n < b):
  print(func(n))
else:
  print(func(b - 1))

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

Solution (Python):
import math

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

for x in range(min(b, n), 0, -1):
    score = math.floor((a*x)/b) - math.floor(a*(x//b))
    if (score > 0):
        print(score)
        break
else:
    print(0)

Solution (Python):
A, B, N = [int(i) for i in input().split()]
if B-1 <= N:
    print(A*(B-1)//B)
else:
    print(A*N//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

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


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

Solution (Python):
import math
A, B, N = [int(x) for x in input().split()]
if B > 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().split())
print((a * min(b-1,n)) // b)

Solution (Python):
import sys
import math

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

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

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

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

ans = func(min(B - 1, N))
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):
a, b, n = map(int, input().split())

ans = 0
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)

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

Solution (Python):
import collections
import math
import itertools
import sys
sys.setrecursionlimit(10**6)
def f(x):
  return (a*x)//b - a*(x//b)
ma = lambda :map(int,input().split())
ni = lambda:int(input())
a,b,n = ma()
if n>=b-1:
    print(f(b-1))
else:
    print(f(n))

Solution (Python):
str1 = str(input(' '))
l = str1.split(' ')
a = int(l[0])
b = int(l[1])
n = int(l[2])

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

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

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

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

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

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


if __name__ == '__main__':
    main()

Solution (Python):



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


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

high = n
low = 0
while high - low >= 1:
    mid_left = high/3+low*2/3
    mid_right = high*2/3+low/3
    if f(mid_left) <= f(mid_right):
        low = mid_left
    else:
        high = mid_right
print(max(f(int(low)),f(int(high))))

Solution (Python):
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

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

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

ans = int(A * ans_n / B) - A * int(ans_n / B)
print(ans)

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

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

ans = int((A/B)*x)
print(ans)

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

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

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

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

def Ans(x):
    s=math.floor(a*x/b)
    t=a*math.floor(x/b)
    return s-t

ans=0
print(Ans(min(b-1,n)))

Solution (Python):
import sys
sys.setrecursionlimit(1000000000)
import math
from math import gcd
def lcm(a, b): return a * b // gcd(a, b)
from itertools import count, permutations, chain
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok

def get_inv(n, modp):
    return pow(n, modp-2, modp)

def factorials_list(n, modp):    
    fs = [1]
    for i in range(1, n+1):
        fs.append(fs[-1] * i % modp)
    return fs

def invs_list(n, fs, modp):     
    invs = [get_inv(fs[-1], modp)]
    for i in range(n, 1-1, -1):
        invs.append(invs[-1] * i % modp)
    invs.reverse()
    return invs

def comb(n, k, modp):
    num = 1
    for i in range(n, n-k, -1):
        num = num * i % modp
    den = 1
    for i in range(2, k+1):
        den = den * i % modp
    return num * get_inv(den, modp) % modp

def comb_from_list(n, k, modp, fs, invs):   
    return fs[n] * invs[n-k] * invs[k] % modp



class UnionFindEx:
    def __init__(self, size):
        
        self.roots = [-1] * size
    def getRootID(self, i):
        r = self.roots[i]
        if r < 0:   
            return i
        else:
            r = self.getRootID(r)
            self.roots[i] = r
            return r
    def getGroupSize(self, i):
        return -self.roots[self.getRootID(i)]
    def connect(self, i, j):
        r1, r2 = self.getRootID(i), self.getRootID(j)
        if r1 == r2:
            return False
        if self.getGroupSize(r1) < self.getGroupSize(r2):
            r1, r2 = r2, r1
        self.roots[r1] += self.roots[r2]    
        self.roots[r2] = r1
        return True

Yes = 'Yes'
No = 'No'


def main():
    A,B,N=mis()
    if N>=B:
        x=B-1
    else:
        x=N
    print(A*x//B - A*(x//B))


main()

Solution (Python):
import sys
input = sys.stdin.readline
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
def formula(x):
    return math.floor(A*x/B)-(A*math.floor(x/B))
A,B,n=[int(x) for x in input().split()]
if(n<=B-1):
    x=n
else:
    x=B-1
maxi = formula(x)
print(maxi)