Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):

s = input()
l = ["eraser","erase","dreamer","dream"]

while len(s) > 0:
    for i in range(len(l)):
        if l[i] in s:
            s = s.replase(l[i],"")
        else:
            break
            
if len(s) == 0:
    print("YES")
else:
    print("NO")


Fixed submission:

S = input()
S = S[::-1]

l = ['maerd','remaerd','esare','resare']
i = 0
while i < len(S):
    for w in l:
        if w == S[i:i+len(w)]:
            i += len(w)
            break
    else:
        print('NO')
        exit()
print('YES')

Buggy python submission (verdict: Runtime Error):

s = input()
l = ["dream","dreamer","erase","eraser"]

while len(s) > 0:
    for i in range(len(l)):
        if l[i] in s:
            s = s.replase(l[i],"")
        else:
            break
            
if len(s) == 0:
    print("YES")
else:
    print("NO")


Fixed submission:

S = input()
S = S[::-1]

l = ['maerd','remaerd','esare','resare']
i = 0
while i < len(S):
    for w in l:
        if w == S[i:i+len(w)]:
            i += len(w)
            break
    else:
        print('NO')
        exit()
print('YES')
Buggy python submission (verdict: Time Limit Exceeded):

"""
https://atcoder.jp/contests/abc048/tasks/abc048_b
"""

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

ans = 0

for i in range(a,b+1):
    if i % x == 0:
        ans += 1

print(ans)


Fixed submission:

"""
https://atcoder.jp/contests/abc048/tasks/abc048_b
"""

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

def f(n,d):
    if n == -1:
        return 0
    return n // d+1

print(f(b,x)-f(a-1,x))

"""
ans = 0

for i in range(a,b+1):
    if i % x == 0:
        ans += 1

print(ans)
"""
Buggy python submission (verdict: Runtime Error):
X = input()
ans = []
for x in X:
    if x == "S":
        ans.append(x)
        else:
            if len(ans) != 0:
                if ans [-1] == "S":
                    ans.pop()
                else:
                    ans.append(x)
            else:
                ans.append(x)
print(len(ans)) 




Fixed submission:

X = str(input())
ans = []
for x in X:
    if x == 'S':
        ans.append(x)
    else:
        if len(ans) != 0:
            if ans[-1] == 'S':
                ans.pop()
            else:
                ans.append(x)
        else:
            ans.append(x)
print(len(ans))
Buggy python submission (verdict: Runtime Error):

n = int(input())
a = list(map(int,input()))
ans = 0

