Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
import numpy as np

N,K = map(int, input().split())

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

dp = np.zeros(K+1)

for k in range(0,K+1):
    for i in A:
        if dp[k] == 0 and k-i >= 0 and dp[k-i] == 0:
            dp[k] = 1

            
if dp[k] == 1:
    print('First')
else:
    print('Second')

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

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

dp = [0] * (K+1)

for k in range(0,K+1):
    for i in A:
        if dp[k] == 0 and k-i >= 0 and dp[k-i] == 0:
            dp[k] = 1

            
if dp[k] == 1:
    print('First')
else:
    print('Second')

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

N,K = map(int, sys.stdin.readline().split())

A = list(map(int, sys.stdin.readline().split()))

dp = np.zeros(K+1)

for k in range(0,K+1):
    for i in A:
        if dp[k] == 0 and k-i >= 0 and dp[k-i] == 0:
            dp[k] = 1

            
if dp[k] == 1:
    print('First')
else:
    print('Second')

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

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

dp = [0] * (K+1)

for k in range(0,K+1):
    for i in A:
        if dp[k] == 0 and k-i >= 0 and dp[k-i] == 0:
            dp[k] = 1

            
if dp[k] == 1:
    print('First')
else:
    print('Second')

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

N,K = map(int, sys.stdin.readline().split())

A = list(map(int, sys.stdin.readline().split()))

dp = np.zeros(K+1)

for k in range(0,K+1):
    win = False
    for i in A:
        if win:
            break
        elif k-i >= 0 and dp[k-i] == 0:
            dp[k] = 1
            win = True
            
if win:
    print('First')
else:
    print('Second')

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

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

dp = [0] * (K+1)

for k in range(0,K+1):
    for i in A:
        if dp[k] == 0 and k-i >= 0 and dp[k-i] == 0:
            dp[k] = 1

            
if dp[k] == 1:
    print('First')
else:
    print('Second')

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

N,K = map(int, sys.stdin.readline().split())

A = list(map(int, sys.stdin.readline().split()))

dp = np.zeros(K+1)

for k in range(0,K+1):
    win = False
    for i in A:
        if k-i >= 0 and dp[k-i] == 0:
            dp[k] = 1
            win = True
            
if win:
    print('First')
else:
    print('Second')

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

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

dp = [0] * (K+1)

for k in range(0,K+1):
    for i in A:
        if dp[k] == 0 and k-i >= 0 and dp[k-i] == 0:
            dp[k] = 1

            
if dp[k] == 1:
    print('First')
else:
    print('Second')
Buggy python submission (verdict: Runtime Error):
S=input()
if S=ABC:
    print("ARC")
else:
    print("ABC")


Fixed submission:
S=input()
if S=="ABC":
    print("ARC")
else:
    print("ABC")

Buggy python submission (verdict: Runtime Error):
S=input()
if int(S)=ABC:
    print("ARC")
else:
    print("ABC")


Fixed submission:
S=input()
if S=="ABC":
    print("ARC")
else:
    print("ABC")

Buggy python submission (verdict: Runtime Error):
S=input()
if S==ABC
    print("ARC")
else:
    print("ABC")

Fixed submission:
S=input()
if S=="ABC":
    print("ARC")
else:
    print("ABC")

Buggy python submission (verdict: Runtime Error):
if ABC:
    print("ARC")
else:
    print("ABC")

Fixed submission:
S=input()
if S=="ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
R=str(input())
length==2*3.14*int(R)

Fixed submission:
r=input()
R=2*3.1415*float(r)
print(R)
Buggy python submission (verdict: Runtime Error):
N=str(inut())
if int(N[0])==7 or int(N[1])==7 or int(N[2])==7:
    print("Yes")
else:
    print("No")

Fixed submission:
N=str(input())
if int(N[0])==7:
    print("Yes")
elif int(N[1])==7:
    print("Yes")
elif int(N[2])==7:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
import math

r=input()
l=2*math.pi*r
print(l)

Fixed submission:
import math

r=input()
r=int(r)
l=2*math.pi*r
print(l)

Buggy python submission (verdict: Runtime Error):
import math
a=input()
l=2*pi()*a
print(l)

Fixed submission:
import math

r=input()
r=int(r)
l=2*math.pi*r
print(l)
Buggy python submission (verdict: Runtime Error):
N=input()
N=int(N)
M=input()
M=int(M)

