Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02646 (python)

Fixed submission:
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v <= w:
    print('NO')
else:
    if 1 <= (abs(b - a) / (v - w)) <= t:
        print('YES')
    else:
        print('NO')

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = v-w
i=0
for i in range(t+1):
  if v<=w:
    print('NO')
  elif p*i == d:
    print('YES')
    
  else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = v-w
i=0
for i in range(t+1):
  if v<=w:
    print("NO")
  elif p*i == d:
    print("YES")
    
  elif p*i < d:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = abs(v-w)
i=0
for i in range(t+1):
  if v<=w:
    print("NO")
  elif p*i == d:
    print("YES")
    
  elif p*i < d:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = abs(v-w)
i=0
for i in range(t+1):
  if v<=w:
    print("NO")
  if p*i == d:
    print("YES")

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = abs(v-w)
i=0
for i in range(t+1):
  if v<=w:
    print("NO")
  if p*t == d:
    print("YES")

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = abs(v-w)
i=0
for i in range(1:t):
  if v<=w:
    print("NO")
  elif p*t == d:
    print("YES")

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = abs(v-w)
i=0
for i in range(t):
  if v<=w:
    print("NO")
  elif p*t == d:
    print("YES")

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = int(input())

d = abs(b-a)
p = abs(w*t-v*t)
i=0
for i in range(t):
  if p=d:
    print("YES")
  else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = abs(wt-vt)
i=0
for i in range(t):
  if p=d:
    print("YES")
  else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = abs(wt-vt)
i=0
for i in range(t):
  if p>=d:
    print("YES")
  else:
    print("NO")

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = map(int,input().split())

d = abs(b-a)
p = abs(wt-vt)

if p>=d:
  print("YES")
else:
  print("NO")

Buggy submission (verdict: Runtime Error):
a,b,v,w,t = int(input())

d = abs(b-a)
u = vt
o = wt
p = abs(wt-vt)

if p>=d:
  print("YES")
else:
  print("NO")
Problem p02657 (python)

Fixed submission:
a,b =map(int,input().split())
if 1 <= a <=100 and 1 <= b <= 100:
     print(a*b)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
if 1 <= a <=100 and 1 <= b <= 100
     print(a*b)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
Z = a*b:
  print(Z)

Buggy submission (verdict: Runtime Error):
import math
a,b = int(input())
Z = a*b:
  print(Z)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
Z = a * b:
  print(Z)

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

Buggy submission (verdict: Runtime Error):
a,b = input()
Z = a*b:
  print(Z)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
Z = a*b
print(Z)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
Z = a*b:
  print(Z)
Problem p02658 (python)

Fixed submission:
n=int(input())
ls=[int(s) for s in input().split(" ")]

if 0 in ls:
  print(0)
else:
  num=1
  for i in ls:
    num*=i
    if num>10**18:
      num=-1
      break

  print(num)

Buggy submission (verdict: Runtime Error):
N = input() 
A = list(map(int,input().split()))
c = 1
i = 0
for i in N-1:
    if c *= A[i] >= 10**18:
      print(-1)
    else:
      print(c)

Buggy submission (verdict: Runtime Error):
N = input() 
A = list(map(int,input().split()))
c = 1
i = 0
for i in N-1:
    if c *= A[i] >= 10**18:
      print(-1)
      exit()
    else:
      print(c)

Buggy submission (verdict: Runtime Error):
N = input() 
A = list(map(int,input().split()))
c = 1
i = 0
for i in N-1:
    if c *= A[i] >= 10**18:
        print(-1)
        exit()
  
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input()) 
A = list(map(int,input().split()))
c = 1
i = 0
for i in N-1:
    if c *= A[i] >= 10**18:
      print(-1)
  
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input()) 
A = list(map(int,input().split()))
c = 1
i = 0
for i in N-1:
  c *= A[i]:
    if c >= 10**18:
      print(-1)
  
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input()) 
A = list(map(int,input().split()))
c = 1
i = 0
for i in N-1:
  c *= A[i]
   if c >= 10**18:
      print(-1)
  
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input()) 
A = list(map(int,input().split()))
c = 1
for i in N-1:
  c *= A[i]
  if c >= 10**18:
    print(-1)
  