for i in range(n):
    j = a[i] -1
    if a[j] == i + 1:
        ans += 1
        print(ans // 2)


Fixed submission:
n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  j=a[i]-1
  if a[j]==i+1:
    ans+=1
print(ans//2)
Buggy python submission (verdict: Runtime Error):

n,m = input().split()
k = int(n)
l = list(input().split())

for i in range(k,100000):
    for x in l:
        for x str(i):
            break
    else:
        print(i)
        break

Fixed submission:
n,m = input().split()
k=int(n)
li = list(input().split())

for i in range(k,100000):
    for e in li:
        if e in str(i):
            break
    else:
        print(i)
        break

Buggy python submission (verdict: Runtime Error):

n,m = input().split()
k = int(n)
l = list(input().split())

for i in range(k,100000):
    for x in l:
        for y str(i):
            break
    else:
        print(i)
        break


Fixed submission:
n,m = input().split()
k=int(n)
li = list(input().split())

for i in range(k,100000):
    for e in li:
        if e in str(i):
            break
    else:
        print(i)
        break
Buggy python submission (verdict: Time Limit Exceeded):
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
h = list(map(int, input().split()))
observatories = list(range(1, n + 1))
for i in range(m):
  ab = list(map(int, input().split()))
  a = ab[0]
  b = ab[1]
  if h[a - 1] >= h[b - 1]:
    if b in observatories:
      observatories.remove(b)
  if h[a - 1] <= h[b - 1]:
    if a in observatories:
      observatories.remove(a)
print(len(observatories))

Fixed submission:
nm = list(map(int, input().split()))
n = nm[0]
m = nm[1]
h = list(map(int, input().split()))
observatories = [[] for i in range(n)]
ans = 0
for i in range(m):
  ab = list(map(int, input().split()))
  a = ab[0] - 1
  b = ab[1] - 1
  observatories[a].append(b)
  observatories[b].append(a)
for j in range(len(observatories)):
  ans = ans + 1
  h_j = h[j]
  for k in observatories[j]:
    if h[k] >= h_j:
      ans = ans - 1
      break
print(ans)
Buggy python submission (verdict: Runtime Error):
import math

print(2 * math.pi * input())

Fixed submission:
import math

R = input()

print(2 * float(R) * math.pi)

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

print(2 * pi * input())

Fixed submission:
import math

R = input()

print(2 * float(R) * math.pi)

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

R = input()

try:
    R = int(R)
except:
    pass

if R =< 100 and R >= 1:
    print(R*2*pi)

Fixed submission:
import math

R = input()

print(2 * float(R) * math.pi)

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

R = input()

try:
    R = int(R)
except:
    pass

if R =< 100 and R >= 1:
    return R*2*pi

Fixed submission:
import math

R = input()

print(2 * float(R) * math.pi)

Buggy python submission (verdict: Runtime Error):
R = input()

if R >= 1 and R =< 100;
	return 2*R*pi
else:
  pass

Fixed submission:
import math

R = input()

print(2 * float(R) * math.pi)
Buggy python submission (verdict: Runtime Error):
A = []

N = input()
M = input()
for i in range(M):
  A = A.append(input())
rest = N - sum(A)

if rest >= 0:
  print(rest)
else:
  print(-1)

Fixed submission:
N, M = map(int, input().split())
A = input().split()
A_int = [int(n) for n in A]

rest = N - sum(A_int)
if rest >= 0:
  print(rest)
else:
  print(-1)
Buggy python submission (verdict: Time Limit Exceeded):
N = input()
A = input().split()

for i in range(len(A)+1):
  print(A.count(str(i+1)))

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
B = [0] * (n+1)

for a in A:
    B[a] += 1

print('\n'.join(map(str, B[1:])))

Buggy python submission (verdict: Runtime Error):
N = input()
A = input().split()

for i in range(int(N-1)):
  print(A.count(str(i+1)))

Fixed submission:
n = int(input())
A = list(map(int, input().split()))
B = [0] * (n+1)

for a in A:
    B[a] += 1

print('\n'.join(map(str, B[1:])))
Buggy python submission (verdict: Time Limit Exceeded):
def isLunlun(num):
    prev = num%10
    num = num//10
    while(num!=0):
        curr = num%10
        if(abs(curr - prev)>1):
            return False
        prev = curr
        num = num//10
    return True

k = int(input())
count = 0
i = 1
while count<k:
    if(isLunlun(i)):
        count+=1
    i+=1
print(i-1)


Fixed submission:
from queue import Queue
k = int(input())
q = Queue(maxsize = 10000000)
for i in range(1,10):
    q.put(i)
if(k<10):
    print(k)
else:
    count = 0
    while(count<k-1):
        ele = q.get()
        temp = ele%10
        if(temp-1>=0):
            q.put(int(str(ele)+str(temp-1)))
        q.put(int(str(ele)+str(temp)))
        if(temp+1<=9):
            q.put(int(str(ele)+str(temp+1)))
        count+=1
    print(q.get())
Buggy python submission (verdict: Runtime Error):
n, k  = input().split()
n = int(n)
k = int(k)

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

loop = False
count = 0
visited = []
i = 1
while(count != k):
	if i in visited: break
	visited.append(i)
	i = a[i-1]
	count += 1
print(visited)
if(count != k):
	itr = k%count
	print(visited[itr])
	# count = 0
	# i = 0
	# while(count != itr):
	# 	i = a[i-1]
	# 	count += 1
	# print(i,visited)
else:
	print(visited[len(visited)-1])


Fixed submission:
a = input()
b = input()
if len(a)+1 == len(b):
  if b[0:len(b)-1] == a:
    print("Yes")
  else:
    print("No")
else:
  print("No")

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
A = list(map(int,input().split()))

l = []
kari = 1


for i in range(N*2):
    l.append(A[kari-1])
    kari = A[kari-1]
    
    zyuuhuku = set(l)
    if len(zyuuhuku) != len(l):
        tometatokoro = A[kari-1]
        break
    


    
    

#繰り返しでもどったところの列番号
aaaa = l.index(tometatokoro)

#繰り返すループの長さ
kurikaesi = len(l)-aaaa

#ループ繰り返す余り
ans = K % kurikaesi


ans = ans + aaaa

#print(l)
#print(ans)
print(l[ans])









Fixed submission:
S = input()
T = input()

TT = T[:-1]



if S == TT:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math
import itertools

N,M,Q = map(int,input().split())
a =[0] * Q
b =[0] * Q
c =[0] * Q
d =[0] * Q
for i in range(Q):
    a[i] , b[i] , c[i] , d[i] = map(int,input().split())





def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))