sum=0
for num in range(M):
	a=input()
	a=int(a)
	sum=sum+a
	
nokori=N-sum	
if nokori>=0:
	print(nokori)
	
else:
	print(-1)

Fixed submission:
N,M=input().split()
N=int(N)
M=int(M)

sum=0
a=list(map(int,input().split()))
for num in range(M):
	sum=sum+a[num]
	
nokori=N-sum	
if nokori>=0:
	print(nokori)
	
else:
	print(-1)
Buggy python submission (verdict: Runtime Error):
H, N = map(int, input().split())
A = list(map(int, input().split()))

s=0

for i in range(N):
    s+=A[i]
if(s>=H):
    print(Yes)
else:
    print(No)


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

s=0

for i in range(N):
    s+=A[i]
if(s>=H):
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
m=int(n)
e2=0
e5=0

while m>1:
    if m%5!=0 and m%2!=0:
        continue
    m2=m
    m5=m
    while m2%2==0:
        e2=e2+1
        m2=m2/2
    while m5%5==0:
        e5=e5+1
        m5=m5/5
    m=m-2

print(min(e2,e5))


Fixed submission:
A = int(input())  
B = int(input())  

print(6-A-B)
Buggy python submission (verdict: Runtime Error):
import numpy

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

lcm = int(a * b / numpy.gcd(a, b))
print(lcm)

Fixed submission:
import fractions

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

lcm = int(a * b / fractions.gcd(a, b))
print(lcm)

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

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

lcm = int(a * b / numpy.gcd(a, b))
print(lcm)


Fixed submission:
import fractions

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

lcm = int(a * b / fractions.gcd(a, b))
print(lcm)

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

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

lcm = int(a * b / math.gcd(a, b))
print(lcm)


Fixed submission:
import fractions

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

lcm = int(a * b / fractions.gcd(a, b))
print(lcm)
Buggy python submission (verdict: Runtime Error):
input_list = input().split()
input_list2 = list(map(input().split()))
delete_ball = input()
for ind, n in enumerate(input_list):
  if n == delete_ball:
    input_list2[ind] -= 1
print(input_list2)

Fixed submission:
input_list = input().split()
input_list2 = list(map(int, input().split()))
delete_ball = input()
for ind, n in enumerate(input_list):
  if n == delete_ball:
    input_list2[ind] -= 1
ans = ""
for m in input_list2:
  ans += str(m) + " "
print(ans.rstrip())
Buggy python submission (verdict: Runtime Error):
input_list = list(map(int, input().split()))
hp = input_list[0]
arts = input_list[1]
arts_list = list(map(int, input().split()))
if hp < sum(arts_list):
  print(Yes)
else:
  print(No)


Fixed submission:
input_list = list(map(int, input().split()))
hp = input_list[0]
arts = input_list[1]
arts_list = list(map(int, input().split()))
if hp <= sum(arts_list):
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Time Limit Exceeded):
loop = int(input())
num_list = list(map(int, input().split()))
ans = 0
for idx, n in enumerate(num_list):
  flg = True
  if idx > 0:
    for m in num_list[: idx]:
      if m < n:
        flg = False
        break
  if flg:
    ans += 1
print(ans)

Fixed submission:
loop = int(input())
num_list = list(map(int, input().split()))
ans = 0
min_value = 20000000
for n in num_list:
  flg = True
  if min_value < n:
    flg = False
  else:
    min_value = n
  if flg:
    ans += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
loop = int(input())
num_list = list(map(int, input().split()))
before = []
ans = 0
for n in num_list:
  flg = True
  for m in before:
    if m < n:
      flg = False
      break
  before.append(n)
  if flg:
    ans += 1
print(ans)

Fixed submission:
loop = int(input())
num_list = list(map(int, input().split()))
ans = 0
min_value = 20000000
for n in num_list:
  flg = True
  if min_value < n:
    flg = False
  else:
    min_value = n
  if flg:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
input_list = list(map(int, input().split()))
games = input_list[0]
temp = input_list[1]
input_list = list(map(int, input().split()))
r = input_list[0]
s = input_list[1]
p = input_list[2]
target = input()

def no_win_hand(next_hand):
  myhand = win_janken(next_hand)
  return myhand

def get_point(myhand):
  if myhand == 'r':
    point = r
  elif myhand == 's':
    point = s
  else:
    point = p
  return point

