Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
#166d
x = int(input())
for i in range(-118,119):
    for j in range(-118,119):
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Fixed submission:
#166d
x = int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Buggy python submission (verdict: Runtime Error):
#166d
x = int(input())
for i in range(-118,119):
    for j in range(-118,119):
        print(i,j)
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Fixed submission:
#166d
x = int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Buggy python submission (verdict: Runtime Error):
#166d
x = int(input())
for i in range(-73,73):
    for j in range(-73,73):
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Fixed submission:
#166d
x = int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Buggy python submission (verdict: Runtime Error):
#166d
x = int(input())
for i in range(-73,73):
    for j in range(-73,73):
        print(i,j)
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Fixed submission:
#166d
x = int(input())
for i in range(-120,120):
    for j in range(-120,120):
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)
Buggy python submission (verdict: Runtime Error):
#166d
x = int(input())
for i in range(-73,73):
    for j in range(-73,73):
        print(i,j)
        if i**5-j**5==x:
            a = i
            b = j
            break
        
print(a,b)

Fixed submission:
from itertools import combinations_with_replacement

n,m,q = map(int,input().split())
s_list = [list(map(int,input().split())) for _ in range(q)]

ans = 0
for c in combinations_with_replacement(range(1,m+1),n):
    v = 0
    for s in s_list:
        if c[s[1]-1] - c[s[0]-1] == s[2]:
            v+=s[3]
    
    ans = max(ans,v)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = input()

R=[]
G=[]
B=[]

for i in range(n):
    if s[i] == "R":
        R.append(i)
    elif s[i] == "G":
        G.append(i)
    else:
        B.append(i)

ans = len(R)*len(G)*len(B)
for i in range(n-2):
    for j in range(i+1,n-1):
        k  = 2*j-i
        if k<n:
            if (s[i]=s[j]) and (s[i]=s[k]) and (s[j]=s[k]):
                ans-=1
print(ans)

Fixed submission:
n = int(input())
s = input()

R=[]
G=[]
B=[]

for i in range(n):
    if s[i] == "R":
        R.append(i)
    elif s[i] == "G":
        G.append(i)
    else:
        B.append(i)

ans = len(R)*len(G)*len(B)
for i in range(n-2):
    for j in range(i+1,n-1):
        k  = 2*j-i
        if k<n:
            if (s[i]!=s[j]) and (s[i]!=s[k]) and (s[j]!=s[k]):
                ans-=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

R=[]
G=[]
B=[]

for i in range(n):
    if s[i] == "R":
        R.append(i)
    elif s[i] == "G":
        G.append(i)
    else:
        B.append(i)

ans = len(R)*len(G)*len(B)
for i in range(n-2):
    for j in range(i+1,n-1):
        k  = 2*j-i
        if k<n:
            s1,s2,s3 = s[i],s[j],s[k]
            if (s1!=s2) and (s1!=s3) and (s2!=s3):
                ans-=1
print(ans)

Fixed submission:
n = int(input())
s = input()

R=[]
G=[]
B=[]

for i in range(n):
    if s[i] == "R":
        R.append(i)
    elif s[i] == "G":
        G.append(i)
    else:
        B.append(i)

ans = len(R)*len(G)*len(B)
for i in range(n-2):
    for j in range(i+1,n-1):
        k  = 2*j-i
        if k<n:
            if (s[i]!=s[j]) and (s[i]!=s[k]) and (s[j]!=s[k]):
                ans-=1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()
c = 0
for i in range(n):
    s1 = s[i]
    for j in range(i,n):
        s2 = s[j]
        for k in range(j,n):
            s3 = s[k]
            if (s1==s2) or (s1==s3) or (s2 == s3):
                pass
            elif (j-i)==((k-j)):
                pass
            else:
                c+=1

print(c)

Fixed submission:
n = int(input())
s = input()

R=[]
G=[]
B=[]

