Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
N = int(input())
memo = {}

def mcd(a, b) :
    if (a, b) in memo.keys() :
        return memo[(a, b)]
    else :
        if max(a, b) % min(a, b) == 0 :
            return min(a, b)
        else :
            memo[(a, b)] = mcd(min(a, b), max(a, b) % min(a, b))
            return memo[(a, b)]

def lcm(a, b) :
    return int((a * b) / mcd(a, b))

cur_lcm = 1

for i in range(N) :
    n = int(input())
    
    cur_lcm = lcm(cur_lcm, n)
    
print(cur_lcm)
    

Fixed submission:
N = int(input())

'''
def mcd(a, b) :
    if (a, b) in memo.keys() :
        return memo[(a, b)]
    else :
        if max(a, b) % min(a, b) == 0 :
            return min(a, b)
        else :
            memo[(a, b)] = mcd(min(a, b), max(a, b) % min(a, b))
            return memo[(a, b)]

def lcm(a, b) :
    return int((a * b) / mcd(a, b))
'''

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

h = 1

for i in range(N) :
    n = int(input())
    
    h = n * h // gcd(n, h)
    
print(h)

Buggy python submission (verdict: Runtime Error):
N = int(input())
t = [int(input()) for x in range(N)]

def mcd(a, b) :
    if max(a, b) % min(a, b) == 0 :
        return min(a, b)
    else :
        return mcd(min(a, b), max(a, b) % min(a, b))

def lcm(a, b) :
    return int((a * b) / mcd(a, b))

t_s = sorted(t)

cur_lcm = t_s[0]
for i in range(1, len(t_s)) :
    cur_lcm = lcm(cur_lcm, t_s[i])
    
print(cur_lcm)
    

Fixed submission:
N = int(input())

'''
def mcd(a, b) :
    if (a, b) in memo.keys() :
        return memo[(a, b)]
    else :
        if max(a, b) % min(a, b) == 0 :
            return min(a, b)
        else :
            memo[(a, b)] = mcd(min(a, b), max(a, b) % min(a, b))
            return memo[(a, b)]

def lcm(a, b) :
    return int((a * b) / mcd(a, b))
'''

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

h = 1

for i in range(N) :
    n = int(input())
    
    h = n * h // gcd(n, h)
    
print(h)

Buggy python submission (verdict: Runtime Error):
N = int(input())
t = [int(input()) for x in range(N)]

def lcm(a, b) :
    if max(a, b) % min(a, b) == 0 :
        return max(a, b)
    else :
        return a*b / gcd(a, b)
    
def gcd(a, b) :
    if max(a, b) % min(a, b) == 0:
        return min(a, b)
    else :
        return gcd(max(a, b) % min(a, b), min(a, b))
    
cur_lcm = t[0]
for i in range(1, N) :
    cur_lcm = lcm(cur_lcm, t[i])

print(int(cur_lcm))

Fixed submission:
N = int(input())

'''
def mcd(a, b) :
    if (a, b) in memo.keys() :
        return memo[(a, b)]
    else :
        if max(a, b) % min(a, b) == 0 :
            return min(a, b)
        else :
            memo[(a, b)] = mcd(min(a, b), max(a, b) % min(a, b))
            return memo[(a, b)]

def lcm(a, b) :
    return int((a * b) / mcd(a, b))
'''

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

h = 1

for i in range(N) :
    n = int(input())
    
    h = n * h // gcd(n, h)
    
print(h)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())

hop_before = []
hop_to = []

for i in range(M) :
    a, b = map(int, input().split())
    
    if a == 1 :
        hop_to.append(b)
    if b == N :
        hop_before.append(a)
        
contains = False
for i in sorted(hop_to) :
    for j in sorted(hop_before) :
        if j > i : continue
        if i == j :
            contains = True
            break

if contains == True :
    print("POSSIBLE")
else :
    print("IMPOSSIBLE")

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

hop_before = []
hop_to = []

hop_dict = {}

for i in range(M) :
    a, b = map(int, input().split())
    
    if a == 1 :
        if b in hop_dict.keys() :
            hop_dict[b] += 1
        else :
            hop_dict[b] = 1
    if b == N :
        if a in hop_dict.keys() :
            hop_dict[a] += 1
        else :
            hop_dict[a] = 1
        