def win_janken(hand, next_hand = 'non', donate = 'non'):
  if hand == 'r':
    myhand = 'p'
  elif hand == 's':
    myhand = 'r'
  else:
    myhand = 's'
  point = get_point(myhand)
  if myhand == donate:
    nothand = no_win_hand(next_hand)[0]
    select_hands = ['r','s','p']
    for hand_1 in select_hands:
      if hand_1 is not donate and  hand_1 is not nothand:
        myhand = hand_1
    point = 0
  return myhand, point

allpoint = 0
for m in range(temp):
  group = ''
  for ind, n in enumerate(target):
    if ind % temp == m:
       group += n
  points = 0
  myhands =''
  for index, string in enumerate(group):
    if len(myhands) > 0:
      donate = myhands[index - 1]
    else:
      donate = 'non'
    if index < len(group) - 1:
      myhand, point = win_janken(string, group[index + 1], donate)
    else:
      myhand, point = win_janken(string, 'non', donate)
    points += point
    myhands += myhand
  allpoint += points
print(allpoint)

Fixed submission:
strings = list(map(str, input().split()))
string = strings[1] + strings[0]
print(string)
Buggy python submission (verdict: Runtime Error):
K=int(input())
AB=input().split()
A=int(AB[0])
B=int(AB[1])
for i in rage(A,B+1):
    i=567
    if(i%K==0):
        print('OK')
        exit()
print('NG')


Fixed submission:
K=int(input())
AB=input().split()
A=int(AB[0])
B=int(AB[1])
for i in range(A,B+1):
    if(i%K==0):
        print('OK')
        exit()
print('NG')
Buggy python submission (verdict: Runtime Error):
s=input()
lens=len(s)
count=0
for i in range(lens):
    for k in range(i,lens):
        num=s[i:k]
        if(len(num)>=4):
            if(int(num)%2019==0):
                count=count+1
print(count)

Fixed submission:
SW=input()
SW=SW.split()
if(int(SW[1])>=int(SW[0])):
    print('unsafe')
else:
    print('safe')

Buggy python submission (verdict: Runtime Error):
ABCD=input()
ABCD=ABCD.split()
A=int(ABCD[0])
B=int(ABCD[1])
C=int(ABCD[2])
D=int(ABCD[3])
while(1):
    C=C-B
    if(C<=0):
        print('Yes')
        break
    A=A-D
    if(A<=0):
        print('No')
        break

Fixed submission:
SW=input()
SW=SW.split()
if(int(SW[1])>=int(SW[0])):
    print('unsafe')
else:
    print('safe')
Buggy python submission (verdict: Runtime Error):
def scanf(scanstr,data_format):
    scanstr=scanstr.split(" ")
    if(type(data_format) is not list):
        print("data_format error")
    if(len(scanstr)!=len(data_format)):
        print("Error")
        return -1
    j=0
    for kata in data_format:
        if(kata=="str"):
            scanstr[j]=str(scanstr[j])
        if(kata=="int"):
            scanstr[j]=int(scanstr[j])
        j=j+1
    return scanstr
data=mylib.scanf(input(),["int","int"])
if data[0]!=1 and data[1]!=1:
    print(str(round(float(data[0]*data[1])/2.0+0.1)))
else:
    print(1)