for i in range(n):
    if s[i] == "R":
        R.append(i)
    elif s[i] == "G":
        G.append(i)
    else:
        B.append(i)

ans = len(R)*len(G)*len(B)
for i in range(n-2):
    for j in range(i+1,n-1):
        k  = 2*j-i
        if k<n:
            if (s[i]!=s[j]) and (s[i]!=s[k]) and (s[j]!=s[k]):
                ans-=1
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
#154D
n,k = map(int,input().split())
P = list(map(int,input().split()))

e_p  = []
for i in range(len(P)):
    e_p.append((P[i]+1)/2)

s = []
for j in (range(len(P)-k+1)):
    s.append(sum(e_p[j:j+k]))
        
print(max(s))

Fixed submission:
#154D
n,k = map(int,input().split())
P = list(map(int,input().split()))

e_p  = []
for i in range(len(P)):
    e_p.append((P[i]+1)/2)

s = [0]*(len(P)+1)
for i in range(len(P)):
    s[i+1] = s[i]+e_p[i]
    
res = 0
for i in range(n-k+1):
    res = max(res,s[i+k] - s[i])
        
print(res)

Buggy python submission (verdict: Time Limit Exceeded):
#154D
n,k = map(int,input().split())
P = list(map(int,input().split()))

e_p  = []
for i in range(len(P)):
    e_p.append((P[i]+1)/2)

s = []
for j in (range(len(P)-k+1)):
    s.append(sum(e_p[j:j+k]))
        
print(max(s))

Fixed submission:
#154D
n,k = map(int,input().split())
P = list(map(int,input().split()))

e_p  = []
for i in range(len(P)):
    e_p.append((P[i]+1)/2)

s = [0]*(len(P)+1)
for i in range(len(P)):
    s[i+1] = s[i]+e_p[i]
    
res = 0
for i in range(n-k+1):
    res = max(res,s[i+k] - s[i])
        
print(res)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
pin_li = []
for i in range(len(s)):
    if len(set(pin_li)) >1000:
        break
    for j in range(i+1,len(s)):
        for k in range(j+1,len(s)):
            pin_li.append(s[i]+s[j]+s[k])
            if len(set(pin_li)) > 1000:
                break
print(len(set(pin_li)))

Fixed submission:
n = int(input())
s = input()
cnt = 0
for i in range(1000):
    p = '{:03}'.format(i)
    s2 = s
    for j in range(3):#indexのループ
        if s2.find(p[j]) == -1:
            break
        s2 = s2[s2.find(p[j]) +1:]
    else:
        cnt+=1
print(cnt)

Buggy python submission (verdict: Runtime Error):
n = int(input())
s = list(input())
pin_li = []
for i in range(len(s)):
    if len(set(pin_li)) >1000:
        break
    for j in range(i+1,len(s)):
        for k in range(j+1,len(s)):
            pin_li.append(s[i]+s[j]+s[k])
            if len(set(pin_li)) > 1000:
                break