All =[0] * M
for i in range(M):
    All[i] = i+1

#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。



#M個のうちからN個取り出す順列
ans = 0
#for A in itertools.combinations(All, N):
for A in itertools.product(All, repeat=N):
    
    
    #点数計算
    #print(A)
    wa = 0
    for i in range(Q):
        #print(wa) 
        kari = A[b[i]-1] - A[a[i]-1]
        if kari == c[i]:
            wa = wa + d[i] 
    if ans < wa:
        ans = wa
    #print(ans) 
    #print(wa) 


print(ans)



























Fixed submission:
K = int(input())
A,B = map(int,input().split())







Awari = -(-A // K)



if B >= Awari*K:
    print("OK")
else:
    print("NG")
Buggy python submission (verdict: Runtime Error):
import math
import itertools

N,M,Q = map(int,input().split())
a =[0] * Q
b =[0] * Q
c =[0] * Q
d =[0] * Q
for i in range(Q):
    a[i] , b[i] , c[i] , d[i] = map(int,input().split())





def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))



All =[0] * M
for i in range(M):
    All[i] = i+1

#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。



#M個のうちからN個取り出す順列
ans = 0
for A in itertools.product(All, N):
    #点数計算
    print(A)
    wa = 0
    for i in range(Q):
        print(wa) 
        kari = A[b[i]-1] - A[a[i]-1]
        if kari == c[i]:
            wa = wa + d[i] 
    if ans < wa:
        ans = wa
    #print(ans) 
    #print(wa) 


print(ans)



























Fixed submission:
import math
import itertools

N,M,Q = map(int,input().split())
a =[0] * Q
b =[0] * Q
c =[0] * Q
d =[0] * Q
for i in range(Q):
    a[i] , b[i] , c[i] , d[i] = map(int,input().split())




Al =[0] * M
for i in range(M):
    Al[i] = i+1


#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
#Nの値が小さそうなので全検索でもいけるかもしれへん。
All = list(itertools.combinations_with_replacement(Al, N))


#M個のうちからN個取り出す順列
ans = 0
#for A in itertools.combinations(All, N):
for A in All:
    #点数計算
    #print(A)
    wa = 0
    for i in range(Q):
        #print(wa) 
        kari = A[b[i]-1] - A[a[i]-1]
        if kari == c[i]:
            wa = wa + d[i] 
    if ans < wa:
        ans = wa
    #print(ans) 
    #print(wa) 


print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int,input().split()))
Ans = "YES"

for i in range(N):
    for j in range(N):
        if H[i] ==H[j] and i!=j:
            Ans = "NO"
    
print(Ans)

Fixed submission:
N = int(input())
H = list(map(int,input().split()))

Hlen = len(H)


Hsyugou = set(H)
Hhennkann = list(Hsyugou)
Hhennkannlen = len(Hhennkann)




if Hlen ==Hhennkannlen:
    print("YES")

else:
    print("NO")
Buggy python submission (verdict: Time Limit Exceeded):

N,K = map(int,input().split())
P = list(map(float,input().split()))

PP=P
for i in range(N):
    PP[i]=P[i]*0.5+0.5



ans = float(0)
final = 0
repeat = N-K+1
for j in range(repeat):
    ans = 0
    for i in range(K):
        ans = ans+PP[i+j]
        if final <= ans:
            final = ans
        
print(final)

Fixed submission:
N,K = map(int,input().split())
P = list(map(float,input().split()))

wa = float(0)
for i in range(K):
    wa = wa + P[i]

ans = wa 
  
repeat = N-K
for i in range(repeat):
    wa = wa + P[i+K]-P[i]
    if ans <= wa :
        ans = wa
      
print(ans/2+(K*0.5))

Buggy python submission (verdict: Runtime Error):
N,K = map(int,input().split())
P = list(map(int,input().split()))



PP = P *0.5+0.5