Fixed submission:
data=(1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
print(str(data[int(input())-1]))
Buggy python submission (verdict: Runtime Error):
def scanf(scanstr,data_format):
    scanstr=scanstr.split(" ")
    if(type(data_format) is not list):
        print("data_format error")
    if(len(scanstr)!=len(data_format)):
        print("Error")
        return -1
    j=0
    for kata in data_format:
        if(kata=="str"):
            scanstr[j]=str(scanstr[j])
        if(kata="int"):
            scanstr[j]=int(scanstr[j])
        j=j+1
    return scanstr
data=mylib.scanf(input(),["int","int"])
if data[0]!=1 and data[1]!=1:
    print(str(round(float(data[0]*data[1])/2.0+0.1)))
else:
    print(1)


Fixed submission:
def scanf(scanstr,data_format):
    scanstr=scanstr.split(" ")
    if(type(data_format) is not list):
        print("data_format error")
    if(len(scanstr)!=len(data_format)):
        print("Error")
        return -1
    j=0
    for kata in data_format:
        if(kata=="str"):
            scanstr[j]=str(scanstr[j])
        if(kata=="int"):
            scanstr[j]=int(scanstr[j])
        j=j+1
    return scanstr
data=scanf(input(),["int","int"])
if data[0]==1 or data[1]==1:
    print(1)
elif (data[0]*data[0])%2==0:
    print(str(round((data[0]*data[1])/2)))
else:
    print(str(round((data[0]*data[1]+1)/2)))

Buggy python submission (verdict: Runtime Error):
def scanf(scanstr,data_format):
    scanstr=scanstr.split(" ")
    if(type(data_format) is not list):
        print("data_format error")
    if(len(scanstr)!=len(data_format)):
        print("Error")
        return -1
    j=0
    for kata in data_format:
        if(kata=="str"):
            scanstr[j]=str(scanstr[j])
        if(kata=="int"):
            scanstr[j]=int(scanstr[j])
        j=j+1
    return scanstr
import mylib
data=mylib.scanf(input(),["int","int"])
if data[0]!=1 and data[1]!=1:
    print(str(round(float(data[0]*data[1])/2.0+0.1)))
else:
    print(1)


Fixed submission:
def scanf(scanstr,data_format):
    scanstr=scanstr.split(" ")
    if(type(data_format) is not list):
        print("data_format error")
    if(len(scanstr)!=len(data_format)):
        print("Error")
        return -1
    j=0
    for kata in data_format:
        if(kata=="str"):
            scanstr[j]=str(scanstr[j])
        if(kata=="int"):
            scanstr[j]=int(scanstr[j])
        j=j+1
    return scanstr
data=scanf(input(),["int","int"])
if data[0]==1 or data[1]==1:
    print(1)
elif (data[0]*data[0])%2==0:
    print(str(round((data[0]*data[1])/2)))
else:
    print(str(round((data[0]*data[1]+1)/2)))
Buggy python submission (verdict: Runtime Error):
import math
def scanf(scanstr,data_format):
    scanstr=scanstr.split(" ")
    if(type(data_format) is not list):
        print("data_format error")
    if(len(scanstr)!=len(data_format)):
        print("Error")
        return -1
    j=0
    for kata in data_format:
        if(kata=="str"):
            scanstr[j]=str(scanstr[j])
        if(kata=="int"):
            scanstr[j]=int(scanstr[j])
        j=j+1
    return scanstr
data=scanf(input(),["int","int","int"])
if (data[0]+data[1]+2*math.sqrt(data[0]*data[1]))<data[2]):
    print("Yes")
else :
    print("No")


Fixed submission:
import math
def scanf(scanstr,data_format):
    scanstr=scanstr.split(" ")
    if(type(data_format) is not list):
        print("data_format error")
    if(len(scanstr)!=len(data_format)):
        print("Error")
        return -1
    j=0
    for kata in data_format:
        if(kata=="str"):
            scanstr[j]=str(scanstr[j])
        if(kata=="int"):
            scanstr[j]=int(scanstr[j])
        j=j+1
    return scanstr
d=scanf(input(),["int","int","int"])
if (d[2]-d[0]-d[1]>0)and(4*d[0]*d[1]<(d[2]-d[0]-d[1])*(d[2]-d[0]-d[1])):
    print("Yes")
else :
    print("No")
Buggy python submission (verdict: Runtime Error):
N=int(input())
S=input()
if S[0:N/2]==S[N/2:N] and N/2==0:
  print("Yes")
else:
  print("No")

Fixed submission:
N=int(input())
S=input()
if S[0:int(N/2)]==S[int(N/2):int(N)] and N%2==0:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
import numpy as np
N=int(input())
a=[0]*N
b=[0]*N
s=0
for i in range(N):
    a[i], b[i] = map(int, input().split())
for i in range(N):
  for j in range(j):
    vec=[a[i]-a[j] b[i]-b[j]]
    s+=sqrt(np.linalg.norm(vec))
print(s/N)

Fixed submission:
import numpy as np
N=int(input())
a=[0]*N
b=[0]*N
s=0
for i in range(N):
    a[i], b[i] = map(int, input().split())
for i in range(N):
  for j in range(N):
    vec=[a[i]-a[j], b[i]-b[j]]
    s+=np.linalg.norm(vec)