print(len(set(pin_li

Fixed submission:
n = int(input())
s = input()
cnt = 0
for i in range(1000):
    p = '{:03}'.format(i)
    s2 = s
    for j in range(3):#indexのループ
        if s2.find(p[j]) == -1:
            break
        s2 = s2[s2.find(p[j]) +1:]
    else:
        cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
pin_li = []
for i in range(len(s)):
    for j in range(i+1,len(s)):
        for k in range(j+1,len(s)):
            pin_li.append(s[i]+s[j]+s[k])
            if len(set(pin_li)) > 1000:
                break
print(len(set(pin_li)))

Fixed submission:
n = int(input())
s = input()
cnt = 0
for i in range(1000):
    p = '{:03}'.format(i)
    s2 = s
    for j in range(3):#indexのループ
        if s2.find(p[j]) == -1:
            break
        s2 = s2[s2.find(p[j]) +1:]
    else:
        cnt+=1
print(cnt)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = list(input())
pin_li = []
for i in range(len(s)):
    for j in range(i+1,len(s)):
        for k in range(j+1,len(s)):
            pin_li.append(s[i]+s[j]+s[k])
print(len(set(pin_li)))

Fixed submission:
n = int(input())
s = input()
cnt = 0
for i in range(1000):
    p = '{:03}'.format(i)
    s2 = s
    for j in range(3):#indexのループ
        if s2.find(p[j]) == -1:
            break
        s2 = s2[s2.find(p[j]) +1:]
    else:
        cnt+=1
print(cnt)
Buggy python submission (verdict: Runtime Error):
A, B = map(input, int().split())
print((B-1)//(A-1))


Fixed submission:
import math
A, B = map(int, input().split())
print(math.ceil((B-1)/(A-1)))
Buggy python submission (verdict: Time Limit Exceeded):
N, x = map(int, input().split())
a = list(map(int, input().split()))

ans = 0
use_list = []
for i in range(2**N):
    use_list.append(list(map(int, list(bin(i)[2::].zfill(N)))))
for u in use_list:
    s = 0
    
    for i in range(N):
        if u[i] == 1:
            s += a[i]
    if s < x:
        ans = max(ans, sum(u)-1)
    elif s == x:
        ans = max(ans, sum(u))
print(ans)

Fixed submission:
N, x = map(int, input().split())
a = list(map(int, input().split()))
dp = [[]]
a.sort()
ans = 0
f = False
for b in a:
    if b <= x:
        ans += 1
        x -= b
        f = True
    else:
        f = False
if x > 0 and f:
    ans -= 1
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int,input().sprit())
print((a-1)*(b-1))

Fixed submission:
a, b = map(int,input().split())
print((a-1)*(b-1))

Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())
print((a-1)*(b-1))

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

if k == '1':
    print(s[0])
else:
    n = int(k)-1
    f = True
    for i in range(n):
        if s[i] != '1':
            print(s[i])
            f = False
    if f:
        print(s[n])

Fixed submission:
s = list(input())
k = input()

if k == '1':
    print(s[0])
else:
    n = min(int(k), len(s))
    f = True
    for i in range(n):
        if s[i] != '1':
            print(s[i])
            f = False
            break
    if f:
        print(1)

Buggy python submission (verdict: Runtime Error):
s = list(input())
k = int(input())

if k == '1':
    print(s[0])
else:
    if s[0] == '1':
        print(s[1])
    else:
        print(s[0])

Fixed submission:
s = list(input())
k = input()

if k == '1':
    print(s[0])
else:
    n = min(int(k), len(s))
    f = True
    for i in range(n):
        if s[i] != '1':
            print(s[i])
            f = False
            break
    if f:
        print(1)
Buggy python submission (verdict: Runtime Error):
import math
T = int(input())

for _ in range(T):
    A, B, C, D = map(int, input().split())
    #print("----", _, A, B, C, D)
    if A < B:
        print("No")
        continue
    
    if C < A%B < B:
        print("No")
        continue
    
    if D % B == 0:
        print("Yes")
        continue
    
    if D < B:
        print("No")
        continue
    
    if C+(math.gcd(B,D)) < B:
        print("No")
        continue
    
    print("Yes")

Fixed submission:
T = int(input())
    
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

for _ in range(T):
    A, B, C, D = map(int, input().split())
    #print("----", _, A, B, C, D)
    if A < B:
        print("No")
        continue
    
    if C < A%B < B:
        print("No")
        continue
    
    if D % B == 0:
        print("Yes")
        continue
    
    if D < B:
        print("No")
        continue
    
    if C+(gcd(B,D)) < B:
        print("No")
        continue
    
    print("Yes")
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
ans = 0

for l in range(N):
  xor = a[l]
  for r in range(l+1, N):
    if xor ^ a[r] == xor + a[r]:
      ans += 1
      xor ^= a[r]
    else:
      break
print(ans+N)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0

l, r = 0, 0
xor = 0
while r < N:
  if xor ^ a[r] == xor + a[r]:
    xor = xor ^ a[r]
    ans += r-l+1
    r += 1
  else:
    xor -= a[l]
    l += 1
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
a = list(map(int, input().split()))
ans = 0

for l in range(N):
  or_ = a[l]
  for r in range(l+1, N):
    if or_ & a[r] == 0:
      ans += 1
      or_ |= a[r]
    else:
      break
print(ans+N)

Fixed submission:
N = int(input())
a = list(map(int, input().split()))
ans = 0

l, r = 0, 0
xor = 0
while r < N:
  if xor ^ a[r] == xor + a[r]:
    xor = xor ^ a[r]
    ans += r-l+1
    r += 1
  else:
    xor -= a[l]
    l += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
import itertools as it
def erat():
    D = {9:3, 25:5}
    yield from [2, 3, 5]
    MASK = [1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0]
    MODULOS = (1, 7, 11, 13, 17, 19, 23, 29) 

    for q in it.compress(
            it.islice(it.count(7), 0, None, 2),
            it.cycle(MASK)):
        p = D.pop(q, None)
        if p is None:
            D[q*q] = q
            yield q
        else:
            x = q + 2*p
            while x in D or (x%30) not in MODULOS:
                x += 2*p
            D[x] = p


n = int(input())
l = 0
ans = []
for k in erat():
    if k % 5 == 1:
        buf.append(k)
        l += 1
        if l >= n:
            break
print(*ans)


Fixed submission:
import itertools as it
def erat():
    D = {9:3, 25:5}
    yield from [2, 3, 5]
    MASK = [1, 0, 1, 1, 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0]
    MODULOS = (1, 7, 11, 13, 17, 19, 23, 29) 

    for q in it.compress(
            it.islice(it.count(7), 0, None, 2),
            it.cycle(MASK)):
        p = D.pop(q, None)
        if p is None:
            D[q*q] = q
            yield q
        else:
            x = q + 2*p
            while x in D or (x%30) not in MODULOS:
                x += 2*p
            D[x] = p


n = int(input())
l = 0
ans = []
for p in erat():
    if p % 5 == 1:
        ans.append(p)
        l += 1
        if l >= n:
            break
print(*ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
a = list(map(int, input().split()))

s = sum(a)
b = []
c = []
t = 0


for i in a:
    b.append(t)
    t += i
    c.append(s-t)
    
ans = 0
for i in range(n):
    for j in range(i, n):
        if b[i] + c[j] == s:
            ans += 1
print(ans)

Fixed submission:
n = int(input())
a = list(map(int, input().split()))
ans = 0
l = {0:1}
s = 0

for i in a:
    s += i
    if s in l:
        ans += l[s]
        l[s] += 1
    else:
        l[s] = 1

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))
for i in range(n):
    y = x[:]
    y.pop(i)
    y.sort()
    print(y[n//2-1])

Fixed submission:
n = int(input())
x = list(map(int, input().split()))
y = x[:]
y.sort()
a = y[n//2-1]
b = y[n//2]
for i in x:
    if i <= a:
        print(b)
    else:
        print(a)
Buggy python submission (verdict: Runtime Error):
n = int(input())
s = []
for i in range(n):
    s += [input()]
c0 = s.count("AC")
c1 = s.count("WA")
c2 = s.count("TLE")
c3 = s.count("RE")
print("AC × " + str(c0))
print("WA × " + str(c1))
print("TLE × " + str(c2))
print("RE × " + str(c3))6


Fixed submission:
n = int(input())
s = []
for i in range(n):
    s += [input()]
c0 = s.count("AC")
c1 = s.count("WA")
c2 = s.count("TLE")
c3 = s.count("RE")
print("AC x " + str(c0))
print("WA x " + str(c1))
print("TLE x " + str(c2))
print("RE x " + str(c3))
Buggy python submission (verdict: Runtime Error):
import sys
x,n=map(int,input().split())
if n==0:
    print(x)
    sys.exit()
else:
    p=list(map(int,input().split()))
    res=1000
    for i in range(1,101):
        p.append(i)
        if len(p)==len(set(p)):
            if res>=abs(x-i):
                res=abs(x-i)
                ans=i
        del p[-1]
    for i in range(n):
        if x+(x-ans)!=p[i]:
            print(x+(x-ans))
            sys.exit()
    print(ans)

Fixed submission:
import sys
x,n=map(int,input().split())
if n==0:
    print(x)
    sys.exit()
else:
    p=list(map(int,input().split()))
    res=1000
    ans=0
    for i in range(101,-101,-1):
        p.append(i)
        if len(p)==len(set(p)):
            if res>=abs(x-i):
                res=abs(x-i)
                ans=i
        del p[-1]
    print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))
sum=1
for i in a:
    sum*=i
if sum>1000000000000000000:
    print(-1)
else:
    print(sum)

Fixed submission:
import sys
n=int(input())
a=list(map(int,input().split()))
sum=1
for i in range(n):
    if a[i]==0:
        print(0)
        sys.exit()
for i in a:
    sum*=i
    if sum>1000000000000000000:
        print(-1)
        sys.exit()
else:
    print(sum)
Buggy python submission (verdict: Runtime Error):
s=input()
if x=="ABC":
    print("ARC")
else:
    print("ABC")

Fixed submission:
s=input()
if s=="ABC":
    print("ARC")
else:
    print("ABC")
Buggy python submission (verdict: Runtime Error):
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        sys.exit()
print("NG")

Fixed submission:
import sys
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        sys.exit()
print("NG")

Buggy python submission (verdict: Runtime Error):
K=int(input())
A,B=map(int,input().split())
#print(K,A,B)
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        sys.exit()
print("NG")

Fixed submission:
import sys
K=int(input())
A,B=map(int,input().split())
for i in range(A,B+1):
    if i%K==0:
        print("OK")
        sys.exit()
print("NG")
Buggy python submission (verdict: Runtime Error):
A,B,C,D=map(int,input().split())
while A>0:
  C-=B
  if C<=0:
    print("Yes")
    exit()
  A-=D
print("No")

Fixed submission:
s,w=map(int,input().split())
if s>w:
    print("safe")
else:
    print("unsafe")
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=list(map(int,input().split()))

res=0
for i in range(n):
    print(a.count(i+1))


Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))

b=collections.Counter(a)
for i in range(1,n+1):
    print(b[i])

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

b=[0 for i in range(n)]
res=0
for i in range(n):
    print(a.count(i+1))


Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))

