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



Sample input:
5 7 4


Sample output:
2

Submission status: Runtime Error

Solution code:
a,b,n=map(int,input().split())
x=[]
x.append(int(a*n/b)
if n>=b:
  x.append(int(a*(b-1)/b)
print(max(x))

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys
import math

def solve(A: int, B: int, N: int):
    # max_pos = 0
    # max_v = 0
    # for x in range(1, B):
    #     v = math.floor(A*x/B) - A*math.floor(x/B)
    #     if v > max_v:
    #         max_v = v
    #         max_pos = x
    #p = max([math.floor(A*x/B) - A*math.floor(x/B) for x in range(1, B+1)])

    print(max([math.floor(A*x/B) - A*math.floor(x/B) for x in range(1, min(B, N+1))]))

    #r = A % B
    #print(max([A//B * x + math.floor((r * x)/B) for x in range(1, min(B+1, N+1))]))
    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))  # type: int
    B = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    solve(A, B, N)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:

from math import floor

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


def floorMax(nums):
    ans = floor((a * nums)/b) - a * floor(nums/b)
    return ans


def findPeakUtil(arr, low, high, n):
    mid = low + (high - low)/2
    mid = int(mid)

    if ((mid == 0 or floorMax(arr[mid-1]) <= floorMax(arr[mid])) and (mid == n - 1 or floorMax(arr[mid + 1]) <= floorMax(arr[mid]))):
        return mid
    elif (mid > 0 and floorMax(arr[mid - 1]) > floorMax(arr[mid])):
        return findPeakUtil(arr, low, (mid - 1), n)
    else:
        return findPeakUtil(arr, (mid + 1), high, n)


def findPeak(arr, n):
    return findPeakUtil(arr, 0, n - 1, n)


index = findPeak(list(range(0, n+1)), n)

ans = list(range(n))[index]

print(floorMax(ans+1))

Submission status: Runtime Error

Solution code:
A, B, N = map(int, input().split())
Y = A*x//B - A*(x//B)
print(Y)

Submission status: Runtime Error

Solution code:
A,B,N=map(int,input().split())
import numpy as np
print(max([int(A*x/B)-A*int(x/B) for x in np.arange(0,N+1,B/A)]))

Submission status: Runtime Error

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

ans = 0
count = 0
num = int(N / B)
array = list(range(N, B * num - 1,-1))
# array2 = list(i for i in range(B * num, -1, -B))
# array.extend(array2)
# print(array)
for x in array:
#     print(x)
    if count > 1000000:
        break
    xb = x / B
    if xb < 1 and ans != 0:
        count += 1
#         print("continue")
        continue
    floor = int(A*xb) - A * int(xb)
    if ans < floor:
#         print(x)
#         print(x,count)
        count = 0
        ans = floor
    count += 1
print(ans)

Submission status: Runtime Error

Solution code:
A, B, N = map(floor, input().split())
from math import floor

if B > N:
    ans = floor(A*N/B)
    print(ans)
else:
    ans = floor(A*N/B) - A*floor(N/B)
    ans_2nd = 0
    x = (N//B)*B - 1
    temp = floor((A*x)/B) - A*floor(x/B)
    # while ans <= temp and x >= 0:
    #     ans = temp
    #     temp = floor(A*x/B) - A*floor(x/B)
    #     x -= B
    # while ans_2nd <= temp and x >= 0:
    #     ans_2nd = temp
    #     temp = floor(A*x/B) - A*floor(x/B)
    #     x -= B
    # prfloor(max(ans, ans_2nd))
    print(max(temp, ans))

Submission status: Runtime Error

Solution code:
import itertools

N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]

ans = 0
P = [[i for i in range(1, M+1)] for _ in range(N)]

# print(R)
for comb in itertools.product(*P):
    flag = True
    p = comb[0]
    for i in comb:
        if i < p:
            flag = False
            break
        p = i

    if not flag:
        continue

    # print(comb)

    temp = 0
    for abcd in ABCD:
        a, b, c, d = abcd
        if comb[b-1] - comb[a-1] == c:
            temp += d
    if temp >= ans:
        ans = temp

print(ans)

Submission status: Runtime Error

Solution code:
import math
A, B, N = map(int, input().split())
# xはN以下
# int(A*x/B) - A*int(x/B)の最大値を求めたい