print(c)

Buggy submission (verdict: Runtime Error):
N = int(input()) 
A = list(map(int,input().split()))
c = 1
for i in N-1:
  c *= A[i]
  print(c)
if c >= 10**18:
  print(-1)

Buggy submission (verdict: Runtime Error):
N = int(input()) 
A = list(map(int,input().split()))
c = 1
for i in N-1:
  c *= A[i]
print(c)
if c >= 10**18:
print(-1)

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))
N = len(A)
c = 1
for i in N-1:
  c *= A[i]
print(c)
if c >= 10**18:
  print(-1)

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))
N = len(A)
c = 1
for i in N:
  c *= A[i]
print(c)
if c >= 10**18:
  print(-1)

Buggy submission (verdict: Runtime Error):
A = list(map(int,input().split()))
N = len(A)
c = 1
for i in N:
  c *= A[i]
  print(c)
if c >= 10**18:
  print("-1")
Problem p03328 (python)

Fixed submission:
a, b = map(int, input().split())
c = b - a
lb = 0
for i in range(1, c + 1):
  lb += i
print(lb - b)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split)
z =[]

c = 0
for i in 999:
  c +=i
  z.append(c)

w =max(a,b)-min(a,b)
if (w==z[i+1]-z[i]):
  print(z[i]-a)

Buggy submission (verdict: Runtime Error):
a,b = int(input())
z =[]

c = 0
for i in 999:
  c +=i
  z.append(c)

w =max(a,b)-min(a,b)
if (w==z[i+1]-z[i]):
  print(z[i]-a)
Problem p03360 (python)

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

max_num = max([A, B, C])
max_num = max_num * (2 ** K)
print(sum([A, B, C]) - max([A, B, C]) + max_num)

Buggy submission (verdict: Runtime Error):
a,b,c=map(int,input().split())
k =int(input())
m = list[a,b,c]
maxm =max(m)
maxm =maxm*(2**k)
max(m)=maxm
print(sum(m))
Problem p03370 (python)

Fixed submission:
n,x = map(int, input().split())
A = [int(input()) for i in range(n)]

