Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def main():
    A,B,N=map(int,input().split())
    d=deque()
    
    x=0
    while(x<=N):
        #tmp=((A*x)//B)-A*(x//B)
        if (A*x<B):
            tmp1=0
        if (x<B):
            tmp2=0
        tmp1=((A*x)//B)
        tmp2=A*(x//B)
        tmp=tmp1-tmp2
        
        if x>=1:
            if d[-1]>tmp:
                break
        
        d.append(tmp)
        x+=1
        
    print(d[-1])
    exit()
    
if __name__=="__main__":
    main()


Fixed submission:
from math import floor

def main():
    A,B,N=map(int,input().split())
    
    ans1=min(N,B-1)
    ans2=floor(A*ans1/B)-A*floor(ans1/B)
    print(ans2)
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def main():
    A,B,N=map(int,input().split())
    d=deque()
    
    for x in range(N+1):
        #tmp=((A*x)//B)-A*(x//B)
        if (A*x<B):
            tmp1=0
        if (x<B):
            tmp2=0
        tmp1=((A*x)//B)
        tmp2=A*(x//B)
        tmp=tmp1-tmp2
        
        if x>=1:
            if d[-1]>tmp:
                break
        
        d.append(tmp)
        
    print(d[-1])
    exit()
    
if __name__=="__main__":
    main()


Fixed submission:
from math import floor

def main():
    A,B,N=map(int,input().split())
    
    ans1=min(N,B-1)
    ans2=floor(A*ans1/B)-A*floor(ans1/B)
    print(ans2)
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from collections import deque

def main():
    A,B,N=map(int,input().split())
    d=deque()
    
    for x in range(N+1):
        #tmp=((A*x)//B)-A*(x//B)
        tmp1=((A*x)//B)
        tmp2=A*(x//B)
        tmp=tmp1-tmp2
        
        if x>=1:
            if d[-1]>tmp:
                break
        
        d.append(tmp)
        
    print(d[-1])
    exit()
    
if __name__=="__main__":
    main()

Fixed submission:
from math import floor

def main():
    A,B,N=map(int,input().split())
    
    ans1=min(N,B-1)
    ans2=floor(A*ans1/B)-A*floor(ans1/B)
    print(ans2)
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from math import floor
from collections import deque

def main():
    A,B,N=map(int,input().split())
    d=deque()
    ok=False
    
    for x in range(N+1):
        tmp=floor(A*x/B)-A*floor(x/B)
        if tmp<floor(A*(x-1)/B)-A*floor((x-1)/B) and x>=1:
            ok=True
            print(d[-1])
            exit()
        
        d.append(tmp)
        
    print(d[-1])
    exit()
    
if __name__=="__main__":
    main()


Fixed submission:
from math import floor

def main():
    A,B,N=map(int,input().split())
    
    ans1=min(N,B-1)
    ans2=floor(A*ans1/B)-A*floor(ans1/B)
    print(ans2)
    
if __name__=="__main__":
    main()

Buggy python submission (verdict: Time Limit Exceeded):
from math import floor
from collections import deque

def main():
    A,B,N=map(int,input().split())
    d=deque()
    ok=False
    
    for x in range(N+1):
        tmp=floor(A*x/B)-A*floor(x/B)
        if tmp<floor(A*(x-1)/B)-A*floor((x-1)/B) and x>=1:
            ok=True
            break
        
        d.append(tmp)
        
    
    print(d[-1])
    
if __name__=="__main__":
    main()


Fixed submission:
from math import floor

def main():
    A,B,N=map(int,input().split())
    
    ans1=min(N,B-1)
    ans2=floor(A*ans1/B)-A*floor(ans1/B)
    print(ans2)
    
if __name__=="__main__":
    main()