ans = float(0)
final = 0
repeat = N-K+1
for j in range(repeat):
    ans = 0
    for i in range(K):
        ans = ans+PP[i+j]
        if final <= ans :
            final = ans
        
print(final)

Fixed submission:
N,K = map(int,input().split())
P = list(map(float,input().split()))

wa = float(0)
for i in range(K):
    wa = wa + P[i]

ans = wa 
  
repeat = N-K
for i in range(repeat):
    wa = wa + P[i+K]-P[i]
    if ans <= wa :
        ans = wa
      
print(ans/2+(K*0.5))

Buggy python submission (verdict: Time Limit Exceeded):
N,K = map(int,input().split())
P = list(map(int,input().split()))




ans = float(0)
final = 0
repeat = N-K+1
for j in range(repeat):
    ans = 0
    for i in range(K):
        ans = ans+P[i+j]*0.5+0.5
        if final <= ans :
            final = ans
        
print(final)

Fixed submission:
N,K = map(int,input().split())
P = list(map(float,input().split()))

wa = float(0)
for i in range(K):
    wa = wa + P[i]

ans = wa 
  
repeat = N-K
for i in range(repeat):
    wa = wa + P[i+K]-P[i]
    if ans <= wa :
        ans = wa
      
print(ans/2+(K*0.5))

Buggy python submission (verdict: Runtime Error):
N,K = map(float,input().split())
P = list(map(float,input().split()))


Psoat = sorted(P, reverse=True)

ans = 0
for i in range(K):
    ans = ans+Psoat[i]*0.5+0.5
    

print(ans)

Fixed submission:
N,K = map(int,input().split())
P = list(map(float,input().split()))

wa = float(0)
for i in range(K):
    wa = wa + P[i]

ans = wa 
  
repeat = N-K
for i in range(repeat):
    wa = wa + P[i+K]-P[i]
    if ans <= wa :
        ans = wa
      
print(ans/2+(K*0.5))
Buggy python submission (verdict: Runtime Error):
A,B,X = map(int, input().split())

#値段の算出する関数
def nedan(N,A,B):
    Nmozi = str(N)
    lengs = len(Nmozi)
    ans = A * N  + B * lengs
    return ans


#Nの値を二分法で計算する。
MAX = 1000000000
MIN = 0

for i in range(500):
    CENTER = MIN + (MAX-MIN)//2
    if MAX - MIN < 0.5:
        break
#MAXとMINが同じになったら終了する。
    if nedan(CENTER,A,B) <= X:
        MIN = CENTER
    else:
        MAX = CENTER



if nedan(MAX,A,B) <= X:
    ANS = MAX
else:
    ANS = MIN

print(ANS)

Fixed submission:
S = input()

if S =="SUN":
    print(7)
elif S =="MON":
    print(6)
elif S =="TUE":
    print(5)
elif S =="WED":
    print(4)
elif S =="THU":
    print(3)
elif S =="FRI":
    print(2)
else:
    print(1)

Buggy python submission (verdict: Runtime Error):

N= input()
S= input()


N = int(N)
Len = len(S)#文字数の長さ
LIST = list(S)#文字列を1文字ごとに分割する。

ANSWER = ""
#リストの中身をループ
for SS in LIST:
    NUNBER = ord(SS)#アスキーコードを出す組み込み関数:1文字しか対応していない
    NUNBER = NUNBER -65#アスキーコードからアルファベット順に変更
    AFFTER = NUNBER + N
    LAST  = AFFTER % 26
    LAST  = chr(LAST+65)#アスキーコードからアルファベットに戻す
    ANSWER = ANSWER + LAST
    
print(ANSWER)

Fixed submission:
S = input()

if S =="SUN":
    print(7)
elif S =="MON":
    print(6)
elif S =="TUE":
    print(5)
elif S =="WED":
    print(4)
elif S =="THU":
    print(3)
elif S =="FRI":
    print(2)
else:
    print(1)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
A = list(map(int,input().split()))
A.sort()


for j in range(A[N-1]):
    #0以外の最小値取得
    for i in range(N-1):
        if A[i] >= 1:
            kari = A[i]
            kari2 = i
            break
    for i in range(N-1):
        if A[i+1] > 1 and i >= kari2:
            A[i+1] = A[i+1]-kari
        A.sort()

    if A[N-2] == 0:
        break
       
ans = max(A)    


print(ans)





Fixed submission:
def gcd(a, b):
  while b > 0:
    a, b = b, a%b
  return a