print(len(A) + (x - sum(A))//min(A))

Buggy submission (verdict: Runtime Error):
n,x = map(int,input().split())
m = list(sorted(input()))

cnt = 0
i = 0
for i in n:
  if x - m[i] > 0:
    x -= m[i]
    cnt+=1
    if x-m[i]<0:
      print(cnt)
Problem p03400 (python)

Fixed submission:
N = int(input())
D,X = map(int,input().split())
count = X

for i in range(N):
  a = int(input())
  count+=1+((D-1)//a)

print(count)

Buggy submission (verdict: Runtime Error):
N = int(input())
D,X = map(int,input().split())
count = x

for i in range(N):
  a = int(input())
  count+=1+((D-1)//a)

print(count)
Problem p03401 (python)

Fixed submission:
n = int(input())
a = [0] + list(map(int, input().split())) + [0]
A = [abs(a[i] - a[i + 1]) for i in range(n + 1)]
total = sum(A)

for i in range(n):
    print(total + abs(a[i + 2] - a[i]) - A[i] - A[i + 1])

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [0] + list(map(int,input().split()) + [0]
A = [abs(a[i]-a[i+1]) for i in range(N+1)]
total = sum(A)
             
for i in range(N):
    print(total + abs(a[i+2]-a[i])-A[i]-A[i+1])

Buggy submission (verdict: Runtime Error):
N = int(input())
a = [0]+list(map(int,input().split())+[0]
A =[abs(a[i]-a[i+1]) for i in range(N+1)]
total = sum(A)
             
for i in range(N):
    print(total+abs(a[i+2]-a[i])-A[i]-A[i+1])

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int,input().split())
i = 0        
for i in range(N):
         A.pop(i)
         A.insert(0,0)
         print(sum(abs(A[i+1]-A[i]))
         i+=1
Problem p03408 (python)

Fixed submission:
n=[input() for _ in range(int(input()))]
m=[input() for _ in range(int(input()))]
l=list(set(n))
print(max(0,max(n.count(l[i])-m.count(l[i]) for i in range(len(l)))))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(str,input().split())
m = int(input())
b = list(str,input().split())
ans = 0
de = 0
def get():
  for i in range(n+1):
    
    if a[i]==a[i+1]:
    ans += 1
    return ans
def lose():
  for i in range(m+1):
    if b[i]==b[i+1]:
      de -= 1
      return de

if get()<=lose():
Problem p02706 (python)

Fixed submission:
import math
a=input().split()
n,m=int(a[0]),int(a[1])
f=list(map(int,input().split()))
s=0
fl=0
s=sum(f)
if(n>=s):
  print(n-s)
else:
  print("-1")

Buggy submission (verdict: Runtime Error):
import math
a=input().split()
n,m=int(a[0]),int(a[1])
f=list(map(int,input().split()))
s=0
fl=0
s=sum(a)
if(s>=n):
  print(s-n)
else:
  print("-1")

Buggy submission (verdict: Runtime Error):
import math
a=input().split()
n,m
f=input().split()
s=0
fl=0
for i in range(0,int(a[1])):
    if(s>=int(a[0])):
        break
        fl+=1
if(fl!=1):
    print(int(a[0])-s)
else:
    print("-1")
Problem p02612 (python)

Fixed submission:
print((1000 - (int(input()) % 1000)) % 1000)

Buggy submission (verdict: Runtime Error):
print(input()　% 1000)
Problem p02613 (python)

Fixed submission:
ru = int(input())

a = [input() for i in range(ru)] 


print('AC x '+str(a.count('AC')))
print('WA x '+str(a.count('WA')))
print('TLE x '+str(a.count('TLE')))
print('RE x '+str(a.count('RE')))

Buggy submission (verdict: Runtime Error):
ru = int(input())

a = [input() for i in range(ru)] 


print('AC x '+a.count('AC'))
print('WA x '+a.count('WA'))
print('TLE x '+a.count('TLE'))
print('RE x '+a.count('RE'))

Buggy submission (verdict: Runtime Error):

ru = input()

a = [int(input()) for i in range(ru)] 


print('AC x '+a.count('AC'))
print('WA x '+a.count('WA'))
print('TLE x '+a.count('TLE'))
print('RE x '+a.count('RE'))
Problem p02657 (python)

Fixed submission:
inp=input()
num = [int(x) for x in inp.split(" ")]
print(num[0]*num[1])

Buggy submission (verdict: Runtime Error):
inp = input()
inp = input()

def mp(nums):
  n = 1
  limit = 10**18
  for num in nums:
    n *=num
    if n > limit:
      print(-1)
      return
  print(n)

mp([int(x) for x in inp.split(" ")])
Problem p02658 (python)

Fixed submission:
inp = input()
inp = input()
 
def mp(nums):
  if 0 in nums:
    print(0)
    return
  n = 1
  limit = 10**18
  for num in nums:
    n *=num
    if n > limit:
      print(-1)
      return
  print(n)
 
mp([int(x) for x in inp.split(" ")])

Buggy submission (verdict: Runtime Error):
inp = input()
inp = input()
 
def mp(nums):
  n = 1
  limit= 10 ** 10
  for num in nums:
    n *=num
  	if num > limit:
  	  print(-1)
  	  return
  print(num)
  return
 
mp([int(x) for x in inp.split(" ")])

Buggy submission (verdict: Runtime Error):
inp = input()
inp = input()
 
def mp(nums):
  n = 1
  limit= 10 ** 10
  for num in nums:
    n *=num
  	if num > limit:
  		print(-1)
  		return
  print(num)
  return
 
mp([int(x) for x in inp.split(" ")])

Buggy submission (verdict: Runtime Error):
inp = input()
inp = input()
 
def mp(nums):
  n = 1
  for num in nums:
    n *=num
  	if num > limit:
  		print(-1)
  		return
  print(num)
  return
 
limit= 10 ** 10
num = mp([int(x) for x in inp.split(" ")])

Buggy submission (verdict: Runtime Error):
inp=input()
nums = [int(x) for x in inp.split(" ")]

def mp(nums):
  n = 1
  for num in nums:
    n *=num
  return n

limit= mp([10]*18)
num = mp(nums)

if n>limit:
  print(-1)
else:
  print(num)
Problem p02628 (python)

Fixed submission:
n,k = map(int,input().split())
num_list = list(map(int,input().split()))

num_list.sort()
ans = 0

for i in range(k):
  ans += num_list[i]
else:
  print(ans)

Buggy submission (verdict: Runtime Error):
n,k = input().split()
num_list = list(map(int,input().split()))

num_list.sort()
ans = 0

for i in range(k):
  ans += num_list[i]
else:
  print(ans)
Problem p02630 (python)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
S = []
c = 0
s = sum(A)
table = [0] * 100001
 
for i in A:
    table[i] += 1
 
for i in range(Q):
    B, C = map(int,input().split())
    c = table[B]
    s += (C - B) * c
    table[C] += table[B]
    table[B] = 0
    S.append(s)

for s in S:
    print(s)

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

table = [0] * 100001

c = 0
s = 0

for i in A:
    table[i] += 1
    s += i

print(su,s)

for i in range(Q):
    B, C = map(int,input().split())
    c = table[B]
    s += (C - B) * c
    table[C] += table[B]
    table[B] = 0
    print(s)

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

table = [0] * 100001

c = 0
s = 0
 
for i in A:
    table[i] += 1
    sum += i
    
for i in range(Q):
    B, C = map(int,input().split())
    c = table[B]
    s += (C - B) * c
    table[C] += table[B]
    table[B] = 0
    print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
S = []
c = 0
s = sum(A)
table = [0] * 100000
 
for i in A:
    table[i] += 1
 
for i in range(Q):
    B, C = map(int,input().split())
    c = table[B]
    s += (C - B) * c
    table[C] += table[B]
    table[B] = 0
    S.append(s)

for s in S:
    print(s)

Buggy submission (verdict: Runtime Error):
N = int(input())
num_list = list(map(int,input().split()))
q = int(input())

for i in range(len(num_list)):
  ans += num_list[i]

for j in range(q):
  query = list(map(int,input().split()))
  cnt = num_list.count(query)
  ans += (query[1] - query[0]) * cnt
  print(ans)
Problem p02646 (python)

Fixed submission:
A, V = [int(n) for n in input().split()]
B, W = [int(n) for n in input().split()]
T = int(input())
 
if V <= W:
    print('NO')
    exit()
    
d = abs(A - B)

if V > W and d <= (V - W) * T:
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

if v == w:
  print('NO')
  exit()
elif (a > b) and (v >= m):
  print('NO')
  exit()
  
for i in range(1,t+1):
  oni = a+(v*i)
  child = c+(w*i)
  if oni >= child:
    print('YES')
    break
else:
  print('NO')

Buggy submission (verdict: Runtime Error):
a,v = map(int,input().split())
b,w = map(int,input().split())
t = int(input())

oni = a + (v*t)
child = b + (w*t)

if oni = child:
  print('YES')
else:
  print('NO')
Problem p02658 (python)

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

if 0 in A:
  ans = 0
  N = 0
  
for i in range(N):
  ans *= A[i]
  if ans > 10**18:
    ans = -1
    break
    
print(ans)

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

if 0 in A:
  print(1)
  exit
  
for i in range(N):
  ans *= A[i]
  if ans > 10**18:
    print(-1)
     exit()
    
print(ans)
Problem p02660 (python)

Fixed submission:
# ABC169 D Div Game

n = int(input())

def factorization(n):
    arr = []
    if n == 1:
        return arr
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

f_list = factorization(n)
cnt = 0
for i in range(len(f_list)):
    _tmp = f_list[i][1]
    j = 1
    while _tmp >= 0:
        _tmp -= j
        j += 1
        cnt += 1
    cnt -= 1

print(cnt)

Buggy submission (verdict: Runtime Error):
from decimal import Decimal
A,B = map(str,input().split())
A = Decimal(A)
B = Decimal(B)
print(int(A*B))
Problem p02664 (python)

Fixed submission:
T = input()
print(T.replace('?','D'))

Buggy submission (verdict: Runtime Error):
T = input()
PD = list(T)

for i in range(len(PD)):
  if PD[i] == '?':
    if i == 0 and P[1] in ('D','?'):
      PD[i] = 'P'
    elif i == len(PD):
      PD[i] = 'D'
    elif PD[i-1] == 'D' and PD[i+1] in ('D','?'):
      PD[i] = 'P'
    elif PD[i+1] == 'D':
      PD[i] = 'P'
    else:
      PD[i] = 'D'
      
print(''.join(PD))

Buggy submission (verdict: Runtime Error):
T = input()
PD = list(T)

for i in range(len(PD)):
  if PD[i] == '?':
    if i == 0 and P[1] == 'D':
      PD[i] = 'P'
    elif i == len(PD):
      PD[i] = 'D'
    elif (PD[i-2] == 'P' and PD[i-1] == 'D') and (PD[i-1] == 'D' and PD[i+1] in ('D','?')):
      PD[i] = 'P'
    else:
      PD[i] = 'D'
      
print(''.join(PD))

Buggy submission (verdict: Runtime Error):
T = input()
PD = list(T)

for i in range(len(PD)):
  if PD[i] == '?':
    if i == 0 and P[1] == 'D':
      PD[i] = 'P'
    elif i == len(PD):
      PD[i] = 'D'
    elif PD[i-2] == 'P' and PD[i-1] == 'D':
      PD[i] = 'P'
    else:
      PD[i] = 'D'
      
print(''.join(PD))

Buggy submission (verdict: Runtime Error):
T = input()
PD = list(T)

for i in range(len(PD)):
  if PD[i] == '?':
    if i == len(PD):
      PD[i] = 'D'
    elif PD[i-2] == 'P' and PD[i-1] == 'D':
      PD[i] = 'P'
    else:
      PD[i] = 'D'
      
print(''.join(PD))
Problem p02681 (python)

Fixed submission:
x = input()
y = input()
 
if x == y[:-1]:
	print('Yes')
else:
	print('No')

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())
 
if (a >= k):
    print(k)
elif ((a + b) >= k):
    print(a)
else:
    max_num = a - c
    print(max_num

Buggy submission (verdict: Runtime Error):
a, b, c, k = map(int, input().split())

if (a >= k):
    print(k)
elif ((a + b) >= k):
    print(a)
else:
    max_num = a - (k - a - b)
    print(max_num)
Problem p03078 (python)

Fixed submission:
#import itertools

x,y,z,k=(int(i) for i in input().split())
#print(x,y,z,k)
a=list(int(i) for i in input().split())
a.sort(reverse=True)
b=list(int(i) for i in input().split())
b.sort(reverse=True)
c=list(int(i) for i in input().split())
c.sort(reverse=True)
#print(a,b,c)

#k=3000
#a=[int(i) for i in range(1000)]
#b=[int(i) for i in range(1000)]
#c=[int(i) for i in range(1000)]
x=[]
for h in range(len(a)):
    for i in range(len(b)):
        if (h+1)*(i+1) <=k:
            for j in range(len(c)):
                if (h+1)*(i+1)*(j+1) <=k:
                    x.append(a[h]+b[i]+c[j])

x.sort(reverse=True)
for i in range(k):
  print(x[i])

Buggy submission (verdict: Runtime Error):
#from collections import deque
#import copy

x,y,z,ansk=(int(i) for i in input().split())
#print(x,y,z,k)

a=list(int(i) for i in input().split())
a.sort(reverse=True)
b=list(int(i) for i in input().split())
b.sort(reverse=True)
c=list(int(i) for i in input().split())
c.sort(reverse=True)
#print(a,b,c)

mylist=[0 for i in range(x*y)]
k=0
for i in range(x):
  for j in range(y):
    mylist[k]=a[i]+b[j]
    k+=1
mylist.sort(reverse=True)
if len(mylist)>3001:
  xy=len(mylist)
  mylist=mylist[:3001]
#print(mylist)

k=0
mylist1=[0 for i in range(xy*z)]
for i in range(xy):
  for j in range(z):
    mylist1[k]=mylist[i]+c[j]
    k+=1
mylist1.sort(reverse=True)

if len(mylist1) > 3001:
  mylist1 = mylist1[:3001]
  
for i in range(ansk):
  print(mylist1[i])
Problem p03089 (python)

Fixed submission:
import sys
input = sys.stdin.readline

n=int(input())
b=[int(i) for i in input().split()]

anslist=[]
while len(b) > 0:
    val=110
    for i in range(len(b)-1,-1,-1):
        if i+1==b[i]:
            val=i+1
            break
    anslist.append(val)
    b.pop(i)

if anslist.count(110)>0:
    print(-1)
else:
    for i in (reversed(anslist)):
        print(i)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
from collections import deque

n=int(input())
b=[int(i) for i in input().split()]

#print(n,b)

ans=deque([])

for j in range(n):
    tmp=110
    for i in range(len(b)-1,-1,-1):
        if len(b)==1:
            break
        else:
            if i+1==b[i]:
                val=b.pop(b[i])
                ans.append(val)
                
ans.append(b[0])

if ans.count(110) > 0:
    print(-1)
else:
    for i in range(n):
        print(ans[i])
Problem p03103 (python)

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

total=0
for i in range(n):
    if m > 0:
      total+=e[i][0]*min(e[i][1],m)
    m-=e[i][1]
    
print(total)

Buggy submission (verdict: Runtime Error):
n,m = [int(i) for i in input().split()]
e = [[int(i) for i in input().split()] for i in range(n)]
e.sort()
#print(n,m,e)
#e=dict(e)
#print(n,m,e,e[0][0]*m)

total=0
if m <= e[0][1]:
  total=e[0][0]*m
else:
  tmp=e[0][0]*e[0][1]
  m-=e[0][1]


#print(m)  
flag=0
for i in range(1,n):
  if 0 <= m <e[i][1] and flag==0:
    flag=1
    total=tmp+e[i][0]*m
  tmp+=e[i][0]*e[i][1]
  m-=e[i][1]

print(total)

Buggy submission (verdict: Runtime Error):
n,m = [int(i) for i in input().split()]
e = [[int(i) for i in input().split()] for i in range(n)]
e.sort()
#print(n,m,e)
#e=dict(e)
#print(n,m,e,e[0][0]*m)

total=0
if m < e[0][1]:
  total=e[0][0]*m
else:
  tmp=e[0][0]*e[0][1]
  m-=e[0][1]


#print(m)  
flag=0
for i in range(1,n):
  if 0 <= m <e[i][1] and flag==0:
    flag=1
    total=tmp+e[i][0]*m
  tmp+=e[i][0]*e[i][1]
  m-=e[i][1]

if n==1:
  total=e[0][0]*e[0][1]


print(total)