Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
# 5

s = input()
n = 0

while len(s) >= 0:
    if not('ST' in s):
        break
    else:
        s = s.replace('ST', '')
        #print(s)

print(len(s))
#print(s)

Fixed submission:
# 05

s = input()
x = 0
y = 0
for i in s:
    if i == 'S':
        y -= 1
    else:
        y += 1
    #print(x, y)
    x = max(x, y)
    
print(x*2)
Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
p = 1

for i in range(a, b+1):
    p *= i
if p > 0:
    print("Positive")
elif p < 0:
    print("Negative")
else:
    print("Zero")

Fixed submission:
a, b = map(int, input().split())
if 0 < a <= b:
    print("Positive")
elif a <= b < 0:
    if (b-a+1) % 2 == 0:
        print("Positive") 
    else:
        print("Negative")
else:
    print("Zero")

Buggy python submission (verdict: Time Limit Exceeded):
a, b = map(int, input().split())
p = 1

while a <= b:
    p *= a
    a += 1

if p > 0:
    print("Positive")
elif p == 0:
    print("Zero")
else:
    print("Negative")

Fixed submission:
a, b = map(int, input().split())
if 0 < a <= b:
    print("Positive")
elif a <= b < 0:
    if (b-a+1) % 2 == 0:
        print("Positive") 
    else:
        print("Negative")
else:
    print("Zero")
Buggy python submission (verdict: Runtime Error):
chr = input()

print ord(chr)

Fixed submission:
chr  = input();
ans = 'A' if ord(chr) >=65 and ord(chr) <= 90 else 'a'
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys

r = input()
print(r * r)

Fixed submission:
import sys

r = input()
print(int(r) * int(r))

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

r = input()
print (r * r)

Fixed submission:
import sys

r = input()
print(int(r) * int(r))

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

radius = input()
print (radius * radius)

Fixed submission:
import sys

r = input()
print(int(r) * int(r))

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

radius = sys.argv[0]
print (radius * radius)

Fixed submission:
import sys

r = input()
print(int(r) * int(r))
Buggy python submission (verdict: Runtime Error):
X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    P = list(map(int, input().split()))
    for i in range(1,102):
        if (X-i) not in P:
            print(X-i)
            break
        elif (X+i) not in P:
            print(X+i)
            break
    else:
        print(X)
        break

Fixed submission:
X, N = map(int, input().split())
if N == 0:
    print(X)
else:
    P = list(map(int, input().split()))
    for i in range(1000):
        if (X-i) not in P:
            print(X-i)
            break
        elif (X+i) not in P:
            print(X+i)
            break
Buggy python submission (verdict: Runtime Error):
## C
N, M = map( int, input().split() )
H = [0] + list(map(int, input().split()) )
X = [[] for x in range(N+1)]
for i in range(M):
    A, B = map(int, input().split())
    X[A].append(H[B])
    X[B].append(H[A])
rt = 0
for i in range(1, N+1):
    if H[i] > max(X[i]):
        rt += 1
print(rt)

Fixed submission:
N, M = map( int, input().split() )
H = list(map(int, input().split()) )
flg = [1] * N
for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    if H[A] > H[B]:
        flg[B] = 0
    elif H[A] < H[B]:
        flg[A] = 0
    elif H[A] == H[B]:
        flg[A] = 0
        flg[B] = 0
print(sum(flg))

Buggy python submission (verdict: Runtime Error):
## C
N, M = map( int, input().split() )
H = list(map(int, input().split()) )
AB = [list( map( int,input().split() ) ) for x in range(M)]
comp = [[0 for j in range(1)] for i in range(N)]
for i in range(M):
    comp[AB[i][0]-1].append(AB[i][1])
val = 0
for i in range(M):
    if len(set(comp[i])) > 1:
        val += 1
print(val + N - len(set(sum(AB, []) ) ) )

Fixed submission:
N, M = map( int, input().split() )
H = list(map(int, input().split()) )
flg = [1] * N
for i in range(M):
    A, B = map(int, input().split())
    A -= 1
    B -= 1
    if H[A] > H[B]:
        flg[B] = 0
    elif H[A] < H[B]:
        flg[A] = 0
    elif H[A] == H[B]:
        flg[A] = 0
        flg[B] = 0
print(sum(flg))
Buggy python submission (verdict: Time Limit Exceeded):
## D
X = int(input())
Y = [y**5 for y in range(100000)]
for a in range(0, 100000):
    for b in range(1+a, 100000):
        if Y[a] - Y[b] == X:
            print(a, b)
            exit
        if Y[a] + Y[b] == X:
            print(a, -b)
            exit