compute_range = list(range(0, math.ceil(N / B) + 1))
# print(compute_range)


def h(x):
    return int(int((A * x) / B) - A * int(x / B))


max_num = h(min(B - 1, N))
print(max_num)

Submission status: Runtime Error

Solution code:
A, B, N = map(int, input().split())
print(A*x//B - A*(x//B))

Submission status: Runtime Error

Solution code:
A, B, N= map(int, input().split())
score=[0]*N
for i in range(N):
    score.append((A*(i+1)//B)-A*((i+1)//B))
print(max(score))

Submission status: Runtime Error

Solution code:
import math

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

tans = 0

if B <= N:
  for i in range(B,N+1):
    ans = math.floor(A*i/B) - A*math.floor(i/B)
    print(i,math.floor(A*i/B), math.floor(i/B))
    tans = max(ans,tans)
else:
  tans = math.floor(A*N/B)
  
#for i in range(1,N+1):
#  ans = math.floor(A*i/B) - A*math.floor(i/B)
#  print(i,math.floor(A*i/B), math.floor(i/B))
#  tans = max(ans,tans)

print(tans)

Submission status: Runtime Error

Solution code:
A, B, N = [int(n) for n in input().split()]
ans = []
for x in range(1, A):
    ans.append((A*x//B)-A*(x//B))
print(max(ans))

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
import sys
import itertools#これは色々使える組み込み関数みたいなやつ
import fractions
import copy
import bisect
import math
import numpy as np

#import math#数学的計算はこれでいける。普通に0.5乗しても計算可能
#w=input()
from operator import itemgetter
from sys import stdin
#input = sys.stdin.readline#こっちの方が入力が早いが使える時に使っていこう
from operator import mul
from functools import reduce
from collections import Counter
#from collections import deque

#input = stdin.readline


N=3
M=3
i=0
j=0
k=0
n=3
r=1
a=[0]*5
b=[]
#n=int(input())
#r=int(input())
#print(M)
#A=int(input())
#B=int(input())
#print(N)
pre=0

"1行1つの整数を入力を取得し、整数と取得する"
A,B,N=map(int, input().split(" "))
syo=len(str(N))
if syo <10**4:
 for i in range(N+1):
    k=((A*i)//B))-A*(i//B)
    if pre > k :
        print(pre)
        sys.exit()
    pre=k
    b.append(k)
    k=0
for i in range(N+1):
        k=(A*(i+10**(syo-1)))//B-A*((i+10**(syo-1))//B)
        #print(pre,k)
        if pre > k:
            print(pre)
            sys.exit()
        pre=k
        b.append(k)
        k=0

print(max(b))
#number_list=list(map(int, input().split(" ")))#数字の時
#print(number_list)
"12 21 332 とか入力する時に使う"
"1行に複数の整数の入力を取得し、整数として扱う"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
#メモ
for i in number_list:#こっちの方がrage使うより早いらしい
    print(number_list[i-1])#

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

'''
x=[]
y=[]
for i in range(N):
    x1, y1=[int(i) for i in input().split()]
    x.append(x1)
    y.append(y1)
print(x)
print(y)
"複数行に2数値を入力する形式 x座標とy座標を入力するイメージ"
'''

'''
mixlist=[]
for i in range(N):
    a,b=input().split()
    mixlist.append((int(a),b))
print(mixlist)
"複数行にintとstrを複合して入力するやつ，今回はリスト一つで処理している"
'''

'''
#array=[input().split()for i in range(N)]
#print(type(array[0][0]))
#print(array)
"正方行列にstr型の値を入力"
'''

#brray=[list(map(int, input().split(" ")))for i in range(N)]
#print(type(brray[0][0]))
#print(brray)
'''
入力
1 2
4 5
7 8
出力結果
[[1, 2], [4, 5], [7, 8]]
'''
"列数に関して自由度の高いint型の値を入力するタイプの行列"
#以下に別解を記載
#N, M = [int(i) for i in input().split()]
'''
table = [[int(i) for i in input().split()] for m in range(m)]

print(type(N))
print(N)
print(type(M))
print(M)

print(type(table))
print(table)
'''




#s=input()
#a=[int(i) for i in s]
#print(a[0])
#print([a])
#単数値．桁ごとに分割したい．入力と出力は以下の通り
#イメージとして1桁ごとにリストに値を入れているかんじ
#intを取ると文字列分解に使える
'''
入力
1234
出力
1
[[1, 2, 3, 4]]
'''




'''
word_list= input().split(" ")
print(word_list[0])
"連続文字列の入力"
"qw er ty とかの入力に使う"
"入力すると空白で区切ったところでlistの番号が与えられる"
'''



'''
A, B, C=stdin.readline().rstrip().split()#str style 何個でもいけることが多い
print(A)
"リストではなく独立したstr型を入れるなら以下のやり方でOK"
'''


#a= stdin.readline().rstrip()
#print(a.upper())
"aという変数に入っているものを大文字にして出力"


#a,b=map(int, input().split())  #int style 複数数値入力　「A B」みたいなスペース空いた入力のとき

#なんかうまく入力されるけど
#a=[[int(i) for i in 1.strip()]for 1 in sys.stdin]
#a = [[int(c) for c in l.strip()] for l in sys.stdin]]
#print(a)
#複数行の数値を入力して正方行列を作成


##############################################################################################
##############################################################################################
#under this line explains example calculation

'''
コンビネーションの組み合わせの中身を出力する形式
for i in itertools.combinations(brray, 2)
combinationsをpermutationsにすれば順列になる
今回なら(abc133B)
入力
1 2
5 5
-2 8
出力
[[1, 2], [5, 5], [-2, 8]]
もちろん一次元リストでも使えるし
何よりiもリストのように使えるので便利
'''

#nCr combination
'''
def cmb(n,r):
    #When n < r , this function isn't valid
    r= min(n-r,r)
    #print(n,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n-r, -1))
    #flochart mul(n,n-1)=x
    #next     mul(x,n-2)........(n-r+1,n-r)
    #mul read a,b and returns a*b

    under = reduce(mul, range(1, r+1))
    #print(over, under)
    #reduce is applied mul(1,2)=2
    #next   mul(2,3)=6
    #next   mul(6,4)=4.........last(r!,r+1)=r+1!

    return over // under
    #// is integer divide
    #calc example 5C2
    #over=5*4*3
    #under=3*2*1
a = cmb(n, r)
#print(a)
'''

'''
#集計
#example
#a=[2,2,2,3,4,3,1,2,1,3,1,2,1,2,2,1,2,1]
#a=Counter(a)
for i in a.most_common(n):print(i)
#most_common()メソッドは、出現回数が多い要素順にCounterオブジェクトを並び替えます。
#引数にint型の数字nを設定した場合は、出現回数が高い上位ｎ個の要素を返します。
#何も設定しなければ、コンテナ型にあるすべての要素を出現回数の順番に並び替えたタプル型オブジェクトを返します。
#out put
#(2, 8)
 #(1, 6)
#(3, 3)
#(4, 1)
'''


#二部探索(binary search)
#A = [1, 2, 3, 3, 3, 4, 4, 6, 6, 6, 6]
#print(A)
#index = bisect.bisect_left(A, 5) # 7 最も左(前)の挿入箇所が返ってきている
#A.insert(index, 5)
#print(index)
#print(A)
'''
bisect.bisect_left(a, x, lo=0, h=len(a))
引数
a: ソート済みリスト
x: 挿入したい値
lo: 探索範囲の下限
hi: 探索範囲の上限
(lo, hiはスライスと同様の指定方法)
bisect_leftはソートされたリストaに対して順序を保ったままxを挿入できる箇所を探索します。leftが示す通り、aにすでにxが存在している場合は、挿入箇所は既存のxよりも左側になります。また、lo, hiを指定することで探索範囲を絞り込むことも可能です。デフォルトはaの全体が探索対象です。
'''





########################################################################
########################################################################
#b2=a[:]  #1次元のときはコピーはこれで良い
#print(b2)

#a= [[0]*3 for i in range(5)] #2次元配列はこう準備、[[0]*3]*5だとだめ
#b3=copy.deepcopy(a)  #2次元配列はこうコピーする
#print(b3)

Submission status: Runtime Error

Solution code:
a,b,n=map(int,input().solit())
box=[0 for i in range(n)]
for i in range(1,n+1):
    box[i-1]+=int(a*i/b)-a*int(i/b)

print(max(box))

Submission status: Runtime Error

Solution code:
import math

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

for i in range(N):
  k[i] = i / B
  f[i] = k[i] - int(k[i])
  
F = ｆ.index(max(f))

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

print(ans)

Submission status: Runtime Error

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

Submission status: Runtime Error

Solution code:
import sys
import heapq
input = sys.stdin.readline
A,B,N=map(int,input().split())
Z=[]
if A<B:
    for x in range(N+1):
        Y=int(A*x/B)-A*int(x/B)
        Z.append(Y)
        if Y<Z[x-1]:
            print(Z[x-1])
    print(Z[N+1])
else:
    Y=int(A*N/B)-A*int(N/B)
    print(Y)

Submission status: Runtime Error

Solution code:
A,B,N=map(int,input().split())
import numpy as np
print(max([int(A*x/B)-A*int(x/B) for x in np.arange(0,N+1,max((B/A),1))]))

Submission status: Runtime Error

Solution code:
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################

#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
import math
A,B,N = map(int,input().split())
#left = math.floor(A/B)
if A<B:
    N = N-1
    print(math.floor((A*N)/B)-A*math.floor(N/B))
elif A=B:
  print(N)
else:
    i = B-1
    print(math.floor((A*i)/B)-A*math.floor(i/B))

Submission status: Runtime Error

Solution code:
print(hoge)

Submission status: Runtime Error

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

t=0
xx=1
l=[-1]*(b+1)
p=1
d=b//a
if d==0:
   d=1
if n>=b and b>1:
   while t == 0 and xx <= n:
      c=a*xx%b
      if l[c]==-1:
         l[c]=xx
      else:
         t=1
      xx+=d
   while t>-1:

      if l[p]>-1:
         t=-2
         x=l[p]
      p+=1
else:
   x=n
print(a*x//b-a*(x//b))

Submission status: Runtime Error

Solution code:
def main(n,m,q):
    l=[]
    k=10**12
    for i in range(1,q+1):
        k=j
        j=(n*i)//m-n*(i//m)
        l.append(j)
        if k<j:
            break
    print(max(l))
n,m,q=map(int,input().split())
main(n,m,q)

Submission status: Runtime Error

Solution code:
A, B, N = map(int, input().split())
f = [int(A*x/B)-(A * int(x/B)) for x range(N+1)]
print(max(f))

Submission status: Runtime Error

Solution code:
A, B, N = map(floor, input().split())
from math import floor

if B > N:
    ans = floor(A*N/B)
    print(ans)
else:
    ans = floor(A*N/B) - A*floor(N/B)
    ans_2nd = 0
    x = (N//B)*B - 1
    temp = floor(A*x/B) - A*floor(x/B)
    # while ans <= temp and x >= 0:
    #     ans = temp
    #     temp = floor(A*x/B) - A*floor(x/B)
    #     x -= B
    # while ans_2nd <= temp and x >= 0:
    #     ans_2nd = temp
    #     temp = floor(A*x/B) - A*floor(x/B)
    #     x -= B
    # prfloor(max(ans, ans_2nd))
    print(max(temp, ans))

Submission status: Runtime Error

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

Submission status: Runtime Error

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

def main():
    A, B, N = map(int, input().split())
    ans = -1
    for x in range(min(B-1, N), max(min(B-1, N)-N, -1), -B+1):
        ans = max(ans, f(x, A, B))
    print(ans)

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################

#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
import math
A,B,N = map(int,input().split())
#left = math.floor(A/B)
if A<=B:
    N = N-1
    print(math.floor((A*N)/B)-A*math.floor(N/B))
elif A=B:
  print(N)
else:
    i = B-1
    print(math.floor((A*i)/B)-A*math.floor(i/B))

Submission status: Runtime Error

Solution code:
A,B,N=map(int,input().split())
if B==1 or A==1:
    ans = 0
elif A==10**6 and B ==10**12
    ans = 10**6
else:
    while N%B==0:
        N = N-1
    ans = (A*N)//B - A*(N//B)
print(ans)

Submission status: Runtime Error

Solution code:
if B <= N:
  for i in range(B,N):
    ans = math.floor(A*i/B) - A*math.floor(i/B)
    #print(i,math.floor(A*i/B), math.floor(i/B))
    tans = max(ans,tans)
else:
  tans = math.floor(A*N/B)
  
#for i in range(1,N+1):
#  ans = math.floor(A*i/B) - A*math.floor(i/B)
#  print(i,math.floor(A*i/B), math.floor(i/B))
#  tans = max(ans,tans)

print(tans)

Submission status: Runtime Error

Solution code:
n= map(int,input().split())
t=0
for i in range(n[2]+1):
  u=(n[0]*i)/n[1]
  r=math.floor(u)
  u1=i/n[1]
  r1=math.floor(u1)
  t1=r-n[0]*r1
  if t1>t:
    t=t1
print(t)

Submission status: Runtime Error

Solution code:
import math
a,b,n = map(int,input().split())
#li = []
 
#for x in range(n+1):
ans = (math.floor((a*(n))/b) - (a * math.floor(n/b)))

 
#print(max(li))
if max(li) > n:
    print(0)
else:
    print(max(li))

Submission status: Runtime Error

Solution code:
import math

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

for i in range(N):
    if (i+1) < B:
        x = math.floor(A*(i+1)/B) - A * math.floor((i+1)/B)
        ans.append(x)
    else:
        pass
    
ans.sort()
print(ans[-1])

Submission status: Runtime Error

Solution code:
a, b, x = map(int, input())
print(a * (b - 1) // b)

Submission status: Runtime Error

Solution code:
import math

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

l = [0]

for x in range(1,100):
    ans = 0
    ans = math.floor(a*x/b) - a * math.floor(x/b)
    l.append(ans)
    if l[x+1] > ans:
        break

print(ans)

Submission status: Runtime Error

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

t=0
xx=1
l=[-1]*(b+1)
p=1
d=b//a
if n>=b and b>1:
   while t == 0 and xx <= n:
      c=a*xx%b
      if l[c]==-1:
         l[c]=xx
      else:
         t=1
      xx+=d
   while t>-1:

      if l[p]>-1:
         t=-2
         x=l[p]
      p+=1
else:
   x=n
print(a*x//b-a*(x//b))

Submission status: Runtime Error

Solution code:
A,B,N=map(int,input().split())
import numpy as np
print(max([int(A*x/B)-A*int(x/B) for x in np.arange(0,N+1,max((B/A),1))])

Submission status: Runtime Error

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

Ansermax = 0

if b < N :
    N = b
    
for x in range(N+1):

    Anser = 0

    Anser = int((a*x)//b)-a*int(x//b)
    
    if Ansermax < Anser:
        Ansermax = Anser
    
    if Ansermax > Anser
     break

print(Ansermax)

Submission status: Runtime Error

Solution code:
from decimal import *


def target(x):
    x = Decimal(x)
    return (A * x).divmod(B) - A * (x.divmod(B))


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

left = 1
right = N

while right - left > 1:
    mid = left + (right - left) // 2
    y = target(mid)
    prv = target(mid - 1)
    nxt = target(mid + 1)
    if prv <= y <= nxt:
        left = mid
    else:
        right = mid


print(target(right))

Submission status: Runtime Error

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

def asahi(i):
  return int(a*i/b)-a*int(i/b)

print(max(asahi(n-3),(max(asahi(n-2),max(asahi(n),asahi(n-1))))

Submission status: Runtime Error

Solution code:
import math
A,B,N = map(int,input().split())
for i in range(N):
  v = math.floor(A*i/B) - A*math.floor(x/B)
print(max(v))

Submission status: Runtime Error

Solution code:
import math
A, B, N = map(int, input().split())
lists = []
for x in range(0, N+1):
    i = math.floor(A * x / B)
    j = A * (math.floor(x / B))
    result = i - j
    lists.append(result)
print(max(lists)

Submission status: Runtime Error

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

Submission status: Runtime Error

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

Submission status: Runtime Error

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

if a == b and b == c:
    print(a-1)
else:
    if a <= b:
        if a >= n:
            #n_tmp = n % a
            #print(n_tmp)
            #if n_tmp == 0:
            n_tmp = n
            ans = int(a*n_tmp/b) - a*int(n_tmp/b)
            #print(ans)
            #print('####')
    
            ##for x in range(n+1):
             #   ans = int(a*x/b) - a*int(x/b)
             #   print(ans)
    
        else:
            ans = a-1
            print(ans)
    
            ##for x in range(n + 1):
             #   ans = int(a*x/b) - a*int(x/b)
             #   print(ans)
    
    
    else:
        if a >= n:
            ans_max = 0
            n_tmp = n
            for x in range(n_tmp+1):
                ans = int(a*x/b) - a*int(x/b)
                #print(ans)
                if ans_max < ans:
                    ans_max = ans
    
            print(ans_max)
    
        else:
            ans_max = 0
            n_tmp = a
            for x in range(n_tmp + 1):
                ans = int(a * x / b) - a * int(x / b)
                #print(ans)
                if ans_max < ans:
                    ans_max = ans
    
            #print('max##########################')
            print(ans_max)
    
            #print('#########################')
            #for x in range(n + 1):
            #    ans = int(a * x / b) - a * int(x / b)
            #    print(ans)
                #if ans_max < ans:
                #    ans_max = ans
    
            #print(ans_max)

Submission status: Runtime Error

Solution code:
import sys
a,b,c=map(float,input().split())/100
a=int(a*100)
ans=[0]*b
if c>b-2:
    for i in range(int(b*100)):
        d=(0.01*i+0.01)*b-0.01
        ans[i]=int((a*d)/b)-a*(int(d/b))
        if c<d:
            break
else :
    for i in range(int(c*100)):
        ans[i]=int((a*(i+1))/b*100)-a*(int((i+1)/b*100))
print(max(ans))

Submission status: Runtime Error

Solution code:
A, B, N = map(floor, input().split())
from math import floor

if B > N:
    ans = floor(A*N/B)
    prfloor(ans)
else:
    ans = floor(A*N/B) - A*floor(N/B)
    ans_2nd = 0
    x = (N//B)*B - 1
    temp = floor(A*x/B) - A*floor(x/B)
    # while ans <= temp and x >= 0:
    #     ans = temp
    #     temp = floor(A*x/B) - A*floor(x/B)
    #     x -= B
    # while ans_2nd <= temp and x >= 0:
    #     ans_2nd = temp
    #     temp = floor(A*x/B) - A*floor(x/B)
    #     x -= B
    # prfloor(max(ans, ans_2nd))
    prfloor(max(temp, ans))

Submission status: Runtime Error

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

if N <B:
	print(math.floor(A*N/B))
	exit()

if N == B:
	print(0)
	exit()

k = [0]*(math.floor(N/B))

for i in range (1, len(k)+1):
	k[i-1] = i*B-1

p=[0]*len(k)

for i in range (0, len(k)):
	p[i] = math.floor(A*k[i]/B)-A*math.floor(k[i]/B)

printmax(max(p), math.floor(A*N/B)-A*math.floor(N/B))

Submission status: Runtime Error

Solution code:
if N >= 100000:
    for i in range(N-200,N+1): 
        k = (A*i)//B - A*(i//B)
        ans.append(k)
        i = i + 1
    
else:
    for i in range(N//2,N+1):
        k = (A*i)//B - A*(i//B)
        ans.append(k)
        i = i + 1
    
print(max(ans))

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
import numpy as np
import time



"""
def make_table_min(n, m):
    Table = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
    c = 10
    for i in range(n):
        rem = np.random.randint(1,m+1)
        Table.remove(rem)
    return Table

"""

def make_table(n, m):
    Table = [None]*n
    for i in range(n):
        rem = np.random.randint(1,m+1)
        Table[i] = rem
    return Table

t0 = time.time()
n, m, q = map(int, input().split())
Lis = [[int(e) for e in input().split()] for _ in range(q)]

Sum_cor = []
for i in range(10000000000):
    if m >=6:
        Table = make_table(n,m)
    else:
        Table = make_table(n,m)
    Table.sort()
    d_sum = 0
    for l in Lis:
        if Table[l[1]-1]-Table[l[0]-1] == l[2]:
            d_sum+=l[3]
    Sum_cor.append(d_sum)
    t1 = time.time()
    if t1-t0 >1.8:
        print(max(Sum_cor))
        break

Submission status: Runtime Error

Solution code:
A,B,N=map(int,input().split())
L=[]
for i in range(1,N):
  import math
  Y=(math.floor(A*i/B))-A*(math.floor(i/B))
  L.append(Y)
print(max(L))

Submission status: Runtime Error

Solution code:
import sys, bisect, math, itertools, string, queue, copy
# import numpy as np
# import scipy
from collections import Counter,defaultdict,deque
from itertools import permutations, combinations
from heapq import heappop, heappush
from fractions import gcd
# input = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9+7
def inp(): return int(input())
def inpm(): return map(int,input().split())
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
def inplm(n): return list(int(input()) for _ in range(n))
def inplL(n): return [list(input()) for _ in range(n)]
def inplT(n): return [tuple(input()) for _ in range(n)]
def inpll(n): return [list(map(int, input().split())) for _ in range(n)]
def inplls(n): return sorted([list(map(int, input().split())) for _ in range(n)])

def main():
    a,b,n = inpm()
    ans = int(a*n/b) - a*int(n/b)
    if n > b:
        ans = max(ans,int(a*(b-1)/b) - a*int((b-1)/b))
        
    for i in range(1,min(n//b+1)):
        if i*b<=n:
            x = int(a*(b*i-1)/b) - a*int((b*i-1)/b)
            ans = max(ans,x)
    print(ans)

if __name__ == "__main__":
    main()

Submission status: Runtime Error

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

tmp = 0
a = 0
i = 0

if B > A:
    for i in range(B - 1, N + 1, B):
        if (s := (A * i) // B - A * (a)) > 0:
            tmp = max(s, tmp)
        else:
        break

if i >= N - B:
    for i in range(N, N - N % B - 2, -1):
        if (s := (A * i) // B - A * (i // B)) > 0:
            tmp = max(s, tmp)
        else:
            break

print(tmp)

Submission status: Runtime Error

Solution code:
# -*- coding: utf-8 -*-
# モジュールのインポート
import math
import numpy as np

# 標準入力の取得
A, B, N = list(map(int, input().split()))

# 求解処理


def func(x: np.ndarray) -> np.ndarray:
    return np.floor(A*x/B) - A*np.floor(x/B)


result = 0
x = np.arange(min(N, B-1), (N//2)+1, B)
x = func(x)
result = max(result, int(np.max(x)))
x = np.arange((N//2), N+1, B)
x = func(x)
result = max(result, int(np.max(x)))


# 結果出力
print(result)

Submission status: Runtime Error

Solution code:
import math

data = str(input())
data = data.split(" ")

answer = 0
if int(data[1]) > int(data[2]):
  range = str(data[1])
else:
  range = "0"
for i in range(range, int(data[2])+1):
  first = math.floor(int(data[0])*i/int(data[1]))
  second = int(data[0]) * math.floor(i/int(data[1]))
  result = first - second
  if result > answer:
    answer = result
print(answer)

Submission status: Runtime Error

Solution code:
n, m = map(int, input().split())
count = 0
if n % 2 == 0:
    for i in range(int(n/2)):
        print(i+1, n-i-1)
        count += 1
        if count == m:
            break;
else:
    for i in range(int((n-1)/2)):
        print(i+1, n-i-2)
        count += 1
        if count == m:
            break;

Submission status: Runtime Error

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

    score=[0]*N
    for i in range(N):
        score[i]=(A*(i+1)//B)-A*((i+1)//B)
    print(max(score))

if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################

#########行列読み込み ##############################################
"""
from sys import stdin
n = int(stdin.readline().rstrip())
data = [stdin.readline().rstrip().split() for _ in range(n)]
print(data)
print(*data, sep='\n')
"""
##################################################################
#########入力系####################################################
"""
s =input()
s=list(input())
a=int(input())
x,y = map(int,input().split())	
li = input().split()	
li = list(map(int,input().split()))	
li = input().split('T')	
"""
##################################################################
import math
A,B,N = map(int,input().split())
#left = math.floor(A/B)
if A<B:
    N = N-1
    print(math.floor((A*N)/B)-A*math.floor(N/B))
elif:
    i = B-1
    print(math.floor((A*i)/B)-A*math.floor(i/B))
else:
  print(N)