Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    H, W = map(int, input().split())
    S_lsit = [input() for i in range(H)]

    INF = 401

    node_list = []
    for i in range(H):
        node_list += [(i, j) for j in range(W)]

    dist_table = [[INF for j in range(H*W)] for i in range(H*W)]
    for i in range(H*W):
        dist_table[i][i] = 0
    #print(dist_table)

    path_list = [[] for i in range(H*W)]
    for k in range(H*W):
        node = node_list[k]
        i, j = node[0], node[1]
        if i >= 1 and S_lsit[i-1][j] == ".":
            path_list[k].append((i-1)*W + j)
        if i <= H-2 and S_lsit[i+1][j] == ".":
            path_list[k].append((i+1)*W + j)
        if j >= 1 and S_lsit[i][j-1] == ".":
            path_list[k].append(i*W + j-1)
        if j <= W-2 and S_lsit[i][j+1] == ".":
            path_list[k].append(i*W + j+1)
        for next_node in path_list[k]:
            dist_table[k][next_node] = 1
    #print(path_list)

    for k in range(H*W):
        for i in range(H*W):
            for j in range(H*W):
                dist_table[i][j] = min(
                    dist_table[i][j],
                    dist_table[i][k] + dist_table[k][j]
                )
    #print(dist_table)

    max_dist = 0
    for i in range(H*W):
        if S_lsit[i//W][i%W] == ".":
            for j in range(H*W):
                if S_lsit[j//W][j%W] == ".":
                    max_dist = max(max_dist, dist_table[i][j])
    print(max_dist)

if __name__ == "__main__":
    main()



Fixed submission:
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
"""
def main():
    H, W = map(int, input().split())
    S_lsit = [input() for i in range(H)]

    INF = 401

    node_list = []
    for i in range(H):
        node_list += [(i, j) for j in range(W)]

    dist_table = [[INF for j in range(H*W)] for i in range(H*W)]
    for i in range(H*W):
        dist_table[i][i] = 0
    #print(dist_table)

    path_list = [[] for i in range(H*W)]
    for k in range(H*W):
        node = node_list[k]
        i, j = node[0], node[1]
        if i >= 1 and S_lsit[i-1][j] == ".":
            path_list[k].append((i-1)*W + j)
        if i <= H-2 and S_lsit[i+1][j] == ".":
            path_list[k].append((i+1)*W + j)
        if j >= 1 and S_lsit[i][j-1] == ".":
            path_list[k].append(i*W + j-1)
        if j <= W-2 and S_lsit[i][j+1] == ".":
            path_list[k].append(i*W + j+1)
        for next_node in path_list[k]:
            dist_table[k][next_node] = 1
    #print(path_list)

    for k in range(H*W):
        for i in range(H*W):
            for j in range(H*W):
                dist_table[i][j] = min(
                    dist_table[i][j],
                    dist_table[i][k] + dist_table[k][j]
                )
    #print(dist_table)

    max_dist = 0
    for i in range(H*W):
        if S_lsit[i//W][i%W] == ".":
            for j in range(H*W):
                if S_lsit[j//W][j%W] == ".":
                    max_dist = max(max_dist, dist_table[i][j])
    print(max_dist)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
Created on Sat Jan  4 16:42:19 2020

@author: masat
"""

X = int(input())

p_list = [2]

if X == 2:
    pass
else:
    tobetest_list = [2*i+3 for i in range(6 * 10**4)]
    for i in range(6 * 10**4):
        p_list.append(tobetest_list[0])
        #追加したtobetest_list[0]の倍数をtobetest_list[0]から除く
        k_list = []
        for k in tobetest_list:
            if k % tobetest_list[0] != 0:
                k_list.append(k)
            else:
                pass
        tobetest_list = k_list
        if p_list[-1] >= X:
            break
        else:
            pass
    
print(p_list[-1])



Fixed submission:
# -*- coding: utf-8 -*-
"""
Created on Sun Feb  2 17:14:11 2020

@author: masat
"""
import math

X = int(input())
i = X

if i == 2:
    pass
else:
    i_is_prime = True
    while True:
        for k in range(2, math.ceil(math.sqrt(i))+1):
            if i%k == 0:
                i_is_prime = False
                break
            else:
                pass
        if i_is_prime:
            break
        else:
            i_is_prime = True
            i += 1

print(i)
Buggy python submission (verdict: Time Limit Exceeded):
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
min sec
"""
# とりあえず愚直に書いてみる。
# Bは0、Wは1にする。
# ひっくり返す順番は関係なさそうなので考えない。
def main():
    S = input()
    N = len(S)
    S_list = [0]*N
    for i in range(N):
        if S[i] == "W":
            S_list[i] = 1
    counter = 0
    while True:
        no_BW = True
        for i in range(N-1):
            if S_list[i] == 0 and S_list[i+1] == 1:
                S_list[i] = 1
                S_list[i+1] = 0
                counter += 1
                no_BW = False
        if no_BW:
            break
    print(counter)

if __name__ == "__main__":
    main()



Fixed submission:
# -*- coding: utf-8 -*-
"""
@author: H_Hoshigi
min sec
"""
# とりあえず愚直に書いてみる。→TLEした。
# Bは0、Wは1にする。→必要ない。
# ひっくり返す順番は関係なさそうなので考えない。
"""
BWのn個の連続（長さ2n）は、n+(n-1)+(n-2)+...+1 = n(n+1)//2回の操作で、
n個のBとn個のWの連続に置き換えられる。
"""
"""
ようするにバブルソートをしている。
k番目のWが文字列Sのi文字目ならば、
その移動距離は、(i-k)回になる。
これを足せばよい。
"""

def main():
    S = input()
    N = len(S)
    counter = 0
    k = 0
    for i in range(N):
        if S[i] == "W":
            counter += (i-k)
            k += 1
    print(counter)

if __name__ == "__main__":
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import math
n = int(input())

l = [int(x) for x in input().split()]

prod = math.prod(l)
if prod > 10**18:
	print(-1)
else:
	print(prod)

Fixed submission:
import math
n = int(input())
m = 10**18
l = [int(x) for x in input().split()]
l.sort();
prod = 1
for i in l:
	prod *= i
	if prod > m:
		prod = -1
		break
	elif prod == 0:
		break
print(prod)

Buggy python submission (verdict: Runtime Error):
import math
n = int(input())

l = [int(x) for x in input().split()]

prod = math.prod(l)
if prod > 10**18:
	print(-1)
else:
	print(prod)

Fixed submission:
import math
n = int(input())
m = 10**18
l = [int(x) for x in input().split()]
l.sort();
prod = 1
for i in l:
	prod *= i
	if prod > m:
		prod = -1
		break
	elif prod == 0:
		break
print(prod)
Buggy python submission (verdict: Runtime Error):
X, K, D = map(int, input().split())
ans = 0
if X == 0:
    if K % 2 != 0:
        ans = D
elif X > 0:
    a = int(X/D)
    if K > a:
        diff = K - a
        X_temp = X - a * D
        if abs(X_temp - D) < X_temp:
            if (diff - 1) % 2 == 0:
                ans = abs(X_temp - D)
            else:
                ans = X_temp
        else:
            if diff % 2 == 0:
                ans = X_temp
            else:
                ans = abs(X_temp - D)
    else:
        ans = X - K * D
else:
    if K > a:
        diff = K - a
        X_temp = X + a * D
        if abs(X_temp + D) < abs(X_temp):
            if (diff - 1) % 2 == 0:
                ans = abs(X_temp + D)
            else:
                ans = abs(X_temp)
        else:
            if diff % 2 == 0:
                ans = abs(X_temp)
            else:
                ans = abs(X_temp + D)
    else:
        ans = abs(X + K * D)
print(ans)

Fixed submission:
X, K, D = map(int, input().split())
ans = 0
if X == 0:
    if K % 2 != 0:
        ans = D
elif X > 0:
    a = int(X/D)
    if K > a:
        diff = K - a
        X_temp = X - a * D
        if abs(X_temp - D) < X_temp:
            if (diff - 1) % 2 == 0:
                ans = abs(X_temp - D)
            else:
                ans = X_temp
        else:
            if diff % 2 == 0:
                ans = X_temp
            else:
                ans = abs(X_temp - D)
    else:
        ans = X - K * D
else:
    a = int(abs(X)/D)
    if K > a:
        diff = K - a
        X_temp = X + a * D
        if abs(X_temp + D) < abs(X_temp):
            if (diff - 1) % 2 == 0:
                ans = abs(X_temp + D)
            else:
                ans = abs(X_temp)
        else:
            if diff % 2 == 0:
                ans = abs(X_temp)
            else:
                ans = abs(X_temp + D)
    else:
        ans = abs(X + K * D)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
edge = {}
edge[0, 1] = min(A[0], A[1])
edge[1, 0] = min(A[0], A[1])
ans = A[0]
max_edge_list = [(0, 1), (1, 0)]
for i in range(2, N):
    x, y = max_edge_list[0]
    ans += edge[(x, y)]
    del edge[(x, y)]
    edge[x, i] = A[i]
    edge[i, y] = A[i]
    max_edge_list.append((x, i))
    max_edge_list.append((i, y))
    max_edge_list.remove((x, y))
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
edge = {}
edge[0, 1] = min(A[0], A[1])
edge[1, 0] = min(A[0], A[1])
ans = A[0]
max_edge_list = [(0, 1), (1, 0)]
idx = 0
for i in range(2, N):
    x, y = max_edge_list[idx]
    ans += edge[(x, y)]
    #del edge[(x, y)]
    edge[x, i] = A[i]
    edge[i, y] = A[i]
    max_edge_list.append((x, i))
    max_edge_list.append((i, y))
    #max_edge_list.pop(0)
    idx += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
edge = {}
edge[0, 1] = min(A[0], A[1])
edge[1, 0] = min(A[0], A[1])
ans = A[0]
max_edge_list = [(0, 1), (1, 0)]
#print(edge)
for i in range(2, N):
    max_kv = max(edge.items(), key=lambda x: x[1])
    x, y = max_edge_list[0]
    ans += edge[(x, y)]
    del edge[(x, y)]
    edge[x, i] = A[i]
    edge[i, y] = A[i]
    max_edge_list.append((x, i))
    max_edge_list.append((i, y))
    max_edge_list.remove((x, y))
    #print(edge)
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=True)
edge = {}
edge[0, 1] = min(A[0], A[1])
edge[1, 0] = min(A[0], A[1])
ans = A[0]
max_edge_list = [(0, 1), (1, 0)]
idx = 0
for i in range(2, N):
    x, y = max_edge_list[idx]
    ans += edge[(x, y)]
    #del edge[(x, y)]
    edge[x, i] = A[i]
    edge[i, y] = A[i]
    max_edge_list.append((x, i))
    max_edge_list.append((i, y))
    #max_edge_list.pop(0)
    idx += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
time = 0
n = 0
m = 0
for i in range(N+M):
    if n < N and m < M:
        if A[n] <= B[m]:
            time += A[n]
            n += 1
        else:
            time += B[m]
            m += 1
    else:
        if n >= N and m >= M:
            break
        elif n == N -1:
            time += B[m]
            m += 1
        elif m == M -1:
            time += A[n]
            n += 1
    if time < K:
        ans += 1
    else:
        break
print(ans)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_sum = [0]
for i in range(N):
    A_sum.append(A[i] + A_sum[i])
B_sum = [0]
for i in range(M):
    B_sum.append(B[i] + B_sum[i])    
import bisect
ans = 0
for i in range(N+1):
    a = A_sum[i]
    if K-a >=0:
        b_idx = bisect.bisect(B_sum, K-a) - 1
        if b_idx  < 0:
            b_idx = 0
        ans = max(ans, i+b_idx)
print(ans)

Buggy python submission (verdict: Runtime Error):
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
ans = 0
time = 0
n = 0
m = 0
for i in range(N+M):
    if n < N and m < M:
        if A[n] <= B[m]:
            time += A[n]
            n += 1
        else:
            time += B[m]
            m += 1
    else:
        if n == N -1:
            time += B[m]
            m += 1
        elif m == M -1:
            time += A[n]
            n += 1
    if time < K:
        ans += 1
    else:
        break
print(ans)

Fixed submission:
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A_sum = [0]
for i in range(N):
    A_sum.append(A[i] + A_sum[i])
B_sum = [0]
for i in range(M):
    B_sum.append(B[i] + B_sum[i])    
import bisect
ans = 0
for i in range(N+1):
    a = A_sum[i]
    if K-a >=0:
        b_idx = bisect.bisect(B_sum, K-a) - 1
        if b_idx  < 0:
            b_idx = 0
        ans = max(ans, i+b_idx)
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
x = 1
alphabet = {i-96:chr(i) for i in range(97, 97+26)}
if int(N) > 26:
    ans = ''
    while x != 0:
        x = N // 26
        mod = N%26
        #print(x, mod, alphabet[mod])
        ans += alphabet[mod]
        N = x
else:
    ans = alphabet[int(N)]
print(ans[::-1])

Fixed submission:
N = int(input())
x = 1
alphabet = {i-96:chr(i) for i in range(97, 97+26)}
if int(N) > 26:
    ans = ''
    while x != 0:
        x = N // 26
        mod = N%26
        #print(x, mod)
        if mod == 0:
            ans += 'z'
            #x -= x%26
            x -= 1
        else:
        #print(x, mod, alphabet[mod])
            ans += alphabet[mod]
        N = x
else:
    ans = alphabet[int(N)]
print(ans[::-1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int, input().split()))
bit_num = 30
A_b = [format(a, '0{}b'.format(bit_num)) for a in A]
S = ''
for i in range(bit_num):
    bit = 0
    for a in A_b:
        if a[i] == '1':
            bit += 1
    if bit % 2 == 0:
        S += '0'
    else:
        S += '1'
#print(S)
B = []
for a in A_b:
    b = ''
    for i in range(bit_num):
        if (int(a[i]) + int(S[i])) % 2 == 0:
            b +='0'
        else:
            b += '1'
    #print(b)
    B.append(int(b, 2))
print(*B)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
bit_num = 30
A_b = [format(a, '0{}b'.format(bit_num)) for a in A]
S = ''
for i in range(bit_num):
    bit = 0
    for a in A_b:
        if a[i] == '1':
            bit += 1
    if bit % 2 == 0:
        S += '0'
    else:
        S += '1'
#print(S)
B = []
for a in A_b:
    b = ''
    for i in range(bit_num):
        if (int(a[i]) + int(S[i])) % 2 == 0:
            b +='0'
        else:
            b += '1'
    #print(b)
    B.append(int(b, 2))
print(*B)
Buggy python submission (verdict: Time Limit Exceeded):
K = int(input())
S = input()
N = len(S)
MOD = 10**9 + 7

fct = [1]
invfct = [1]
for i in range(1, K+N+1):
    fct.append(fct[i-1] * i % MOD)
    invfct.append(pow(fct[i], MOD-2, MOD))

def cmb(n, k):
    return fct[n] * invfct[k] * invfct[n-k]

ans = 0
for i in range(K+1):
    temp = pow(25, i, MOD)
    temp *= cmb(i+N-1, N-1)
    temp *= pow(26, K-i, MOD)
    ans += temp
    ans %= MOD
print(ans)

Fixed submission:
K = int(input())
S = input()
N = len(S)
MOD = 10**9 + 7

fct = [1]
invfct = [1]
pow25 = [1]
pow26 = [1]
for i in range(1, K+N+1):
    fct.append(fct[i-1] * i % MOD)
    invfct.append(pow(fct[i], MOD-2, MOD))
    pow25.append(pow25[i-1] * 25 % MOD)
    pow26.append(pow26[i-1] * 26 % MOD)

def cmb(n, k):
    return fct[n] * invfct[k] * invfct[n-k]

ans = 0
for i in range(K+1):
    temp = pow25[i]
    temp *= cmb(i+N-1, N-1)
    temp *= pow26[K-i]
    ans += temp
    ans %= MOD
print(ans)
Buggy python submission (verdict: Runtime Error):
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
diff_dist = B - A
diff_v = V - W
flag = False
if diff_dist == 0:
    flag = True
else:
    if diff_dist > 0:
        if diff_v > 0:
            t = diff_dist / diff_v
            if t <= T:
                flag = True
        else:
            flag = False
    else:
        if diff_v < 0:
            t = diff_dist / diff_v
            if t <= T:
                flag = True
        else:
            flag = Flase
if flag:
    print('YES')
else:
    print('NO')

Fixed submission:
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())
diff_dist = B - A
diff_v = V - W
flag = False
if diff_v == 0:
    if diff_dist == 0:
        flag = True
elif diff_dist == 0:
    flag = True
else:
    if diff_v > 0:
        t = abs(diff_dist) / diff_v
        if t <= T:
            flag = True
if flag:
    print('YES')
else:
    print('NO')
Buggy python submission (verdict: Runtime Error):
import numpy as np
def main():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    connect = np.ones((N, N), dtype=int)
    for _ in range(M):
        A, B = map(int, input().split())
        A -= 1
        B -= 1
        connect[A, B] = H[A] - H[B]
        connect[B, A] = H[B] - H[A]
    num = 0
    for i in range(N):
        if len(np.where(connect[i, :] <= 0)[0])  == 0:
            num += 1
    print(num)
        
    
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    N, M = map(int, input().split())
    H = list(map(int, input().split()))
    violate = []
    for _ in range(M):
        A, B = map(int, input().split())
        A -= 1
        B -= 1
        if H[A] == H[B]:
            violate.append(A)
            violate.append(B)
        elif H[A] - H[B] < 0:
            violate.append(A)
        elif H[B] - H[A] < 0:
            violate.append(B)
    violate = list(set(violate))
    num = N - len(violate)
    print(num)
        
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
def main():
    X = int(input())
    a = 0
    b = 0
    if X != 1:
        for i in range(2, 10**9):
            if X % i == 0:
                a = i
                b = X // i
                break
    else:
        a = 1
        b = 1
    #print(a, b)
    for y in range(10**9):
        x = y + a
        if x**5 - y**5 == X:
            print(x, y)
            break
        x = y + b
        if x**5 - y**5 == X:
            print(x, y)
            break
        y *= -1
        x = y + a
        if x**5 - y**5 == X:
            print(x, y)
            break
        x = y + b
        if x**5 - y**5 == X:
            print(x, y)
            break
if __name__ == '__main__':
    main()

Fixed submission:
def main():
    X = int(input())
    for A in range(-119, 119):
        flag = False
        for B in range(-119, 119):
            if A**5 - B**5 == X:
                print(A, B)
                flag = True
                break
        if flag:
            break
if __name__ == '__main__':
    main()
Buggy python submission (verdict: Runtime Error):
mport itertools
def main():
    N, M, Q = map(int, input().split())
    abcd = []
    for _ in range(Q):
        a, b, c, d = map(int, input().split())
        abcd.append((a-1, b-1, c, d))
    score = 0
    for ones in list(itertools.combinations([i for i in range(N+M-1)], M-1)):
        temp = [0] * (N + M -1)
        for idx in ones:
            temp[idx] = 1
        A = [0] * N
        idx = 0
        sum_ = 0
        for i in temp:
            if i == 0:
                A[idx] = sum_ + 1
                idx += 1
            else:
                sum_ += 1
        score_temp = get_score(A, abcd)
        if score_temp > score:
            score = score_temp
    print(score)
            

def get_score(A, abcd):
    score = 0
    for a, b, c, d in abcd:
        if A[b] - A[a] == c:
            score += d
    return score

if __name__ == '__main__':
    main()

Fixed submission:
import itertools
def main():
    N, M, Q = map(int, input().split())
    abcd = []
    for _ in range(Q):
        a, b, c, d = map(int, input().split())
        abcd.append((a-1, b-1, c, d))
    score = 0
    for ones in list(itertools.combinations([i for i in range(N+M-1)], M-1)):
        temp = [0] * (N + M -1)
        for idx in ones:
            temp[idx] = 1
        A = [0] * N
        idx = 0
        sum_ = 0
        for i in temp:
            if i == 0:
                A[idx] = sum_ + 1
                idx += 1
            else:
                sum_ += 1
        score_temp = get_score(A, abcd)
        if score_temp > score:
            score = score_temp
    print(score)
            
def get_score(A, abcd):
    score = 0
    for a, b, c, d in abcd:
        if A[b] - A[a] == c:
            score += d
    return score

if __name__ == '__main__':
    main()
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    if N < B:
        max_value = np.floor(A*N/B)
    else:
        init = int(np.ceil(B/A)) + 1
        for x in range(init, B+1):
            value = np.floor(A*x/B) - A * np.floor(x/B)
            #print(x, value)
            if value > max_value:
                max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    x = np.min([B-1, N])
    max_value = int(np.floor(A*x/B))
    print(max_value)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    if N < B:
        max_value = np.floor(A*N/B)
    else:
        for x in range(B+1):
            value = np.floor(A*x/B) - A * np.floor(x/B)
            #print(x, value)
            if value > max_value:
                max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    x = np.min([B-1, N])
    max_value = int(np.floor(A*x/B))
    print(max_value)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    if N < B:
        max_value = np.floor(A*N/B)
    else:
        for x in range(N+1):
            value = np.floor(A*x/B) - A * np.floor(x/B)
            #print(x, value)
            if value > max_value:
                max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    x = np.min([B-1, N])
    max_value = int(np.floor(A*x/B))
    print(max_value)
    
if __name__ == '__main__':
    main()

Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    max_int = B
    if N < B:
        max_int = N
    for x in range(max_int+1):
        value = np.floor(A*x/B) - A * np.floor(x/B)
        #print(x, value)
        if value > max_value:
            max_value = value
    print(int(max_value))
    
if __name__ == '__main__':
    main()

Fixed submission:
import numpy as np
def main():
    A, B, N = map(int, input().split())
    max_value = 0
    x = np.min([B-1, N])
    max_value = int(np.floor(A*x/B))
    print(max_value)
    
if __name__ == '__main__':
    main()