Buggy python submission (verdict: Time Limit Exceeded):
import math


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

    ans = 0
    div_ab = A/B
    div_1b = 1/B
    init_1 = (max(1, N-100000)*A)/B
    init_2 = max(1, N-100000)/B
    start = max(1, N-100000)

    for i in range(max(1, N-100000), N + 1):
        ans = max(math.floor(init_1+div_ab*(i-start)) - A*math.floor(init_2+div_1b*(i-start)),ans)
    if N > B:
        start = max(B-100000,1)
        init_1 = (max(1, int(B-100000)) * A) / B
        init_2 = max(1, int(B-100000)) / B
        for i in range(max(int(B)-100000,1), max(N,int(B)+1)):
            ans = max(math.floor(init_1 + div_ab * (i - start)) - A * math.floor(init_2 + div_1b * (i - start)), ans)

    print(int(ans))


if __name__ == '__main__':
    solve()


Fixed submission:
def solve():
    A,B,N = map(int, input().split())
    if N < B-1:
        print((A*N)//B - A * (N//B))
    else:
        print(((A*(B-1))//B) - A* ((B-1)//B))


if __name__ == "__main__":
    solve()

Buggy python submission (verdict: Runtime Error):
import math


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

    ans = 0
    div_ab = A/B
    div_1b = 1/B
    init_1 = (max(1, int(N)-100000)*A)/B
    init_2 = max(1, int(N)-100000)/B
    start = max(1, int(N)-100000)

    for i in range(max(1, int(N)-100000), int(N) + 1):
        ans = max(math.floor(init_1+div_ab*(i-start)) - A*math.floor(init_2+div_1b*(i-start)),ans)
    if N > B:
        start = max(B-100000,1)
        init_1 = (max(1, int(B-100000)) * A) / B
        init_2 = max(1, int(B-100000)) / B
        for i in range(max(int(B)-100000,1), max(N,int(B)+1)):
            ans = max(math.floor(init_1 + div_ab * (i - start)) - A * math.floor(init_2 + div_1b * (i - start)), ans)

    print(int(ans))


if __name__ == '__main__':
    solve()


Fixed submission:
def solve():
    A,B,N = map(int, input().split())
    if N < B-1:
        print((A*N)//B - A * (N//B))
    else:
        print(((A*(B-1))//B) - A* ((B-1)//B))


if __name__ == "__main__":
    solve()

Buggy python submission (verdict: Runtime Error):
import math


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

    ans = 0
    div_ab = A/B
    div_1b = 1/B
    init_1 = (max(1, int(N)-100000)*A)/B
    init_2 = max(1, int(N)-100000)/B
    start = max(1, int(N)-100000)

    for i in range(max(1, int(N)-100000), int(N) + 1):
        ans = max(math.floor(init_1+div_ab*(i-start)) - A*math.floor(init_2+div_1b*(i-start)),ans)
    start = max(B-1000,1)
    init_1 = (max(1, int(B-100000)) * A) / B
    init_2 = max(1, int(B-100000)) / B
    for i in range(max(int(B-100000),1), max(N,int(B)+1)):
        ans = max(math.floor(init_1 + div_ab * (i - start)) - A * math.floor(init_2 + div_1b * (i - start)), ans)

    print(int(ans))


if __name__ == '__main__':
    solve()


Fixed submission:
def solve():
    A,B,N = map(int, input().split())
    if N < B-1:
        print((A*N)//B - A * (N//B))
    else:
        print(((A*(B-1))//B) - A* ((B-1)//B))


if __name__ == "__main__":
    solve()

Buggy python submission (verdict: Runtime Error):
import math


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

    ans = 0
    div_ab = A/B
    div_1b = 1/B
    init_1 = (max(1, int(N)-100000)*A)/B
    init_2 = max(1, int(N)-100000)/B
    start = max(1, int(N)-100000)

    for i in range(max(1, int(N)-100000), int(N) + 1):
        ans = max(math.floor(init_1+div_ab*(i-start)) - A*math.floor(init_2+div_1b*(i-start)),ans)
    start = max(B-1000,1)
    init_1 = (max(1, int(B-100000)) * A) / B
    init_2 = max(1, int(B-100000)) / B
    for i in range(max(B-100000,1), int(B)+1):
        ans = max(math.floor(init_1 + div_ab * (i - start)) - A * math.floor(init_2 + div_1b * (i - start)), ans)

    print(int(ans))


if __name__ == '__main__':
    solve()


Fixed submission:
def solve():
    A,B,N = map(int, input().split())
    if N < B-1:
        print((A*N)//B - A * (N//B))
    else:
        print(((A*(B-1))//B) - A* ((B-1)//B))


if __name__ == "__main__":
    solve()

Buggy python submission (verdict: Time Limit Exceeded):
import math


def solve():
    A, B, N = map(float, input().split())
    ans = 0

    for i in reversed(range(max(1, int(N)-10000, int(N) + 1))):
        ans = max(math.floor(A * i / B) - A * math.floor(i / B), ans)

    print(int(ans))


if __name__ == '__main__':
    solve()


Fixed submission:
def solve():
    A,B,N = map(int, input().split())
    if N < B-1:
        print((A*N)//B - A * (N//B))
    else:
        print(((A*(B-1))//B) - A* ((B-1)//B))


if __name__ == "__main__":
    solve()