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())

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

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

Solution (Python):
A, B, N = [int(i) for i in input().split()]
ans = 0
if N < B:
    ans = int(( A * (N % B) - (A * N) % B) / B)
else:
    tmp_ = int(( A * (N % B) - (A * N) % B) / B)
    x = (N - N % B - 1)
    tmp = int(( A * (x % B) - (A * x) % B) / B)
    ans = max(tmp, tmp_)
print(ans)

Solution (Python):




import math


inputs: list = []
while True:
    try:
        inputs.append(input().strip('\n'))
    except EOFError:
        break


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

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

Solution (Python):
from math import floor
a,b,n = map(int,input().split())
if a == 1 or b == 1:
    print(0)
    exit()

prev = 0

for x in range(min(b-1,n),n+1, b):
    val = floor(a*x/b) - a*floor(x/b)
    if val < prev:
        print(prev)
        exit()
    prev = val

val = floor(a*n/b) - a*floor(n/b)
print(max(prev,val))

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

Solution (Python):
import math


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

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

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

print(aaa)

Solution (Python):
N, M, K = map(int, input().split())
print(N*min(M-1, K)//M)

Solution (Python):
import math
from collections import deque
a,b,c=[int(_) for _ in input().split()]
if c>=b:
    k=b-1    
else:
    k=c
s=math.floor((k*a)/b)-a*math.floor(k/b)
print(s)

Solution (Python):
import numpy as np
import math

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

i = B-1

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

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

Solution (Python):
import math
a,b,n=map(int,input().split())
max=0
pre=0
if b//a-1<=0:
    st=1
else:
    st=b//a-1
check=0
for i in range(0,n+1,st):
    f=math.floor(a*i/b)-a*math.floor(i/b)
    if f>max:
        max=f
    if f==0:
        check+=1
    if check>st+2:
        break
print(max)

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

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

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

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

max_v = 0

if N < B:
    max_v = calc(N)
else:
    max_v = calc(B-1)





print(max_v)

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

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

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

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


print(func(A,B,N))

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

def solve(A: int, B: int, N: int):
    result1 = int(A*(B-1)/B) - A * int((B-1) / B)
    result2 = int(A*N/B) - A*int(N/B)
    if N <= B-1:
        print(min(result1, result2))
    else:
        print(result1)
    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):
import sys
import math

lines = sys.stdin.readlines()

X = lines[0].split(' ')
A = int(X[0])
B = int(X[1])
N = int(X[2])

m = A // B
j = A % B

if N >=B-1:
    print(max(0,m*(B-1)-1+j))
else:
    k = B-N
    print(max(0,j+m*N-math.ceil(j*k/B)))

Solution (Python):
import math
A,B,N=map(int,input().split())
max=0
if N<B:
  print(math.floor(A*N/B)-A*math.floor(N/B))
  exit()
tmp=math.floor(A*(B-1)/B)-A*math.floor((B-1)/B)
print(tmp)

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

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

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

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

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

elif(n>=b):
    ans = int(a*(b-1)/b) - a * int((b-1)/b)
    print(ans)

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

def floor(x):
    return int(x)

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

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

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

ans = 0


if b > n:
    ans = int(a*n/b)
    print(ans)
    exit()


elif b == n:
    for i in range(n-1,n+1):
        tmpans = int(a*i/b) - (a*int(i/b))
        if tmpans >= ans:
            ans = tmpans
    print(ans)
    exit()


else:
    for i in range(int(n/b),n+1,b):
        tmpans = int(a*(i-2)/b) - (a*int((i-2)/b))
        if tmpans >= ans:
            ans = tmpans

print(ans)

Solution (Python):
import fractions

def gcd(a, b):
    while b:
        a, b = b, a%b
    return a


def reduce(p, q):
    common = fractions.gcd(p, q)
    return (p // common, q // common)


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



    



if b <= n :
    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 N >= B:
    max = (A * (B - 1) ) // B
else:
    max = A * N // B
print(max)

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

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

Solution (Python):
import numpy as np
import pprint
import math

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

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

print(ans)

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

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

def f(a, b, x):
    return (a*x)//b - a*(x//b)
def main():
    a, b, n = map(int, readline().split())
    if n < b:
       ans = f(a, b, n) 
    else:
        ans = f(a, b, b-1)
    print(ans)
if __name__ == '__main__':
    main()

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

if a == b:
    print(0)
    exit()

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

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

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

x = min(B,N)
if x == B:
	x = B - 1
print A*x/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())

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