N = int(input())
A = list(map(int,input().split()))
#単純に最大公約数を算出すればよい

kari = A[0]
for i in range(N):
    kari = gcd(kari, A[i])

 


print(kari)
Buggy python submission (verdict: Runtime Error):
a=int(input())
print(2a*3.1415926535)

Fixed submission:
a=int(input())
print(2*a*3.1415926535)
Buggy python submission (verdict: Runtime Error):
h=int(input())
a=0
while True:
 h=h//2
 a+=1
 if =h//2==0:
  break

print(2**a-1)


Fixed submission:
h=int(input())
a=1

if h ==1:
 print(1)
else:
 while True:
  h=h//2
  a+=1
  if h//2==0:
   break

 print(2**a-1)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())

if a-2b>=0:
  print a-2b
else:
  print 0

Fixed submission:
a,b=map(int,input().split())

if a-2*b>=0:
  print(a-2*b)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
n=int(input())
if n%2=0:
  print(0.5)
elif:
  print ((n//2)/n)

Fixed submission:
n=int(input())
if n%2==0:
  print (0.5)
else:
  print (1-((n//2)/n))

Buggy python submission (verdict: Runtime Error):
n=int(input())
if n%2=0:
  print 0.5
elif:
  print ((n//2)/n)

Fixed submission:
n=int(input())
if n%2==0:
  print (0.5)
else:
  print (1-((n//2)/n))
Buggy python submission (verdict: Runtime Error):
H,W=map(int,input().split())
h,w=map(int,input().split())
X=(H-h)*(W-w)
print(x)

Fixed submission:
H,W=map(int,input().split())
h,w=map(int,input().split())
X=(H-h)*(W-w)
print(X)
Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
if a >= n%500:
  print('Yes')
else:
  print('No')

Fixed submission:
n=int(input())
a=int(input())
if a >= n%500:
  print('Yes')
else:
  print('No')

Buggy python submission (verdict: Runtime Error):
n,a=map(int,input().split())
if a>=(n%500):
  print('Yes')
else:
  print('No')

Fixed submission:
n=int(input())
a=int(input())
if a >= n%500:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a%3 ==0:
  print('Possible')
elif b%3 ==0:
  print('Possible')
elif (a+b)%3 ==0:
  print('Possible')
else
  print('Impossible')

Fixed submission:
a,b=map(int,input().split())
if a%3 ==0:
  print('Possible')
elif b%3 ==0:
  print('Possible')
elif (a+b)%3 ==0:
  print('Possible')
else:
  print('Impossible')
Buggy python submission (verdict: Runtime Error):
S = str(input())
if S = "ABC":
  print("ARC")
else:
  print("ABC")

Fixed submission:
S = str(input())
if S == "ARC":
  print("ABC")
else:
  print("ARC")
Buggy python submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
x = min(N, B-1)
a = A*x//B - A*(x//B)
print(a)


Fixed submission:
K = int(input())
A,B = map(int,input().split())
i=1
while i<=B:
  if K*i>=A and K*i<=B:
    print("OK")
    break
  else:
    i += 1
if i == B+1:
  print("NG")

Buggy python submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
x = 0
a = 0
while x <= B-1:
  if x%B != 0 and a < A*x//B - A*(x//B):
    a = A*x//B - A*(x//B)
    x -= 1
  else:
    x -= 1
print(a)


Fixed submission:
K = int(input())
A,B = map(int,input().split())
i=1
while i<=B:
  if K*i>=A and K*i<=B:
    print("OK")
    break
  else:
    i += 1
if i == B+1:
  print("NG")

Buggy python submission (verdict: Runtime Error):
A,B,N = map(int,input().split())
x = N
a = 0
while x>999*N//1000:
  if x%B != 0 and a < A*x//B - A*(x//B):
    a = A*x//B - A*(x//B)
    x -= 1
  else:
    x -= 1
print(a)

Fixed submission:
K = int(input())
A,B = map(int,input().split())
i=1
while i<=B:
  if K*i>=A and K*i<=B:
    print("OK")
    break
  else:
    i += 1
if i == B+1:
  print("NG")
Buggy python submission (verdict: Time Limit Exceeded):
A,B,N = map(int,input().split())
x = N
a = 0
while x>999*N//1000:
  if x%B != 0 and a < A*x//B - A*(x//B):
    a = A*x//B - A*(x//B)
    x -= 1
  else:
    x -= 1
print(a)

Fixed submission:
A,B,N = map(int,input().split())
x = min(N, B-1)
a = A*x//B - A*(x//B)
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N = map(int,input().split())
x = N
a = 0
while x>9*N//10:
  if x%B != 0 and a < A*x//B - A*(x//B):
    a = A*x//B - A*(x//B)
    x -= 1
  else:
    x -= 1
print(a)

Fixed submission:
A,B,N = map(int,input().split())
x = min(N, B-1)
a = A*x//B - A*(x//B)
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N = map(int,input().split())
x = N
a = 0
while x>N//2:
  if x%B != 0 and a < A*x//B - A*(x//B):
    a = A*x//B - A*(x//B)
    x -= 1
  else:
    x -= 1
print(a)

Fixed submission:
A,B,N = map(int,input().split())
x = min(N, B-1)
a = A*x//B - A*(x//B)
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N = map(int,input().split())
x = 0
a = 0
while x<=N:
  if x%B != 0 and a < A*x//B - A*(x//B):
    a = A*x//B - A*(x//B)
    x += 1
  else:
    x += 1
print(a)

Fixed submission:
A,B,N = map(int,input().split())
x = min(N, B-1)
a = A*x//B - A*(x//B)
print(a)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N = map(int,input().split())
x = 0
a = 0
while x<=N:
  if a < A*x//B - A*(x//B):
    a = A*x//B - A*(x//B)
    x += 1
  else:
    x += 1
print(a)

Fixed submission:
A,B,N = map(int,input().split())
x = min(N, B-1)
a = A*x//B - A*(x//B)
print(a)
Buggy python submission (verdict: Runtime Error):
count = int(input())

data = list(map(int,input().split()))

total = 0

for i in range(count):
    a =data.count(i + 1)
    print(a)
    if total + a+1 == count:
        print("0 \n" *(count - i))
        break

Fixed submission:
import math

r = int(input())

print(r * 2 * math.pi)

Buggy python submission (verdict: Runtime Error):
count = int(input())

data = list(map(int,input().split()))

total = 0

for i in range(count):
    a =data.count(i + 1)
    print(a)
    if total + a+1 == count:
        print("0 \n" *(count - i))
        break

Fixed submission:
import math

r = int(input())

print(r * 2 * math.pi)
Buggy python submission (verdict: Time Limit Exceeded):

N = int(input())

A = list(map(int, input().split()))
ans = 0

plus = []
minus = []

for i, j in enumerate(A):
    plus.append(i+j)
    minus.append(i-j)

for i in plus:
    for j in minus:
        if i == j:
            ans += 1
print(ans)

Fixed submission:
from collections import Counter
N = int(input())

A = list(map(int, input().split()))
ans = 0

plus = []
minus = []

for i, j in enumerate(A):
    # print(i, j)
    plus.append(i+j)
    minus.append(i-j)

# print(plus)
# print(minus)

plus_count = Counter(plus)
minus_count = Counter(minus)
# print(plus_count)
# print(minus_count)


for i,j in plus_count.items():
    # print(i, j)
    if i in minus_count:
        ans += j * minus_count[i]
        # print(i, j)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools as it
import numpy as np

N = int(input())

A = list(map(int, input().split()))
ans = 0
for i in range(N):
    for j in range(N):
        if j-i == A[i] + A[j]:
            ans += 1

print(ans)

Fixed submission:
from collections import Counter
N = int(input())

A = list(map(int, input().split()))
ans = 0

plus = []
minus = []

for i, j in enumerate(A):
    # print(i, j)
    plus.append(i+j)
    minus.append(i-j)

# print(plus)
# print(minus)

plus_count = Counter(plus)
minus_count = Counter(minus)
# print(plus_count)
# print(minus_count)


for i,j in plus_count.items():
    # print(i, j)
    if i in minus_count:
        ans += j * minus_count[i]
        # print(i, j)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import math
 
K = int(input())
 
sum = 0
for i in range(K):
    for j in range(K):
        for k in range(K):
            sum += math.gcd(math.gcd(i+1, j+1), k+1)
            
print(sum)

Fixed submission:
import math
 
K = int(input())
 
sum = 0
for i in range(K):
    for j in range(K):
        r = math.gcd(i+1, j+1)
        for k in range(K):
            sum += math.gcd(r, k+1)
            
print(sum)