print(s/N)
Buggy python submission (verdict: Runtime Error):
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
c=0
for i in range(x[0]):
  if y[i]>=x[1]:
    c++
    continue
print(c)


Fixed submission:
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
c=0
for i in range(x[0]):
  if y[i]>=x[1]:
    c+=1
    continue
print(c)

Buggy python submission (verdict: Runtime Error):
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
c=0
for i in range(x[0]):
  if y[i]>=x[1]:
    c++
print(c)

Fixed submission:
x = [int(x) for x in input().split()]
y = [int(x) for x in input().split()]
c=0
for i in range(x[0]):
  if y[i]>=x[1]:
    c+=1
    continue
print(c)
Buggy python submission (verdict: Time Limit Exceeded):
#coding:utf-8
N,Y=map(int,input().split())
a=[int(x) for x in input().split()]
for b in range(Y):
  a[a.index(max(a))]=a[a.index(max(a))]//2
print(sum(a))


Fixed submission:
import heapq

N,M=( int(x) for x in input().split())
A=[int(s)*-1 for s in input().split()]

heapq.heapify(A)

for i in range(M):
    A_max=heapq.heappop(A)*-1
    heapq.heappush(A,(A_max//2)*-1)    
print(sum(A)*-1)

Buggy python submission (verdict: Time Limit Exceeded):
import math
N,Y=map(int,input().split())
a=[float(x) for x in input().split()]
for b in range(Y):
  a.sort(reverse=True)
  a[0]=float(a[0])/2
v=0
for c in range(N):
  v+=int(a[c])
print(v)

  


Fixed submission:
import heapq

N,M=( int(x) for x in input().split())
A=[int(s)*-1 for s in input().split()]

heapq.heapify(A)

for i in range(M):
    A_max=heapq.heappop(A)*-1
    heapq.heappush(A,(A_max//2)*-1)    
print(sum(A)*-1)

Buggy python submission (verdict: Time Limit Exceeded):
#coding:utf-8
import math
N,Y=map(int,input().split())
a=[float(x) for x in input().split()]
for b in range(Y):
  a.sort(reverse=True)
  a[0]=float(a[0])/2
v=0
for c in range(N):
  v=v+math.floor(a[c])
print(v)

  

Fixed submission:
import heapq

N,M=( int(x) for x in input().split())
A=[int(s)*-1 for s in input().split()]

heapq.heapify(A)

for i in range(M):
    A_max=heapq.heappop(A)*-1
    heapq.heappush(A,(A_max//2)*-1)    
print(sum(A)*-1)
Buggy python submission (verdict: Runtime Error):
a=intput("enter")
if a=="ABC":
    print("ARC")
elif a=="ARC":
    print("ABC")

Fixed submission:
a=input()
if a=="ABC":
    print("ARC")
elif a=="ARC":
    print("ABC")

Buggy python submission (verdict: Runtime Error):
a=intput()
if a=="ABC":
    print("ARC")
elif a=="ARC":
    print("ABC")

Fixed submission:
a=input()
if a=="ABC":
    print("ARC")
elif a=="ARC":
    print("ABC")

Buggy python submission (verdict: Runtime Error):
if(input() == "ABC"):
  return "ARC"

else:
  return "ABC"

Fixed submission:
s = input()

if(s == 'ABC'):
  print("ARC")

else:
  print("ABC")
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split(" "))


print(max(a+a-1,b+b-1,a+br))

Fixed submission:

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


print(max(a+a-1,b+b-1,a+b))
Buggy python submission (verdict: Time Limit Exceeded):
x = int(input())
a = 0
b = 0
while a ** 5 - b ** 5 != x and a ** 5 + b ** 5 != x:
    for b in range (a+1):
        if a ** 5 - b ** 5 == x or a ** 5 + b ** 5 == x:
            break
    
    a += 1

if a ** 5 - b ** 5 == x:
    print(a, b)
else:
    print(a, -1 * b)

Fixed submission:
x = int(input())
a = 0
b = 0
while a ** 5 - b ** 5 != x and a ** 5 + b ** 5 != x:
    B = a ** 5 - x
    b = int(abs(B ** (1/5)))
    if a ** 5 - b ** 5 == x or a ** 5 + b ** 5 == x:
        break

    a += 1

if a ** 5 - b ** 5 == x:
    print(a, b)
else:
    print(a, -1 * b)
Buggy python submission (verdict: Runtime Error):
a, b, n = map(int, input().split())

temp_prev = 0
temp_curr = 0
x = min(n, b-1)

while x <= n:
    temp_prev = temp_curr
    temp_curr = int(a * x / b) - a * int(x / b)
    x += 1.0

    if temp_curr <= temp_prev:
        break

print(max(temp_curr, temp_prev))

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

flag = 0

i = 1
while i * k <= b:
    if i*k >= a and i*k <=b:
        flag = 1
    
    i += 1

if flag:
    print("OK")
else:
    print("NG")
Buggy python submission (verdict: Time Limit Exceeded):
a, b, n = map(int, input().split())

temp_prev = 0
temp_curr = 0
if b <= 100:
    x = 0.0
else:
    x = min(n, b - 10.0)

while x <= n:
    temp_prev = temp_curr
    temp_curr = int(a * x / b) - a * int(x / b)
    x += 1.0

    if temp_curr < temp_prev:
        break

print(max(temp_curr, temp_prev))

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

temp_prev = 0
temp_curr = 0
x = min(n, b-1)

while x <= n:
    temp_prev = temp_curr
    temp_curr = int(a * x / b) - a * int(x / b)
    x += 1.0

    if temp_curr <= temp_prev:
        break

print(max(temp_curr, temp_prev))

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

temp_prev = 0
temp_curr = 0
if b <= 100:
    x = 0.0
else:
    x = min(n, b - 100.0)

while x <= n:
    temp_prev = temp_curr
    temp_curr = int(a * x / b) - a * int(x / b)
    x += 1.0

    if temp_curr < temp_prev:
        break

print(max(temp_curr, temp_prev))

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

temp_prev = 0
temp_curr = 0
x = min(n, b-1)

while x <= n:
    temp_prev = temp_curr
    temp_curr = int(a * x / b) - a * int(x / b)
    x += 1.0

    if temp_curr <= temp_prev:
        break

print(max(temp_curr, temp_prev))

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

temp_prev = 0
temp_curr = 0
x = 0.0
while x <= n:
    temp_prev = temp_curr
    temp_curr = int(a * x / b) - a * int(x / b)
    x += 1.0

    if temp_curr < temp_prev:
        break

print(max(temp_curr, temp_prev))

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

temp_prev = 0
temp_curr = 0
x = min(n, b-1)

while x <= n:
    temp_prev = temp_curr
    temp_curr = int(a * x / b) - a * int(x / b)
    x += 1.0

    if temp_curr <= temp_prev:
        break

print(max(temp_curr, temp_prev))
Buggy python submission (verdict: Time Limit Exceeded):
S = input()

c = [0] * 2019
c[0] = 1
for i in range(len(S)):
    c[int(S[i:])%2019] += 1

ans = 0
for m in c:
    ans += m * (m - 1) / 2

print(int(ans)) 

Fixed submission:
S = input()

mod = [0] * 2019
mod[0] = 1
digit = 1
temp = 0
 
for i in S[::-1]:
    temp = (temp + digit * int(i)) % 2019
    mod[temp] += 1
    digit = (digit * 10) % 2019

ans = 0
for m in mod:
    ans += m * (m - 1) // 2

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
s = input()
c = 0

for i in range(len(s)+1):
    for j in range(i, len(s)+1):
        if s[i:j] != '':
            temp = int(s[i:j])
            if temp % 2019 == 0:
                c += 1

print(c)

Fixed submission:
S = input()

mod = [0] * 2019
mod[0] = 1
digit = 1
temp = 0
 
for i in S[::-1]:
    temp = (temp + digit * int(i)) % 2019
    mod[temp] += 1
    digit = (digit * 10) % 2019

ans = 0
for m in mod:
    ans += m * (m - 1) // 2

print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())

r = s.count('R')
g = s.count('G')
b = s.count('B')

# 1つ目の条件を満たす組の数
ans = r * g * b

# 2つ目の条件を満たす組の数
c = 0
for i in range(n):
    for j in range(i+1,n):
        k = 2 * j -i
        if k > n-1:
            break
        if s[i] != s[j] and s[j] != s[k] and s[k] != s[i]:
            c += 1

print(ans - c)

Fixed submission:
n = input()

ans = n.find('7')

if ans == -1:
    print('No')
else:
    print('Yes')