b=collections.Counter(a)
for i in range(1,n+1):
    print(b[i])

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

b=[0 for i in range(n)]
res=0
for i in range(n):
    print(a.count(i+1))

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))

b=collections.Counter(a)
for i in range(1,n+1):
    print(b[i])

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

b=[0 for i in range(n)]
res=0
for i in range(n):
    b[i]=a.count(i+1)
for i in range(n):
    print(b[i])

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))

b=collections.Counter(a)
for i in range(1,n+1):
    print(b[i])

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

b=[0 for i in range(n)]
res=0
for i in range(n):
    for j in range(n-1):
        if i+1==a[j]:
            res+=1
    b[i]=res
    res=0
for i in range(n):
    print(b[i])

Fixed submission:
import collections
n=int(input())
a=list(map(int,input().split()))

b=collections.Counter(a)
for i in range(1,n+1):
    print(b[i])
Buggy python submission (verdict: Runtime Error):
def registar(nyukin,coin):
    oturi=nyukin-coin*int(nyukin/coin)
    return oturi,int(nyukin/coin)

x,coin_500=registar(x,500)
#print(coin_500)
x,coin_5=registar(x,5)
x,coin_1=registar(x,1)

#print(coin_500,coin_5,coin_1)
uresisa=coin_500*1000+coin_5*5
print(uresisa)