possible = False
for i in hop_dict.keys() :
    if hop_dict[i] >= 2 :
        print("POSSIBLE")
        possible = True
        break
        
if possible == False :
    print("IMPOSSIBLE")

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

hop_before = []
hop_to = []

for i in range(M) :
    a, b = map(int, input().split())
    
    if a == 1 :
        hop_to.append(b)
    if b == N :
        hop_before.append(a)
        
contains = False
for i in hop_to :
    if i in hop_before :
        contains = True
        break

if contains == True :
    print("POSSIBLE")
else :
    print("IMPOSSIBLE")

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

hop_before = []
hop_to = []

hop_dict = {}

for i in range(M) :
    a, b = map(int, input().split())
    
    if a == 1 :
        if b in hop_dict.keys() :
            hop_dict[b] += 1
        else :
            hop_dict[b] = 1
    if b == N :
        if a in hop_dict.keys() :
            hop_dict[a] += 1
        else :
            hop_dict[a] = 1
        
possible = False
for i in hop_dict.keys() :
    if hop_dict[i] >= 2 :
        print("POSSIBLE")
        possible = True
        break
        
if possible == False :
    print("IMPOSSIBLE")
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
paths = []

for i in range(M) :
    paths.append(list(map(int, input().split())))
    
INF = -10**20
cost = [INF for x in range(N)]
cost[0] = 0
inf_flg = False 

for i in range(N * 2) :
    for p in paths :
        f, t, c = p[0] - 1, p[1] - 1, p[2]
        
        if cost[t] < cost[f] + c and not(cost[t] == cost[f] == INF):
            cost[t] = cost[f] + c
            
            if i >= N and t == N - 1:
                inf_flg = True 
    
if inf_flg == True :
    print("inf")
else :
    for c in cost :
        if c == INF :
            print("")
    print(cost[N - 1])

Fixed submission:
N, M = map(int, input().split())
paths = []

for i in range(M) :
    paths.append(list(map(int, input().split())))
    
INF = -10**20
cost = [INF for x in range(N)]
cost[0] = 0
break_flg, inf_flg = True, False
cnt = 0

for i in range(N) :
    break_flg = True 
    
    for p in paths :
        f, t, c = p[0] - 1, p[1] - 1, p[2]
        
        if cost[t] < cost[f] + c :
            cost[t] = cost[f] + c
            break_flg = False
            
            if i == N - 1 and t == N - 1 :
                inf_flg = True 
            
    # break flg
    if break_flg == True :
        break
        
if inf_flg == True :
    print("inf")
else :
    print(cost[N - 1])
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())

# initial
p_t, p_a = 1, 1

for i in range(N) :
    t, a = map(int, input().split())
    t_up, a_up = t, a
    
    if t >= p_t and a >= p_a : 
        p_t, p_a = t, a
    else :
        while t_up < p_t or a_up < p_a :
            t_up += t
            a_up += a
            # print("DBG2 : ", t, a)
            
        p_t, p_a = t_up, a_up
        
    # print(p_t, p_a)

print(p_t + p_a)
    
    
    
    

Fixed submission:
N = int(input())

# initial
p_t, p_a = 1, 1

for i in range(N) :
    t, a = map(int, input().split())
    t_up, a_up = t, a
    
    if t >= p_t and a >= p_a : 
        p_t, p_a = t, a
    else :
        f = max(
            p_t // t if p_t % t == 0 else p_t // t + 1,  
            p_a // a if p_a % a == 0 else p_a // a + 1
        )
        
        p_t, p_a = t*f, a*f

print(p_t + p_a)
Buggy python submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
ls=[];rs=[]
for i in range(Q):
    l,r=map(int,input().split())
    n=0;a=False
    for k in S[(l-1):(r)]:
        if k!="A" and a==False:
            pass
        elif k=="A":
            a=True
        elif a:
            if k=="C":
                n+=1
            else:
                a=False
    print(n)
    
    

Fixed submission:
b=input()
if b=="A":
    print("T")
elif b=="C":
    print("G")
elif b=="G":
    print("C")
elif b=="T":
    print("A")

