Problem: 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.

Submission attempts (in order):
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):
	x=math.floor(a*x/b)
	y=a*math.floor(x/b)
	



# abcd=[]
# A=[0]*n

# 	abcd.append(input_array())

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


# 	ans=fl(a,b,i)
# 	if ans> b_ans:
# 		b_ans=ans
# if i<n:
# 	ans=fl(a,b,n)
# 	if ans> b_ans:
# 		b_ans=ans
print(b_ans)



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
	



# abcd=[]
# A=[0]*n

# 	abcd.append(input_array())

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

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



Verdicts: Wrong Answer

Accepted