Solution (Python):
a,b,n=map(int,input().split())
if n >= b-1:
    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):
def LI(): return list(map(int,input().split()))
A,B,N = LI()
ans = 0
if B<=N:
    print(int((A/B*(B-1))//1))
else:
    print(int((A/B)*(N%B)//1))

Solution (Python):
import sys
from math import floor

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

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

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

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

ans = None
a_max = None

for _x in range(1):
    x = min((B - 1), N) * (_x+1)
    if x > N:
        break
    
    a = x/B-int(x / B)
    
    sa = int(a*A)
    
    if a_max == None:
        a_max = sa
    elif sa > a_max:
        a_max = sa

print(a_max)

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

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

def lcm(a,b):
    if a < b:a,b = b,a
    while a%b != 0:
        a,b = b,a%b
    return b

if B <= N+1:
    print(calc(A,B,B-1))
else:
    print(calc(A,B,N))

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

max=0
if N>B:
  N=B-1
  y=math.floor(A*N/B)-A*math.floor(N/B)
  print(int(y))
elif N==B:
  N=B-1
  y=math.floor(A*N/B)-A*math.floor(N/B)
  print(int(y))
else:
	y=math.floor(A*N/B)-A*math.floor(N/B)
	print(int(y))

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

Solution (Python):
import sys

sys.setrecursionlimit(10 ** 5 + 10)


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


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

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

    p, mod = divmod(n, b)
    if mod == 0:
        print(main(n - 1))
    else:
        if p==0:
            print(main(n))
        else:
            ans = main(p * b - 1)
            print(max(main(n), ans))


resolve()

Solution (Python):

import re
import math
from collections import defaultdict
import itertools
from copy import deepcopy
import random
from heapq import heappop,heappush
import time
import os
import queue
import sys
import datetime
from functools import lru_cache

readline=sys.stdin.readline
sys.setrecursionlimit(2000000)

alphabet="abcdefghijklmnopqrstuvwxyz"
mod=int(10**9+7)
inf=int(10**20)
def yn(b):
    if b:
        print("yes")
    else:
        print("no")
def Yn(b):
    if b:
        print("Yes")
    else:
        print("No")
def YN(b):
    if b:
        print("YES")
    else:
        print("NO")
class union_find():
    def __init__(self,n):
        self.n=n
        self.P=[a for a in range(N)]
        self.rank=[0]*n
 
    def find(self,x):
        if(x!=self.P[x]):self.P[x]=self.find(self.P[x])
        return self.P[x]
 
    def same(self,x,y):
        return self.find(x)==self.find(y)
 
    def link(self,x,y):
        if self.rank[x]<self.rank[y]:
            self.P[x]=y
        elif self.rank[y]<self.rank[x]:
            self.P[y]=x
        else:
            self.P[x]=y
            self.rank[y]+=1
 
    def unite(self,x,y):
        self.link(self.find(x),self.find(y))
 
    def size(self):
        S=set()
        for a in range(self.n):
            S.add(self.find(a))
        return len(S)
def is_power(a,b):
    now=b
    while now<a:
        now*=b
    if now==a:return True
    else:return False
def bin_(num,size):
    A=[0]*size
    for a in range(size):
        if (num>>(size-a-1))&1==1:
            A[a]=1
        else:
            A[a]=0
    return A
def get_facs(n,mod_=0):
    A=[1]*(n+1)
    for a in range(2,len(A)):
        A[a]=A[a-1]*a
        if(mod>0):A[a]%=mod_
    return A
def comb(n,r,mod,fac):
    if(n-r<0):return 0
    return (fac[n]*pow(fac[n-r],mod-2,mod)*pow(fac[r],mod-2,mod))%mod
def next_comb(num,size):
    x=num&(-num)
    y=num+x
    z=num&(~y)
    z//=x
    z=z>>1
    num=(y|z)
    if(num>=(1<<size)):return False
    else:
        return num
def get_primes(n,type="int"):
    A=[True]*(n+1)
    A[0]=False
    A[1]=False
    for a in range(2,n+1):
        if A[a]:
            for b in range(a*2,n+1,a):
                A[b]=False
    if(type=="bool"):return A
    B=[]
    for a in range(n+1):
        if(A[a]):B.append(a)
    return B
def is_prime(num):
    if(num<=2):return False
    i=2
    while i*i<=num:
       if(num%i==0):return False
       i+=1
    return True
def ifelse(a,b,c):
    if a:return b
    else:return  c
def join(A,c=" "):
    n=len(A)
    A=list(map(str,A))
    s=""
    for a in range(n):
        s+=A[a]
        if(a<n-1):s+=c
    return s
def factorize(n,type_="dict"):
    b = 2
    list_ = []
    while b * b <= n:
        while n % b == 0:
            n //= b
            list_.append(b)
        b+=1
    if n > 1:list_.append(n)
    if type_=="dict":
        dic={}
        for a in list_:
            if a in dic:
                dic[a]+=1
            else:
                dic[a]=1
        return dic
    elif type_=="list":
        return list_
    else:
        return None
def floor_(n,x=1):
    return x*(n//x)
def ceil_(n,x=1):
    return x*((n+x-1)//x)
def hani(x,min_,max_):
    ret=x
    if x<min_:ret=min_
    if x>max_:ret=max_
    return ret
def seifu(x):
    return x//abs(x)


def main():
    A,B,N=map(int,input().split())
    G=[]
    prev=-inf
    if N<B:
        print((A*N)//B-A*(N//B))
    else:
        print((A*(B-1))//B-A*((B-1)//B))
main()

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


T = N//B
maxR = -1
maxT = 0

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

Solution (Python):
import math

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

m = 0
x = n

while x >= n-b:
    if m > (a*x) // b:
        break
    else:
        y =  math.floor((a * (x / b - math.floor(x / b))))
        if m < y:
            m = y
            x = b * math.floor(x / b) - 1
        else:
            x-=1  

print(m)

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

Solution (Python):
A, B, N = map(int, input().split())
if B == 1:
    print(0)
    exit()

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


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

else:
    print(max(int(A*N/B) - A*int(N/B), int(A*(N-1)/B) - A*int((N-1)/B), int(A*(B-1)/B) - A*int((B-1)/B)))
    exit()

Solution (Python):
A,B,N=map(int,input().split())
def f(x):
    return ((A*x)//B)-A*(x//B)
if N<=10**6:
    ans=0
    for x in range(1,N+1):
        ans=max(ans,f(x))
    print(ans)
elif B<=10**6:
    ans=0
    for x in range(1,min(B+1,N+1)):
        ans=max(ans,f(x))
    print(ans)
elif B>=A:
    x=0
    ans=0
    y=0
    while(x<=N):
        ans=max(ans,f(x))
        y+=1
        x=-((-B*y)//A)
    print(ans)
else:
    ans=0
    for x in range(1,min(B+1,N+1)):
        ans=max(ans,f(x))
    print(ans)

Solution (Python):
l = list(map(int, input().split()))
x = min(l[1]-1, l[2])
r = int(l[0] * x/l[1]) - l[0] * int(x /l[1])
print(r)

Solution (Python):
import math
a,b,n=map(int,input().split())
if n>=b: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())
def floor(x):
  return int(x//1)
list = []
if N >= B:
    list.append(floor((A*(B-1))/B)-(A*floor((B-1)/B)))
else:
    list.append(floor((A*N)/B)-(A*floor(N/B)))
print(max(list))

Solution (Python):
s = input().split()

A = int(s[0])
B = int(s[1])
N = int(s[2])

result = 0

n = (N // B) * B - 1
if (n < 0):
  n = 0

a = (A*N)//B - A*(N//B)
b = (A*n)//B - A*(n//B)
"""
for x in range(N+1):
  y = (A*x)//B - A*(x//B)
  if y > result:
    result = y
"""
    
if (a > b):
  result = a
else:
  result = b
print(result)

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

if(n<b):
    ma = (a*n)//b - (a* (n//b))
else:
    ma = (a*(b-1))//b - (a*((b-1)//b))
    """
    for x in range(b,n+1):
        
        num = (a*x)//b - (a*(x//b))
        if(ma > num):
            break
        ma = num
    """

print(ma)

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

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

l = int(A*m/B)-A*int(m/B)
print(l)

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

Solution (Python):



def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10 ** 6)
    from math import floor
    

    def dump(*args):
        sys.stderr.write(str(args))

    a, b, n = map(int, input().split())
    last = -1
    ans = -1

    def evaluate(number):
        return floor(a * number / b) - a * floor(number / b)

    
    
    print(max(evaluate(min(b, n)), evaluate(min(b-1, n))))


if __name__ == '__main__':
    main()

Solution (Python):
A, B, N = map(int, input().split())
Smx = 0
if B<N:
    N = B
for i in range(N,0,-1):
    if i<N-A:
        break
    S = int((A*(i % B) - ((A*i) % B))/B)
    if Smx<S:
        Smx = S
print(Smx)

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

Solution (Python):
c=list(map(int,input().split()))
bunsi=c[0]
bunbo=c[1]
n=c[2]
k=n//bunbo
d=[n]
if k>=1:
    d.append(bunbo-1)
    d.append(bunbo*k-1)

def floor(x):
    return ((bunsi*x)//bunbo)-(bunsi*(x//bunbo))
if len(d)>=2:
    print(max(floor(d[0]),floor(d[-1]),floor(d[-2])))
if len(d)==1:
    print(floor(d[0]))

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


if __name__ == "__main__":
    main()

Solution (Python):
import math
a,b,n=map(int,input().split())
if n>=b: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())
def func(i, j, k):
    return (i*k)//j - i*(k//j)
m = min(n, b-1)
r = (a*min(n, b-1)) // b
while ((a*m) // b) == r:
    m -= 1
print(func(a, b, m+1))

Solution (Python):

def inputlist(): return [int(k) for k in input().split()]
A,B,N = inputlist()
k = min(N,B-1)
ans = int(A*k/B)
print(ans)

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

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

Solution (Python):
import math

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

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

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

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

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

Solution (Python):



def solve(*args: str) -> str:
    a, b, n = map(int, args[0].split())

    return str(a*min(b-1, n)//b)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))

Solution (Python):
import math
A,B,N=(int(x) for x in input().split())
if N<B:i=N
else:i=B-1
p=(math.floor((A*i)/B))
print(p)

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

c = min([B - 1, N])
y = (A * c - ((A * c) % B)) // B

print(y)

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

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

result = int(A * x / B) - A * int(x / B)

print(result)

Solution (Python):
from math import floor


def main():
    A, B, N = map(int, input().split())
    x = min(B - 1, N)
    print(floor(A*x/B) - A*floor(x/B))

if __name__ == "__main__":
    main()

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

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

	print(ans)

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

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

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

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

Solution (Python):

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

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

print(ans)

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

def main():
    A, B, N = map(int, readline().rstrip().split())
    x = B - 1
    if x > N:
        x = N
    ans = (A * x) // B - A * (x // B)
    print(ans)
    

if __name__ == '__main__':
    main()

Solution (Python):
import math

A, B, N= (int(x) for x in input().split())

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

print(a)

Solution (Python):
import math

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

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

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

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

Solution (Python):
import math

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

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

print(ans)

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

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

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

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

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

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

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

Solution (Python):
from math import factorial,sqrt,ceil,gcd,floor















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

def yosiki(x):
    return floor(A*x/B)-A*floor(x/B)
if B == 1:
    print(0)
    exit()
elif A == B:
    x = min(N,B-1)
    print(yosiki(x))
    exit()
elif A>B:
    x = min(N,B-1)
    print(yosiki(x))
    exit()
elif A<B:
    x = min(N,B-1)
    print(yosiki(x))
    exit()

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 sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections

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

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

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

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

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

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

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

Solution (Python):

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


import math
if n <b:
    x=n
    v=a*x
    v=v//b
    
    ans=v
else:
    ansl=[]
    x=b-1
    v=a*x
    v=v//b-a*(x//b)
    
    ans=max(v,0)
    v=a*n
    v=v//b-a*(n//b)
    ans=max(ans,v)
    
print(ans)

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



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

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

x=min(N,B-1)

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

print(ans)

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

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

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

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

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

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

Solution (Python):
import math

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


ans1 = 0

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

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

Solution (Python):
import math

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

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

Solution (Python):
import sys
import os

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

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

    max=0
    
    
    
    
    
    
    
    
    
    
    

    
    
    
    
    
    
    
    
    
    
    
    
    

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

    

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

if __name__ == '__main__':
    main()

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

Solution (Python):
import math

def readInt():
	return int(input())
 
def readInts():
	return list(map(int, input().split()))
 
def readChars():
	return input().split()

a,b,n = readInts()

x = min(b-1,n)

print(x*a//b)

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

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


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

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

print(calc(x))

Solution (Python):
from math import factorial as fact
import math
import sys
import itertools
import numpy as np
from collections import Counter
import datetime



def input1():
	return int(input())


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


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

def keta(N):
	return len(str(N))


def input_daytime(input_time):
	time,distance=input_time.split()
	t=time.split(":")
	se=str(t[-1]).split(".")
	dt1 = datetime.timedelta(hours=int(t[0]),minutes=int(t[1]),seconds=int(se[0]),milliseconds=int(se[1]))
	return dt1

def combinations(n,r):
	return list(itertools.combinations(range(n),r))



def all_sets(num_list):
	subsets=[]
	for i in range(2,len(num_list) + 1):
		for c in combinations(num_list, i):
			subsets.append(c) 
	return subsets


def ch(x1):
	cf=[]
	for i in range(2,math.sqrt(x1)+1):
		if x1 % i==0:
			cf.append(i)
	return cf

def CountOneRoots(x,y):
	
	return fact(x+y)/fact(x)/fact(y)


def factorization(n):
	tmp=n
	count=0
	for i in range(2,int(n**0.5)+2):
		if tmp%i==0:
			cnt=0
			while tmp%i==0:
				cnt+=1
				tmp//=i
			count+=1
	if tmp!=1:
		count+=1

	return count
			

def fl(a,b,x):
	b1=x//b
	x=math.floor(a*x/b)
	y=math.floor(b1)
	return x-y
	








a,b,n=input2()
if b>n:
	b_ans=fl(a,b,n)
	
else:
	b_ans=fl(a,b,b-1)

for i in range(0,n,b):
	ans=fl(a,b,i)
	
	if ans> b_ans:
		b_ans=ans
	else:
		break




print(b_ans)

Solution (Python):
import math



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


s=N//B

if s==0:
  x=N
else:
  x=s*B-1

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

print(ans)

Solution (Python):
a,b,n=map(int,input().split())
"""
m=-1

for i in range(b+1):
  w=int(a*i/b)-a*int(i/b)
  if m<w or m==-1:
    m=w
print(m)
"""
if b<=n:
  print(int(a*(b-1)/b)-a*int((b-1)/b))
else:
  print(int(a*n/b)-a*int(n/b))

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

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

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

Solution (Python):
if __name__ == '__main__':
    from sys import stdin
    
    import math
    input = stdin.readline

    

    a, b, n = map(int, input().split())
    """
    a = random.randint(1, 10**6)
    b  = random.randint(1, 10**6)
    n = random.randint(1, 10**12)
    """
    
    
    if b > n:
        
        print(int(math.floor((a*n)/b) - a*math.floor(n/b)))
        exit()
    print(int(math.floor((a*(b-1))/b)))

Solution (Python):

import sys
import math

def solve(A: int, B: int, N: int):
    max_b = 0

    k = min(N,B-1)
    
    
    max_b = math.floor(A*k/B)
    print(max_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):

def maxnumber(N, B):
  if N < B:
    return N
  a = (N // B) * B - 1
  if N == a + B:
    return N
  else:
    return a
  
A, B, N = list(map(int, input().strip().split()))
X = maxnumber(N, B)
ans = (A * X) // B - A * (X // B)

print(ans)

Solution (Python):




import sys
input = sys.stdin.readline



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

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

    print(res)



main()

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

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

Solution (Python):
ABN = [int(a) for a in input().split(" ")]
A = ABN[0]
B = ABN[1]
N = ABN[2]
if N < B:
    x = N
else:
    x = B - 1
f = (A*x)//B - A*(x//B)
print(int(f))

Solution (Python):
import math
def fun(A, B, x):
    return math.floor(A*x/B)-A*math.floor(x/B)

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

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