Buggy python submission (verdict: Runtime Error):
N,Q=map(int,input().split())
S=input()
ls=[];rs=[]
for i in range(Q):
    l,r=map(int,input().split())
    n=0;a=False
    for k in S[(l-1):(r)]:
        if k!="A" and a==False:
            pass
        elif k=="A":
            a=True
        elif a:
            if k=="C":
                n+=1
            else:
                a=False
    print(n)

Fixed submission:
b=input()
if b=="A":
    print("T")
elif b=="C":
    print("G")
elif b=="G":
    print("C")
elif b=="T":
    print("A")
Buggy python submission (verdict: Runtime Error):
NM=input().split()
N=int(NM[0])
M=int(NM[1])#必要な本数
A=[]
B=[]
for i in range(N):
  AB=input().split()
  A.append(int(AB[0]))
  B.append(int(AB[1]))
money=0
while A!=[]:
  if M>B[A.index(min(A))]:
    money+=min(A)*B[A.index(min(A))]
    #消す
    ai=A.index(min(A))
    A.remove(min(A))
    B.remove(B[ai])
  elif M<B[A.index(min(A))]:
    money+=min(A)*M
    break
  elif M==B[A.index(min(A))]:
    money+=min(A)*M
    break
  else:
    pass
print(str(money))


Fixed submission:
GR=input().split()
G2R2=input().split()
G=int(GR[0])
R=int(GR[1])
G2=int(G2R2[0])
R2=int(G2R2[1])
print(str(G*R-(G2*R+R2*G-G2*R2)))
Buggy python submission (verdict: Runtime Error):
ABC=input().split()#2 11 4
A=int(A);B=int(B);C=int(C)
count=0
while A<=B:
    count+=1
    B=B-A
if count<C:
    print(str(count))
else:
    print(str(C))

Fixed submission:
ABC=input().split()#2 11 4
A=int(ABC[0]);B=int(ABC[1]);C=int(ABC[2])
count=0
while A<=B:
    count+=1
    B=B-A
if count<C:
    print(str(count))
else:
    print(str(C))
Buggy python submission (verdict: Runtime Error):
S=print()
N=len(S)
c0=0;c1=0
for i in range(N):
  if "0"==S[i]:
    c0=c0+1
  elif "1"==S[i]:
    c1=c1+1
print(str(min(c0,c1)))
    

Fixed submission:
S=input()
N=len(S)
c0=0;c1=0
for i in range(N):
  if "0"==S[i]:
    c0=c0+1
  elif "1"==S[i]:
    c1=c1+1
print(str(2*min(c0,c1)))
Buggy python submission (verdict: Runtime Error):
import fraction
N=int(input())
As=input().split()
As=[int(a) for a in As]
count=As[0]
for i in As:
    count=fraction.gcd(count,i)
print(str(count))

Fixed submission:
import fractions
N=int(input())
As=input().split()
As=[int(a) for a in As]
count=As[0]
for i in As:
    count=fractions.gcd(count,i)
print(str(count))

Buggy python submission (verdict: Runtime Error):
import math
N=int(input())
As=input().split()
As=[int(a) for a in As]
count=As[0]
for i in As:
    count=math.gcd(count,i)
print(str(count))


Fixed submission:
import fractions
N=int(input())
As=input().split()
As=[int(a) for a in As]
count=As[0]
for i in As:
    count=fractions.gcd(count,i)
print(str(count))

Buggy python submission (verdict: Runtime Error):
import math
N=int(input())
As=input().split()
As=[int(a) for a in As]
count=As[0]
for i in As:
    count=math.gcd(count,i)
print(str(count))


Fixed submission:
import fractions
N=int(input())
As=input().split()
As=[int(a) for a in As]
count=As[0]
for i in As:
    count=fractions.gcd(count,i)
print(str(count))
Buggy python submission (verdict: Runtime Error):
all=input().split()
T=all[0]
X=all[1]
round(T/X,10)

Fixed submission:
all=input().split();T=int(all[0]);X=int(all[1]);print(str(round(T/X,10)))
Buggy python submission (verdict: Runtime Error):
N=int(input())
Ls=input().split()
mx=max(Ls)
start=0
for i in Ls:
  start+=(N-int(i))
if start>mx:
  print("Yes")