Fixed submission:
## D
X = int(input())
lp = 1000
for a in range(-lp, lp):
    for b in range(-lp, lp):
        if a**5 - b**5 == X:
            print(a, b)
            break
    else:
        continue
    break
Buggy python submission (verdict: Runtime Error):
X = int(input())
base = 100
rt = 0
while X > base:
    base = math.floor(base * 1.01)
    rt += 1
print(rt)

Fixed submission:
import math
X = int(input())
base = 100
rt = 0
while X > base:
    base = math.floor(base * 1.01)
    rt += 1
print(rt)
Buggy python submission (verdict: Runtime Error):
## B - Iron Bar Cutting
N = int(input())
A = list(map(int, input().split()))
val = sum(A)//2
tmp = 0
for n in range(N):
    tmp += A[n]
    if tmp >= val:
        print( min( abs(sum(A[n+1:] - tmp ), abs(sum(A[n:] - tmp - A[n] ) )
        break

Fixed submission:
## B - Iron Bar Cutting
N = int(input())
A = list(map(int, input().split()))
L = 0
R = sum(A)
ans = sum(A)
for n in range(N):
    L += A[n]
    R -= A[n]
    if ans > abs(L-R):
        ans = abs(L-R)
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
## B - Iron Bar Cutting
N = int(input())
A = list(map(int, input().split()))
ans = []
for n in range(1,N):
    ans.append(abs(sum(A[:n]) - sum(A[n:])))
print(min(ans))

Fixed submission:
## B - Iron Bar Cutting
N = int(input())
A = list(map(int, input().split()))
L = 0
R = sum(A)
ans = sum(A)
for n in range(N):
    L += A[n]
    R -= A[n]
    if ans > abs(L-R):
        ans = abs(L-R)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
if n >= 2:
     prime_nums = [2]
     for i in range(3, n + 1):
         for p in prime_nums:
             if i % p == 0:
                 break
         else:
             prime_nums.append(i)
for x in prime_nums[::-1]:
    if n % x == 0:
        print(x + n//x - 2)
        break

Fixed submission:
N = int(input())
val = []
for a in range(int(N**0.5)+1):
  b, mod = divmod(N, a+1)
  if mod == 0:
    val.append( (a+1) + b - 2 )
print(min(val))
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list( map( int, input().split() ) )
comb = [' '.join( str(n) for n in sorted( [L[a],L[b],L[c]] ) ) for a in range(N) for b in range(1+a,N) for c in range(1+b,N) if (L[a] + L[b] > L[c]) and (L[b] + L[c] > L[a]) and (L[c] + L[a] > L[b])]
print( len( set(comb) ) )

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

import bisect
L=sorted(L)
comb = 0
for a in range(N-2):
    for b in range(1+a,N-1):
        posIndex = bisect.bisect_left(L, L[a] + L[b])
        comb += posIndex - b - 1 if posIndex != 0 else 0
print(comb)

Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N = int(input())
L = list( map( int, input().split() ) )
comb = []
for n in itertools.combinations(L, 3):
  if (n[0] + n[1] > n[2]) and (n[1] + n[2] > n[0]) and (n[2] + n[0] > n[1]):
        comb.append( ' '.join( str(x) for x in sorted(n) ) )
print( len( set(comb) ) )

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

import bisect
L=sorted(L)
comb = 0
for a in range(N-2):
    for b in range(1+a,N-1):
        posIndex = bisect.bisect_left(L, L[a] + L[b])
        comb += posIndex - b - 1 if posIndex != 0 else 0
print(comb)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
L = list( map( int, input().split() ) )
comb = []
for a in range(N):
  for b in range(1,N):
    if a == b:
      continue
    for c in range(2,N):
      if b == c or c == a:
        continue
      if (L[a] + L[b] > L[c]) and (L[b] + L[c] > L[a]) and (L[c] + L[a] > L[b]):
        comb.append( ' '.join( str(n) for n in sorted( [L[a],L[b],L[c]] ) ) )
print( len( set(comb) ) )

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

import bisect
L=sorted(L)
comb = 0
for a in range(N-2):
    for b in range(1+a,N-1):
        posIndex = bisect.bisect_left(L, L[a] + L[b])
        comb += posIndex - b - 1 if posIndex != 0 else 0
print(comb)
Buggy python submission (verdict: Time Limit Exceeded):
## C - Christmas Eve
import itertools
N, K = map(int, input().split())
rt = [max(x)-min(x) for x in list(itertools.combinations([int(input()) for i in range(N)], K))]
print(min(rt))

Fixed submission:
## C - Christmas Eve
N, K = map(int, input().split())
H = sorted([int(input()) for i in range(N)])
rt = 10**9
for i in range(0,N-K+1):
    rt = H[K - 1 + i] - H[i] if rt > H[K - 1 + i] - H[i] else rt
print(rt)
Buggy python submission (verdict: Runtime Error):
import math
n, m,X = map(int, input().split(),1)
for i in range(1,32000):
	if m%i==0:
		if i*n<=m:
			X=max(X, i)
		if (m//i)*n<=m:
			X=max(X, m//i)
print(X)

Fixed submission:
import math
n, m = map(int, input().split())
kotae=1

for i in range(1,int(math.sqrt(m))+1):
	if m%i==0:
		if i*n<=m:
			kotae=max(kotae, i)
		if (m//i)*n<=m:
			kotae=max(kotae, m//i)
print(kotae)

Buggy python submission (verdict: Runtime Error):
import math
n, m = map(int, input().split()) X=1
for i in range(1,32000):
	if m%i==0:
		if i*n<=m:
			X=max(X, i)
		if (m//i)*n<=m:
			X=max(X, m//i)
print(X)

Fixed submission:
import math
n, m = map(int, input().split())
kotae=1

for i in range(1,int(math.sqrt(m))+1):
	if m%i==0:
		if i*n<=m:
			kotae=max(kotae, i)
		if (m//i)*n<=m:
			kotae=max(kotae, m//i)
print(kotae)

Buggy python submission (verdict: Runtime Error):
import math
n, m = map(long, input().split())
kotae=1

for i in range(1,long(math.sqrt(m))+1):
	if m%i==0:
		if i*n<=m:
			kotae=max(kotae, i)
		if (m/i)*n<=m:
			kotae=max(kotae, int(m/i))
print(kotae)

Fixed submission:
import math
n, m = map(int, input().split())
kotae=1

for i in range(1,int(math.sqrt(m))+1):
	if m%i==0:
		if i*n<=m:
			kotae=max(kotae, i)
		if (m//i)*n<=m:
			kotae=max(kotae, m//i)
print(kotae)

Buggy python submission (verdict: Runtime Error):
import math
n, m = map(long, input().split())
kotae=1

for i in range(1,long(math.sqrt(m))+1):
	if m%i==0:
		if i*n<=m:
			kotae=max(kotae, i)
		if (m/i)*n<=m:
			kotae=max(kotae, m/i)
print(kotae)

Fixed submission:
import math
n, m = map(int, input().split())
kotae=1

for i in range(1,int(math.sqrt(m))+1):
	if m%i==0:
		if i*n<=m:
			kotae=max(kotae, i)
		if (m//i)*n<=m:
			kotae=max(kotae, m//i)
print(kotae)

Buggy python submission (verdict: Runtime Error):
import math
n, m = map(int, input().split())
kotae=1

for i in range(1,int(math.sqrt(m))+1):
  if m%i==0:
    if i*n<=m:
	  kotae=max(kotae,i)
    if (m/i)*n<=m:
      kotae=max(kotae,i)
print(kotae)

Fixed submission:
import math
n, m = map(int, input().split())
kotae=1

for i in range(1,int(math.sqrt(m))+1):
	if m%i==0:
		if i*n<=m:
			kotae=max(kotae, i)
		if (m//i)*n<=m:
			kotae=max(kotae, m//i)
print(kotae)
Buggy python submission (verdict: Runtime Error):
import math


n, x = map(int,input().split())
li_x = list(map(int,input().split()))

for i in range(len(li_x)):
  if li_x[i] - x < 0:
    li_x[i] =x - li_x[i]
  else:
    li_x[i] = li_x[i] -x

if len(li_x)==1:
  print(li_x[0])

elif len(li_x)==2:
  print(gcd(li_x[0],li_x[1]))

else:
  g =gcd(li_x[0],li_x[1])
  k=2
  while k<len(li_x):
    g=gcd(g,li_x[k])
    k+=1
  print(g)

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)


Fixed submission:
import math

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

n, x = map(int,input().split())
li_x = list(map(int,input().split()))

for i in range(len(li_x)):
  if li_x[i] - x < 0:
    li_x[i] =x - li_x[i]
  else:
    li_x[i] = li_x[i] -x

if len(li_x)==1:
  print(li_x[0])

elif len(li_x)==2:
  print(gcd(li_x[0],li_x[1]))

else:
  g =gcd(li_x[0],li_x[1])
  k=2
  while k<len(li_x):
    g=gcd(g,li_x[k])
    k+=1
  print(g)

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

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)
      

n, x = map(int,input().split())
li_x = list(map(int,input().split()))

for i in range(len(li_x)):
    if li_x[i] - x < 0:
        li_x[i] =x - li_x[i]
    else:
        li_x[i] = li_x[i] -x

g =gcd(li_x[0],li_x[1])
k=2
if len(li_x)>2:
  while k<len(li_x):
    g=gcd(g,li_x[k])
    k+=1
print(g)


Fixed submission:
import math

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

n, x = map(int,input().split())
li_x = list(map(int,input().split()))

for i in range(len(li_x)):
  if li_x[i] - x < 0:
    li_x[i] =x - li_x[i]
  else:
    li_x[i] = li_x[i] -x

if len(li_x)==1:
  print(li_x[0])

elif len(li_x)==2:
  print(gcd(li_x[0],li_x[1]))

else:
  g =gcd(li_x[0],li_x[1])
  k=2
  while k<len(li_x):
    g=gcd(g,li_x[k])
    k+=1
  print(g)

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

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)
      

n, x = map(int,input().split())
li_x = list(map(int,input().split()))

for i in range(len(li_x)):
    if li_x[i] - x < 0:
        li_x[i] =x - li_x[i]
    else:
        li_x[i] = li_x[i] -x

g =gcd(li_x[0],li_x[1])
k=2
while k<len(li_x):
  g=gcd(g,li_x[k])
  k+=1
print(g)


Fixed submission:
import math

def gcd(x, y):
  if y == 0:
    return x
  else:
    return gcd(y, x % y)

n, x = map(int,input().split())
li_x = list(map(int,input().split()))

for i in range(len(li_x)):
  if li_x[i] - x < 0:
    li_x[i] =x - li_x[i]
  else:
    li_x[i] = li_x[i] -x

if len(li_x)==1:
  print(li_x[0])

elif len(li_x)==2:
  print(gcd(li_x[0],li_x[1]))

else:
  g =gcd(li_x[0],li_x[1])
  k=2
  while k<len(li_x):
    g=gcd(g,li_x[k])
    k+=1
  print(g)
Buggy python submission (verdict: Runtime Error):
a=input()
c=False
f=False
for i in range(len(a)):
  if c==True:
    if a[i]=='F':
    f=True
  else:
    if a[i]=='C':
    c=True
if c==True and f==True:
  print("Yes")
else:
  print("No")

Fixed submission:
a=input()
c=False
f=False
for i in range(len(a)):
    if c==True:
        if a[i]=='F':
            f=True
    else:
        if a[i]=='C':
            c=True
if c==True and f==True:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a=input()
c=False
f=False
for i in range(len(a))
  if c==True:
    if a[i]=='F':
    f=True
  else:
    if a[i]=='C':
    c=True
if c==True and f==True:
  print("Yes")
else:
  print("No")

Fixed submission:
a=input()
c=False
f=False
for i in range(len(a)):
    if c==True:
        if a[i]=='F':
            f=True
    else:
        if a[i]=='C':
            c=True
if c==True and f==True:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a=input()
c=False
f=False
for i in range(len(a))
  if c==True:
    if a[i]=='F'
    f=True
  else:
    if a[i]=='C'
    c=True
if c==True and f==True:
  print("Yes")
else:
  print("No")

Fixed submission:
a=input()
c=False
f=False
for i in range(len(a)):
    if c==True:
        if a[i]=='F':
            f=True
    else:
        if a[i]=='C':
            c=True
if c==True and f==True:
    print("Yes")
else:
    print("No")

Buggy python submission (verdict: Runtime Error):
a=input()
c=False
f=False
for i in range(len(a))
  if c:
    if a[i]=='F'
    f=True
  else:
    if a[i]=='C'
    c=True
if c and f:
  print("Yes")
else:
  print("No")

Fixed submission:
a=input()
c=False
f=False
for i in range(len(a)):
    if c==True:
        if a[i]=='F':
            f=True
    else:
        if a[i]=='C':
            c=True
if c==True and f==True:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
a=input()
ans="CODEFESTIVAL2016"
diff=0
for i in range(16):
  if a[i]!=ans[i]:
    diff++
print(diff)

Fixed submission:
a=input()
ans="CODEFESTIVAL2016"
diff=0
for i in range(16):
  if a[i]!=ans[i]:
    diff+=1
print(diff)
Buggy python submission (verdict: Time Limit Exceeded):
def main():
	flag = True
	N = int(input())
	arr = list(map(int, input().split()))
	ans = arr[0]
	for i in range(1, N):
		ans *= arr[i]
	if ans > 1000000000000000000:
		print(-1)
	else:
		print(ans)


if __name__ == '__main__':
	main()

Fixed submission:
def main():
	N = int(input())
	arr = list(map(int, input().split()))
	ans = arr[0]
	if arr.count(0) > 0:
		print(0)
		return
	for i in range(1, N):
		ans *= arr[i]
		if ans > 1000000000000000000:
			print(-1)
			return
	print(ans)


if __name__ == '__main__':
	main()
Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(N):
  ans*=A[i]
if ans>10**18:
  print(-1)
else:
  print(ans)

Fixed submission:
import sys
N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=1
for i in range(N):
  ans*=A[i]
  if ans>10**18:
    print(-1)
    sys.exit()
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(input())
ans=0
for i in range(2,int(N**(1/2))+1):
  if N%i==0:
    break
  if i==int(N**(1/2)):
    print(1)
    sys.exit()
i=1
k=1
while N % (2**i) == 0:
  ans+=1
  N=N//(2**i)
  i+=1
while N % 2 == 0:
  N=N//2
f=3
while f <= N:
  if N % (f**k) == 0:
    ans+=1
    N=N//(f**k)
    k+=1
  else:
    while N % f == 0:
      N=N//f
    f += 2
    k=1
print(ans)

Fixed submission:
N=int(input())
ans=0
for i in range(2,10**6+1):
  anssub=0
  t=0
  while N%i==0:
    N=N//i
    anssub+=1
  while t*(t+1)//2<=anssub:
    t+=1  
  ans+=t-1
if N!=1:
  ans+=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
import sys
N=int(input())
ans=0
for i in range(2,int(N**(1/2))+1):
  if N%i==0:
    break
  if i==int(N**(1/2)):
    print(1)
    sys.exit()
i=1
k=1
while N % (2**i) == 0:
  ans+=1
  N=N//(2**i)
  i+=1
while N % 2 == 0:
  N=N//2
f=3
while f <= N:
  if N % (f**k) == 0:
    ans+=1
    N=N//(f**k)
    k+=1
  else:
    while N % f == 0:
      N=N//f
    f += 2
    k=1
print(ans)

Fixed submission:
N=int(input())
ans=0
for i in range(2,10**6+1):
  anssub=0
  t=0
  while N%i==0:
    N=N//i
    anssub+=1
  while t*(t+1)//2<=anssub:
    t+=1  
  ans+=t-1
if N!=1:
  ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np
N,M=map(int,input().split())
listH=list(map(int,input().split()))
listN=np.zeros((N,N))
for i in range(M):
  A,B=map(int,input().split())
  if listH[A-1]>listH[B-1]:
    listN[A-1][B-1]=A
    listN[B-1][A-1]=A
  if listH[A-1]<listH[B-1]:
    listN[A-1][B-1]=B
    listN[B-1][A-1]=B
  else:
    listN[A-1][B-1]=-1
    listN[B-1][A-1]=-1
ans=0
for i in range(N):
  if len(set(listN[i]))==2 and (i+1 in set(listN[i])):
    ans+=1
  if len(set(listN[i]))==1:
    ans+=1
print(ans)    

Fixed submission:
N,M=map(int,input().split())
listH=list(map(int,input().split()))
listN=[0]*N
for i in range(M):
  A,B=map(int,input().split())
  if listH[A-1]>listH[B-1]:
    listN[B-1]=-1
  if listH[A-1]<listH[B-1]:
    listN[A-1]=-1
  if listH[A-1]==listH[B-1]:
    listN[A-1]=-1
    listN[B-1]=-1   
ans=0    
for i in listN:
  if i>=0:
    ans+=1
print(ans)
Buggy python submission (verdict: Runtime Error):
import sys
N,M,Q=map(int,input().split())
ABC=[]
ans=0
take=set([])
for i in range(Q):
  ABC+=[list(map(int,input().split()))]
ABC.sort(key=lambda x: x[3],reverse=True)
for i in range(N):
  if len(take)==N:
    print(ans)
    sys.exit
  ans+=ABC[i][3]
  take.add(ABC[i][0])
  take.add(ABC[i][1])
  take=set(take)

Fixed submission:
import itertools
N,M,Q=map(int,input().split())
listA=itertools.combinations_with_replacement(range(1,M+1),N)
ans=0
listQ=[]
for q in range(Q):
  listQ+=[list(map(int,input().split()))]
for i in listA:
  anssub=0
  for a,b,c,d in listQ:
    if i[b-1]-i[a-1]==c:
      anssub+=d
  ans=max(ans,anssub)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
A,B,N=map(int,input().split())
X=B-1
ans=(A*N)//B-A*(N//B)
while X<=N:
  ans=max(ans,(A*X)//B-A*(X//B))
  X+=B
print(ans) 

Fixed submission:
import sys
A,B,N=map(int,input().split())
X=B-1
ans=(A*N)//B-A*(N//B)
if B==1:
  print(0)
  sys.exit()
while X<=N:
  ans=max(ans,(A*X)//B-A*(X//B))
  X+=B
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
A,B,N=map(int,input().split())
X=B-1
ans=(A*N)//B-A*(N//B)
while X<=N:
  ans=max(ans,(A*X)//B-A*(X//B))
  X+=B
print(ans) 

Fixed submission:
import sys
A,B,N=map(int,input().split())
X=B-1
ans=(A*N)//B-A*(N//B)
if B==1:
  print(0)
  sys.exit()
while X<=N:
  ans=max(ans,(A*X)//B-A*(X//B))
  X+=B
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
import itertools
N=int(input())
listA=list(map(int,input().split()))
listA.sort()
listA2=[0]*N
for i in listA:
  listA2[i-1]+=1
for i in range(1,N+1):
  if i in listA:
    print(listA2[i-1])
  else:
    print(0)

Fixed submission:
import itertools
N=int(input())
listA=list(map(int,input().split()))
listA.sort()
listA2=[0]*N
for i in listA:
  listA2[i-1]+=1
listA=set(listA)  
for i in range(1,N+1):
  if i in listA:
    print(listA2[i-1])
  else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
listA=list(map(int,input().split()))
listA.sort()
listA2=[0]*N
for i in listA:
  listA2[i-1]+=1
for i in range(1,N+1):
  if i in listA:
    print(listA2[i-1])
  else:
    print(0)

Fixed submission:
import itertools
N=int(input())
listA=list(map(int,input().split()))
listA.sort()
listA2=[0]*N
for i in listA:
  listA2[i-1]+=1
listA=set(listA)  
for i in range(1,N+1):
  if i in listA:
    print(listA2[i-1])
  else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
listA=list(map(int,input().split()))
listA.sort()  
for i in range(1,N):
  ans=listA.count(i)
  print(ans)
print(0)

Fixed submission:
import itertools
N=int(input())
listA=list(map(int,input().split()))
listA.sort()
listA2=[0]*N
for i in listA:
  listA2[i-1]+=1
listA=set(listA)  
for i in range(1,N+1):
  if i in listA:
    print(listA2[i-1])
  else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
listA=list(map(int,input().split()))
for i in range(1,N):
  ans=listA.count(i)
  print(ans)
print(0)

Fixed submission:
import itertools
N=int(input())
listA=list(map(int,input().split()))
listA.sort()
listA2=[0]*N
for i in listA:
  listA2[i-1]+=1
listA=set(listA)  
for i in range(1,N+1):
  if i in listA:
    print(listA2[i-1])
  else:
    print(0)

Buggy python submission (verdict: Time Limit Exceeded):
N=int(input())
listA=list(map(int,input().split()))
for i in range(1,N):
  ans=listA.count(i)
  print(ans)
print(0)

Fixed submission:
import itertools
N=int(input())
listA=list(map(int,input().split()))
listA.sort()
listA2=[0]*N
for i in listA:
  listA2[i-1]+=1
listA=set(listA)  
for i in range(1,N+1):
  if i in listA:
    print(listA2[i-1])
  else:
    print(0)
Buggy python submission (verdict: Time Limit Exceeded):
import math
K=int(input())
ans=0
for a in range(1,K+1):
  for b in range(1,K+1):
    for c in range(1,K+1):
      gcd=math.gcd(a,b)
      gcd=math.gcd(gcd,c)
      ans+=gcd
print(ans)

Fixed submission:
import math
K=int(input())
ans=0
for a in range(1,K+1):
  for b in range(1,K+1):
    for c in range(1,K+1):
      gcd=math.gcd(a,b)
      gcd=math.gcd(gcd,c)
      ans+=gcd
print(ans)