Fixed submission:
x=int(input())

coin_1=0
coin_5=0
coin_500=0

def registar(nyukin,coin):
    oturi=nyukin-coin*int(nyukin/coin)
    return oturi,int(nyukin/coin)

x,coin_500=registar(x,500)
#print(coin_500)
x,coin_5=registar(x,5)
x,coin_1=registar(x,1)

#print(coin_500,coin_5,coin_1)
uresisa=coin_500*1000+coin_5*5
print(uresisa)
Buggy python submission (verdict: Runtime Error):
3 0
1000000000 1000000000 1000000000

Fixed submission:
import sys
n,k=map(int,input().split())
h=list(map(int,input().split()))
h.sort()
if n<=k:
    print(0)
    sys.exit()
else:
    for i in range(k):
        h[-i-1]=0
ans=0
for i in h:
    ans+=i
print(ans)
Buggy python submission (verdict: Runtime Error):
n=int(input())
s=input()
l=[]
for i in s:
    l.append(i)
#print(l)
count=0
for i in range(len(l)):
    if l[i]=="A" and l[i+1]=="B" and l[i+2]=="C":
            count+=1
print(count)

Fixed submission:
n=int(input())
s=input()
l=[]
for i in s:
    l.append(i)
#print(l)
count=0
for i in range(len(l)-2):
    if l[i]=="A" and l[i+1]=="B" and l[i+2]=="C":
            count+=1