else:
  print("No")

Fixed submission:
N=int(input())
Ls=input().split()#str
L=[int(i) for i in Ls]
mx=max(L);L.remove(mx)
all=0
for j in L:all+=j
if all>mx:print("Yes")
else:print("No")
Buggy python submission (verdict: Runtime Error):
number=input()
num_sp=number.split(" ")
num=num_sp[0]+(num_sp[1]/2)
print("%s"%(num))

Fixed submission:
number=input()
num_sp=number.split(" ")
num=int(num_sp[0])+(int(num_sp[1])/2)
print("%s"%(int(num)))

Buggy python submission (verdict: Runtime Error):
number=input()
num_sp=number.split(" ")
num=num_sp[0]+(num_sp[1]/2)
print("%s"%(num))

Fixed submission:
number=input()
num_sp=number.split(" ")
num=int(num_sp[0])+(int(num_sp[1])/2)
print("%s"%(int(num)))
Buggy python submission (verdict: Runtime Error):
N=int(input())
if N==1:
    print("Hello World")
elif N==2:
    A=int(input())
    B=int(input())
    print(str(A+B)

Fixed submission:
N=int(input())
if N==1:
    print("Hello World")
elif N==2:
    A=int(input())
    B=int(input())
    print(str(A+B))
Buggy python submission (verdict: Runtime Error):
N=input()
if N%2==0:
    print(N)
else:
    print(N*2)
    

Fixed submission:
N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
a=input()
a=int(a)
if a%2==0:
    print(a)
else
    print(a*2)

Fixed submission:
N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
a=input()
if a%2==0:
    print(a)
else
    print(a*2)

Fixed submission:
N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
a=input()
a=int(a)
d=a
if a<2:
    b=a
    a=2
else
    b=2
c=1
while c!=0:
    c=a%b
    a=b
    b=c
print(d*2/b)
#a=2,b=1,c=1,d=1

Fixed submission:
N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
a=input()
a=int(a)
d=a
if a<2:
    b=a
    a=2
else
    b=2
while c!=0:
    c=a%b
    a=b
    b=c
print(d*2/b)


Fixed submission:
N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
a=input()
a=int(a)
d=a
if a<2:
    b=a
    a=2
while c!=0:
    c=a%b
    a=b
    b=c
print(d*2/b)


Fixed submission:
N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
a=input()
d=a
if a>2:
else 
    b=a
    a=2
while c!=0:
    c=a%b
    a=b
    b=c
print(d*2/b)


Fixed submission:
N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)

Buggy python submission (verdict: Runtime Error):
a=input()
if a>2:
else 
    b=a
    a=2
while c!=0:
    c=a%b
    a=b
    b=c
print(b)
    

Fixed submission:
N=input()
N=int(N)
if N%2==0:
    print(N)
else:
    print(N*2)
Buggy python submission (verdict: Runtime Error):
str=input()
list=["a","b","c"]
if str[1] in list:
  list.remove(str[1])
  if str[2] in list:
    list.remove(str[2])
    if str[3] i list:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")
 

Fixed submission:
str=input()
list=["a","b","c"]
if str[0] in list:
  list.remove(str[0])
  if str[1] in list:
    list.remove(str[1])
    if str[2] in list:
      print("Yes")
    else:
      print("No")
  else:
    print("No")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
if a>b:
    print("GREATER")
elif a=b
    print("EQUAL")
else
    print("LESS")
    
  

Fixed submission:
a=input()
b=input()
a=int(a)
b=int(b)
if a>b:
    print("GREATER")
elif a==b:
    print("EQUAL")
else:
    print("LESS")
Buggy python submission (verdict: Runtime Error):
import sys
a = int(sys.argv[1])
b = int(sys.argv[2])

if (a * b) % 2 == 0:
	print('Even')
else:
	print('Odd')

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

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Buggy python submission (verdict: Runtime Error):
import sys
a = int(sys.argv[1])
b = int(sys.argv[2])

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

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

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Buggy python submission (verdict: Runtime Error):
import sys
a = int(sys.argv[1])
b = int(sys.argv[2])
if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

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

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Buggy python submission (verdict: Runtime Error):
import sys
	a = int(sys.argv[1])
	b = int(sys.argv[2])

	if (a * b) % 2 == 0:
		print("Even")
	else:
		print("Odd2)



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

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")

Buggy python submission (verdict: Runtime Error):
import sys
	a = sys.argv[1]
	b = sys.argv[2]

	if (a * b) % 2 == 0:
		print("Even")
	else:
		print("Odd")

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

if (a * b) % 2 == 0:
	print("Even")
else:
	print("Odd")
Buggy python submission (verdict: Runtime Error):
print(eval(input())

Fixed submission:
x = input()
print(eval(x))

Buggy python submission (verdict: Runtime Error):
print(eval(input())

Fixed submission:
x = input()
print(eval(x))
Buggy python submission (verdict: Runtime Error):
A = list(map(int, input().split()))
x = sorted(A)
if x[0] + x[1] == x[2]:
  print('Yes')
else:
  print('No'

Fixed submission:
A = list(map(int, input().split()))
x = sorted(A)
if x[0] + x[1] == x[2]:
  print('Yes')
else:
  print('No')
Buggy python submission (verdict: Runtime Error):
 import collections

s = input()
lst = []
for i in s:
    lst.append(i)
c = collections.Counter(lst)
if sum(c.values()) % 2 == 0:
    print('Yes')
else:
    print('No')

Fixed submission:
import collections

s = []
a = 0
x = input()
if len(x) % 2 != 0:
    print('No')
else:
    for i in x:
        s.append(i)
    c = collections.Counter(s)
    values, counts = zip(*c.most_common())
    for j in counts:
        if j % 2 == 0:
            a += 1
    if len(counts) == a:
        print('Yes')
    else:
        print('No')
Buggy python submission (verdict: Runtime Error):
l = input().split(' ')
a,b,c,x,y = int(l[0]),int(l[1]),int(l[2]),int(l[3]),int(l[4])

place = []

place.append( a * x + b * y )

if x-y > 0:
    place.append(c * x * 2)
else:
    place.append(c * y * 2)

if x < y :
    place.append(c * x * 2 + b * (y-x))
else :
    place.append(c * y * 2 + a * (x-y))
    
print(sorted(place)[0])


Fixed submission:
s = input()

num = s.count('o')

print( 700 + num *100 )

Buggy python submission (verdict: Runtime Error):
l = input().split(' ')
a,b,c,x,y = int(l[0]),int(l[1]),int(l[2]),int(l[3]),int(l[4])

place = []
# 全部1枚サイズ
place.append( a * x + b * y )

# 多いほうに合わせる
if x-y > 0:
    place.append(c * x * 2)
else:
    place.append(c * y * 2)

# 少ないほうに合わせてハーフ + 足りない分
if x < y :
    place.append(c * x * 2 + b * (y-x))
else :
    place.append(c * y * 2 + a * (x-y))
    
print(sorted(place)[0])


Fixed submission:
s = input()

num = s.count('o')

print( 700 + num *100 )
Buggy python submission (verdict: Time Limit Exceeded):
K,S = map(int,(input().split()))

n = 0

for x in range(K+1) :
        if (S - x <= 2 * K):
                for y in range(K+1) :
                        if (K >= x) and (K >= y) and (S >= x + y) and (S-x-y <= K):
                                n = n + 1

                
print(n)

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

n = 0

for x in range(K+1) :
        if (S - x <= 2 * K):
                for y in range(K+1) :
                        if 0 <=S-x-y <= K:
                                n += 1

                
print(n)

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

n = 0

for x in range(S+1) :
        if (S - x <= 2 * K):
                for y in range(S+1) :
                        if (K >= x) and (K >= y) and (S >= x + y) and (S-x-y <= K):
                                n = n + 1

                
print(n)

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

n = 0

for x in range(K+1) :
        if (S - x <= 2 * K):
                for y in range(K+1) :
                        if 0 <=S-x-y <= K:
                                n += 1

                
print(n)

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

n = 0

for x in range(S+1) :
        for y in range(S+1) :
                if (K >= x) and (K >= y) and (S >= x + y) and (S-x-y <= K):
                       n = n + 1

                
print(n)

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

n = 0

for x in range(K+1) :
        if (S - x <= 2 * K):
                for y in range(K+1) :
                        if 0 <=S-x-y <= K:
                                n += 1

                
print(n)
Buggy python submission (verdict: Runtime Error):
S = input()
A = []
for l in S:
	if l == '0' or l == '1':
		A.append(l)
	else:
		A.pop()
print("".join(A))	

Fixed submission:
import re
S = input()
if 'B' in S:
	A = re.split("01BB|10BB|11BB|00BB|0B|1B",S)
	A = "".join(A)
	if 'B' in A:
		C = re.split("01BB|10BB|11BB|00BB|0B|1B",A)
		C = "".join(C)
		C = C.split("B")
		print("".join(C))
	else:
		print(A)
else:
	print(S)
Buggy python submission (verdict: Runtime Error):
alphabets = 'a b c d e f g h i j k l m n o p q r s t u v w x y z'.split()
s = sorted(list(set(input())))
N = len(s)
i = 0
while(alphabets[i] in s):
    i += 1
print(chr(i+97))

Fixed submission:
alphabets = 'a b c d e f g h i j k l m n o p q r s t u v w x y z'.split()
s = sorted(list(set(input())))
N = len(s)
i = 0
while(alphabets[i] in s):
    i += 1
    if(i == 26):
        break
if(i == 26):
    print('None')
else:
    print(chr(i+97))
Buggy python submission (verdict: Runtime Error):
a=input()
b=input()
c=input()
d=input()
e=input()
k=input()
if e-a>k:
    print(":(")
else:
    print("Yay!")

Fixed submission:
a=int(input())
b=input()
c=input()
d=input()
e=int(input())
k=int(input())
if e-a>k:
    print(":(")
else:
    print("Yay!")
Buggy python submission (verdict: Time Limit Exceeded):
# coding: utf-8
# Your code here!
import numpy as np

N,M = map(int,input().split(' '))
A = []
B = []

for _ in range(N):
    AB = list(map(int,input().split()))
    A.append(AB[0])
    B.append(AB[1])

A=np.array(A)
B=np.array(B)
Money = 0
Drink = 0
while True:
    minidx = np.argmin(A)
    Money += A[minidx]*B[minidx]
    Drink += B[minidx]
    if Drink >= M:
        Money = Money - (A[minidx]*(Drink - M))
        break
    A = np.delete(A, minidx)
    B = np.delete(B, minidx)
    
print(Money)

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

AB = sorted(list(map(int,input().split())) for _ in range(N))
Money = 0
for A,B in AB:
    x = min(B,M)
    Money += A * x
    M -= x
print(Money)

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

N,M = map(int,input().split(' '))
A = []
B = []

for _ in range(N):
    AB = list(map(int,input().split()))
    A.append(AB[0])
    B.append(AB[1])

Money = 0
Drink = 0
while True:
    minidx = np.argmin(A)
    Money += A[minidx]*B[minidx]
    Drink += B[minidx]
    if Drink >= M:
        Money = Money - (A[minidx]*(Drink - M))
        break
    A = np.delete(A, minidx)
    B = np.delete(B, minidx)
    
print(Money)

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

AB = sorted(list(map(int,input().split())) for _ in range(N))
Money = 0
for A,B in AB:
    x = min(B,M)
    Money += A * x
    M -= x
print(Money)
Buggy python submission (verdict: Runtime Error):
import math

A,B,K = map(int,input().split(" "))
GCA = math.gcd(A, B)
all_div=[]

C = min(A,B)

for i in range(1,C+1):
    if C % i == 0:
        if i <= GCA:
            all_div.append(i)
all_div.sort(reverse=True)
print(all_div[K-1])

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

def gcd(a, b):
	while b:
		a, b = b, a % b
	return int(a)

GCA = gcd(A, B)
A_all_div=[]
B_all_div=[]


for i in range(1,A+1):
    if A % i == 0:
        if i <= GCA:
            A_all_div.append(i)
A_all_div.sort(reverse=True)

for i in range(1,B+1):
    if B % i == 0:
        if i <= GCA:
            B_all_div.append(i)
B_all_div.sort(reverse=True)

ALL_DIV = set(A_all_div) & set(B_all_div)
all_div = list(ALL_DIV)

all_div.sort(reverse=True)

print(all_div[K-1])