print(count)
Buggy python submission (verdict: Runtime Error):
s=[]
t=[]
for i in S:
    s.append(i)
for i in T:
    t.append(i)
l=[]
for i in range(n):
    l.append(s[i])
    l.append(t[i])
t=""
for i in range(len(l)):
    t+=l[i]
print(t)

Fixed submission:
n=int(input())
S,T=map(str,input().split())

s=[]
t=[]
for i in S:
    s.append(i)
for i in T:
    t.append(i)
l=[]
for i in range(n):
    l.append(s[i])
    l.append(t[i])
t=""
for i in range(len(l)):
    t+=l[i]
print(t)
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
import math
l=math.gcd(a,b)
print(int(a*b/l))


Fixed submission:
a,b=map(int,input().split())
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
l=gcd(a,b)
print(int(a*b/l))

Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
import math
l=math.gcd(a,b)
print(int(a*b/l))


Fixed submission:
a,b=map(int,input().split())
def gcd(x, y):
    while y:
        x, y = y, x % y
    return x
l=gcd(a,b)
print(int(a*b/l))
Buggy python submission (verdict: Time Limit Exceeded):
n=int(input())
a=[int(input()) for i in range(n)]

for i in range(n):
    b=a[:]
    del b[i]
    print(max(b))


Fixed submission:
n=int(input())
a=[int(input()) for i in range(n)]

res=max(a)
ans=[res]*n
s=[i for i, x in enumerate(a) if x ==res]
a.sort()
res2=a[-2]
for i in s:
    ans[i]=res2
for i in range(n):
    print(ans[i])
Buggy python submission (verdict: Runtime Error):
n,m=map(int,input().split())
drink=[list(map(int,input().split())) for i in range(n)]
#print(drink)

drink.sort()
#print(drink)
money=0
number=0
for i in range(n):
    if number+drink[i][0]=<m:
        money+=drink[i][0]*drink[i][1]
        number+=drink[i][1]
    elif m<number+drink[i][0]:
        money+=drink[i][0]*(m-number)
        number+=m-number
        break
    if m==number:
        break
print(money)

Fixed submission:
n,m=map(int,input().split())
drink=[list(map(int,input().split())) for i in range(n)]
#print(drink)

drink.sort()
#print(drink)
money=0
number=0
for i in range(n):
    if number+drink[i][1]<=m:
        money+=drink[i][0]*drink[i][1]
        number+=drink[i][1]
    elif m<number+drink[i][1]:
        money+=drink[i][0]*(m-number)
        number+=m-number
        break
    if m==number:
        break
print(money)